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
Which Kubernetes object gives each replica a stable network identity and its own persistent storage?
- Deployment
- Service
- StatefulSet
- 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.
Which workloads are a good fit for a StatefulSet?
- A database cluster where each replica keeps its own volume
- Peers that must find each other by stable hostnames
- A stateless web frontend behind a load balancer
- A one-off data import that runs to completion
- 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.
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.
