Choose the best description of what a ReplicaSet does in a Kubernetes cluster.
Think about what keeps pods running in the right quantity.
A ReplicaSet's main job is to keep the desired number of pod replicas running. It does not handle storage, networking, or scheduling directly.
Which YAML snippet correctly defines a ReplicaSet with 3 replicas running the 'nginx' container?
Check apiVersion, replicas count, and selector format carefully.
Option A uses the correct apiVersion 'apps/v1', sets replicas to 3, and uses 'matchLabels' under selector which is required. Option A has wrong apiVersion and selector format. Option A adds ports and image tag but is valid YAML; however, the question asks for a basic correct snippet, so the extra port is not necessary but not wrong. Option A has replicas set to 2, which is incorrect.
Given this ReplicaSet YAML applied to the cluster, what will be the output of kubectl get rs?
apiVersion: apps/v1 kind: ReplicaSet metadata: name: test-rs spec: replicas: 4 selector: matchLabels: app: test template: metadata: labels: app: test spec: containers: - name: test-container image: busybox command: ['sleep', '3600']
Think about what happens when you apply a ReplicaSet with 4 replicas.
When a ReplicaSet with 4 replicas is applied, Kubernetes creates 4 pods matching the selector. So DESIRED, CURRENT, and READY will all be 4 if pods are running correctly.
Given this ReplicaSet YAML, pods are not being created. What is the most likely cause?
apiVersion: apps/v1
kind: ReplicaSet
metadata:
name: fail-rs
spec:
replicas: 2
selector:
matchLabels:
app: fail
template:
metadata:
labels:
app: fail-app
spec:
containers:
- name: fail-container
image: nginxCheck if the selector and pod labels match exactly.
The selector uses label 'app: fail' but the pod template labels use 'app: fail-app'. They must match exactly for pods to be created.
When updating a ReplicaSet in a production environment, which practice is best to avoid downtime?
Think about how Kubernetes manages updates without downtime.
ReplicaSets do not support rolling updates directly. Deployments manage ReplicaSets and provide rolling update features to avoid downtime.