In Kubernetes, a ReplicaSet is used to keep a stable set of replica pods running. Which of the following best explains how a ReplicaSet ensures availability?
Think about what happens if a pod crashes or is deleted.
A ReplicaSet constantly watches the pods it manages. If any pod stops running or is deleted, it creates a new one to keep the desired number of replicas. This automatic replacement keeps the application available.
You run the command kubectl get rs myapp-replicaset and see the following output:
NAME DESIRED CURRENT READY AGE myapp-replicaset 3 2 2 10m
What does this output indicate about the ReplicaSet's availability?
Look at the numbers under DESIRED, CURRENT, and READY.
The ReplicaSet wants 3 pods (DESIRED), but only 2 are currently running (CURRENT) and ready (READY). This means one pod is missing or not ready, so availability is not at full capacity.
When a pod managed by a ReplicaSet crashes, what is the correct sequence of actions the ReplicaSet controller performs to maintain availability?
Think about detection first, then status update, then creation, then readiness.
The ReplicaSet first detects the pod failure, updates its status, creates a replacement pod, and waits for it to become ready to maintain availability.
You notice your ReplicaSet is set to 4 replicas, but only 2 pods are running. The ReplicaSet is not creating new pods. Which of the following is the most likely cause?
Consider what happens if the cluster cannot find space for new pods.
If the cluster lacks CPU or memory resources, the scheduler cannot place new pods, so the ReplicaSet cannot create them even if desired.
To maximize availability, how should you configure ReplicaSets in a Kubernetes cluster with multiple nodes?
Think about spreading pods to avoid single points of failure.
Using multiple replicas with pod anti-affinity spreads pods across nodes, so if one node fails, others keep running pods, ensuring high availability.