Kubernetes Container Orchestration Container Orchestration 2 — Questions and Answers
Question 1: Which Kubernetes object automatically replaces a Pod if it crashes or is deleted?
- Job
- ReplicaSet (Correct answer)
- CronJob
- ConfigMap
Correct answer: ReplicaSet
A ReplicaSet continuously monitors Pods and recreates them to maintain the desired replica count.
Question 2: What is the purpose of a Kubernetes Namespace?
- To isolate network traffic between nodes
- To partition cluster resources among multiple teams or environments (Correct answer)
- To define storage class policies
- To schedule Pods on specific nodes
Correct answer: To partition cluster resources among multiple teams or environments
Namespaces provide a mechanism for isolating groups of resources within a single cluster.
Question 3: Which kubectl command shows the logs of a running container?
- kubectl describe pod <name>
- kubectl exec <pod> -- cat /var/log
- kubectl logs <pod-name> (Correct answer)
- kubectl inspect <pod-name>
Correct answer: kubectl logs <pod-name>
kubectl logs streams or displays the stdout/stderr output of a container in a Pod.
Question 4: A Pod is stuck in 'Pending' state. What is the most likely cause?
- The container image was pulled successfully
- No node has sufficient resources to schedule the Pod (Correct answer)
- The Pod's liveness probe is failing
- The Service selector does not match the Pod labels
Correct answer: No node has sufficient resources to schedule the Pod
Pods remain Pending when the scheduler cannot find a node that satisfies resource requests or node selectors.
Question 5: What does a Kubernetes Service of type 'ClusterIP' provide?
- External access via a cloud load balancer
- A stable internal IP accessible only within the cluster (Correct answer)
- A port mapped on every node for external access
- DNS resolution across multiple clusters
Correct answer: A stable internal IP accessible only within the cluster
ClusterIP exposes the Service on an internal IP, making it reachable only from within the cluster.
Question 6: Which Kubernetes feature allows you to prevent a Pod from being scheduled on a specific node?
- Affinity
- Taint and Toleration (Correct answer)
- ResourceQuota
- PodDisruptionBudget
Correct answer: Taint and Toleration
Taints are applied to nodes to repel Pods unless the Pod has a matching toleration.
Question 7: What is the role of the kube-scheduler component?
- Stores cluster state in etcd
- Watches for new Pods and assigns them to nodes (Correct answer)
- Manages network policies between Pods
- Exposes the Kubernetes API to clients
Correct answer: Watches for new Pods and assigns them to nodes
The kube-scheduler watches for unscheduled Pods and selects the best node based on resource availability and constraints.
Which Kubernetes object automatically replaces a Pod if it crashes or is deleted?