tezvyn:

Create a Deployment with 3 replicas via kubectl

AI-drafted, machine-checkedSource: interviewbeginner
WHAT IT TESTS

Basic kubectl Deployment fluency.

OUTLINE

kubectl create deployment webapp --image=my-app:1.0, then kubectl scale to 3 replicas, or use --replicas if supported.

WHAT THIS TESTS The interviewer wants to know you can stand up a managed, replicated workload quickly using kubectl, and that you understand the difference between a Pod, a Deployment, and the imperative versus declarative styles.

A GOOD ANSWER COVERS The core command is kubectl create deployment webapp --image=my-app:1.0. By default this gives you one replica, so you then run kubectl scale deployment webapp --replicas=3. Recent kubectl versions let you pass --replicas=3 directly on the create command. A strong candidate also notes that in production you would write a Deployment manifest and use kubectl apply -f deployment.yaml so the desired state lives in version control.

COMMON WRONG ANSWERS Using kubectl run, which in modern Kubernetes creates a single bare Pod rather than a Deployment. Assuming create sets three replicas without scaling. Confusing the image flag syntax or omitting it entirely.

LIKELY FOLLOW-UPS How do you verify the rollout? You watch kubectl rollout status deployment/webapp and inspect kubectl get pods. How do you change the image later? With kubectl set image. Why prefer declarative apply? Reproducibility, GitOps, and diff-based updates.

ONE CONCRETE EXAMPLE Run kubectl create deployment webapp --image=my-app:1.0, then kubectl scale deployment webapp --replicas=3. Kubernetes creates a Deployment object, which owns a ReplicaSet, which in turn schedules three Pods across available nodes. If a Pod dies, the ReplicaSet controller notices the gap between desired and actual count and creates a replacement, keeping the count at three without any manual intervention.

Read the original → kubernetes.io

Get five bites like this every day.

Tezvyn delivers a daily feed of 60-second tech bites with quizzes to lock in what you learn.