Kubernetes and Cloud Native Associate (KCNA)Kubernetes FundamentalsMedium

A team is developing a new cloud-native application and needs to define the desired state for their application's Pods, including the container image, resource limits, and the number of replicas. They also require automatic rollouts and rollbacks for updates. Which Kubernetes API object should they use to achieve this?

  1. AReplicaSet
  2. BDeployment
  3. CPod
  4. DStatefulSet
Show answer & explanation

Correct answer: B. Deployment

A Deployment is a higher-level object that manages ReplicaSets and provides declarative updates to Pods and ReplicaSets. It's ideal for stateless applications, offering automatic rollouts, rollbacks, and scaling, matching the requirements perfectly.

Why the other options are wrong

  • A. A ReplicaSet ensures a stable set of replica Pods running at any given time but lacks rollout/rollback capabilities.
  • C. A Pod is the lowest-level object and doesn't provide features like automatic rollouts or scaling.
  • D. StatefulSets are for stateful applications, providing stable network identities and persistent storage, not primarily for general stateless application rollouts.

Kubernetes Deployment

A Kubernetes API object that manages a replicated application by declaratively defining its desired state, handling updates and scaling.

  • Manages ReplicaSets to control the number of Pods.
  • Enables declarative updates and rollbacks of applications.
  • Suitable for stateless applications.

Memory trick: Deployments 'deploy' your app with 'updates' and 'scaling' handled.

More Kubernetes Fundamentals questions