Bitzu

Associate Cloud Engineer ยท Operating GKE clusters

What are Pods, Services, Deployments and StatefulSets for?

What each object is for, Deployment vs StatefulSet, rolling updates and rollbacks (kubectl rollout), scaling replicas, logs and exec for diagnostics.

Key points

  • A Pod runs one or more containers.
  • A Service gives Pods a stable address (ClusterIP inside, NodePort or LoadBalancer outside).
  • A Deployment manages stateless replicas with rolling updates and rollbacks (kubectl rollout status/history/undo).
  • A StatefulSet gives each replica a stable identity and its own storage.
  • Scale with kubectl scale; diagnose with kubectl logs and kubectl exec.

Source: https://docs.cloud.google.com/kubernetes-engine/docs/how-to/exposing-apps

Practice questions

Single choice

Which Kubernetes object gives each replica a stable network identity and its own persistent storage?

  1. Deployment
  2. Service
  3. StatefulSet
  4. ConfigMap
Show answer

Answer: C. StatefulSet

A StatefulSet keeps ordered, stable names and per-replica volumes. A Deployment treats replicas as interchangeable, and a Service only provides an address.

Select all that apply

Which workloads are a good fit for a StatefulSet?

  1. A database cluster where each replica keeps its own volume
  2. Peers that must find each other by stable hostnames
  3. A stateless web frontend behind a load balancer
  4. A one-off data import that runs to completion
  5. A stateless API where any replica is interchangeable
Show answer

Answer: A. A database cluster where each replica keeps its own volume, B. Peers that must find each other by stable hostnames

StatefulSets suit workloads where each replica has identity or its own data. Stateless frontends and one-off tasks fit Deployments and Jobs.

True or false

A Kubernetes Service is a group of running containers.

Show answer

Answer: False

False. Pods run containers. A Service is a stable virtual address that routes traffic to the matching Pods.

Practice 8 questions on this topic in Bitzu

Short lessons, instant explanations and spaced review of what you get wrong. Free on iOS and Android.

Download on the App StoreGet it on Google Play

More Associate Cloud Engineer topics in this module