Bird
0
0

Given this ReplicaSet YAML snippet, what will be the number of pods running after applying it?

medium📝 Command Output Q13 of 15
Kubernetes - ReplicaSets and Deployments
Given this ReplicaSet YAML snippet, what will be the number of pods running after applying it?
apiVersion: apps/v1
kind: ReplicaSet
metadata:
  name: test-rs
spec:
  replicas: 2
  selector:
    matchLabels:
      app: test
  template:
    metadata:
      labels:
        app: test
    spec:
      containers:
      - name: busybox
        image: busybox
        command: ['sleep', '3600']
A3 pods
B1 pod
C0 pods
D2 pods
Step-by-Step Solution
Solution:
  1. Step 1: Check replicas field

    The spec.replicas is set to 2, so Kubernetes will try to run 2 pods matching the selector.
  2. Step 2: Confirm selector and template labels match

    Selector matches label app: test, and template labels also have app: test, so pods will be created.
  3. Final Answer:

    2 pods -> Option D
  4. Quick Check:

    replicas = 2 pods running [OK]
Quick Trick: replicas number = pods running if labels match [OK]
Common Mistakes:
  • Ignoring label selector and template label matching
  • Assuming pods run without matching labels
  • Confusing replicas with container count

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kubernetes Quizzes