Complete the code to specify the number of pod replicas in a ReplicaSet.
replicas: [1]The replicas field sets how many pod copies the ReplicaSet should maintain. Setting it to 5 means 5 pods will run to ensure availability.
Complete the selector to match pods with label app: nginx.
selector:
matchLabels:
app: [1]The selector must match the pod label app: nginx so the ReplicaSet manages the correct pods.
Fix the error in the pod template labels to ensure they match the selector.
template:
metadata:
labels:
app: [1]The pod template labels must match the selector labels exactly. Here, app: nginx ensures the ReplicaSet manages these pods.
Fill both blanks to complete the ReplicaSet spec that ensures 4 nginx pods.
replicas: [1] selector: matchLabels: app: [2]
Setting replicas to 4 and selector app: nginx ensures 4 nginx pods run for availability.
Fill all three blanks to complete the pod template spec inside the ReplicaSet.
template:
metadata:
labels:
app: [1]
spec:
containers:
- name: [2]
image: [3]The pod template labels and container name should be consistent. Using app: nginx, container name web-server, and image nginx:latest ensures the ReplicaSet runs the correct pods.