Bird
0
0

After applying this Deployment YAML, how many Pods will be running?

medium📝 Predict Output Q4 of 15
Kubernetes - ReplicaSets and Deployments
After applying this Deployment YAML, how many Pods will be running?
apiVersion: apps/v1
kind: Deployment
metadata:
  name: webapp
spec:
  replicas: 5
  selector:
    matchLabels:
      tier: frontend
  template:
    metadata:
      labels:
        tier: frontend
    spec:
      containers:
      - name: web
        image: nginx
A5 Pods
B1 Pod
C0 Pods
D10 Pods
Step-by-Step Solution
Solution:
  1. Step 1: Check replicas field

    The spec.replicas is set to 5, indicating desired number of Pods.
  2. Step 2: Verify selector and labels match

    The selector matches pods with label tier: frontend, which matches the template labels.
  3. Step 3: Confirm Pods creation

    Since selector and template labels match, Kubernetes will create 5 Pods.
  4. Final Answer:

    5 Pods -> Option A
  5. Quick Check:

    Replicas field defines Pod count [OK]
Quick Trick: Replicas field sets Pod count [OK]
Common Mistakes:
  • Ignoring label selector and template label mismatch
  • Assuming default replicas if not specified
  • Confusing number of containers with number of Pods

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kubernetes Quizzes