Kubernetes Container Orchestration Kubernetes 2 — Questions and Answers
Question 1: Which Kubernetes object automatically replaces a Pod if it crashes or is deleted?
- DaemonSet
- ReplicaSet (Correct answer)
- StatefulSet
- Job
Correct answer: ReplicaSet
A ReplicaSet continuously monitors Pods and creates replacements 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 users or teams (Correct answer)
- To define storage class policies
- To manage TLS certificates for services
Correct answer: To partition cluster resources among multiple users or teams
Namespaces provide a mechanism for isolating groups of resources within a single cluster, useful for multi-team environments.
Question 3: Which field in a Pod spec controls which node a Pod is scheduled on by matching node labels?
- tolerations
- affinity
- nodeSelector (Correct answer)
- nodeName
Correct answer: nodeSelector
nodeSelector is the simplest way to constrain a Pod to nodes with specific labels.
Question 4: What does a Kubernetes Ingress resource do?
- Exposes a single Pod directly to the internet
- Routes external HTTP/HTTPS traffic to internal Services based on rules (Correct answer)
- Creates an external LoadBalancer for UDP traffic
- Manages DNS records for cluster nodes
Correct answer: Routes external HTTP/HTTPS traffic to internal Services based on rules
An Ingress defines rules for routing external HTTP/HTTPS requests to Services inside the cluster, typically managed by an Ingress controller.
Question 5: Which command displays the logs of a running container in a Pod?
- kubectl describe pod <name>
- kubectl exec <pod> -- cat /var/log
- kubectl logs <pod> (Correct answer)
- kubectl inspect <pod>
Correct answer: kubectl logs <pod>
kubectl logs streams the stdout/stderr output of a container running inside the specified Pod.
Question 6: What is a PersistentVolumeClaim (PVC) in Kubernetes?
- A request by a user for storage resources (Correct answer)
- A type of network policy
- A definition of a storage class
- A backup configuration for etcd
Correct answer: A request by a user for storage resources
A PVC is a request for storage by a user that gets bound to a matching PersistentVolume (PV).
Question 7: Which Kubernetes component is responsible for storing all cluster state?
- kube-apiserver
- kube-scheduler
- etcd (Correct answer)
- kubelet
Correct answer: etcd
etcd is the distributed key-value store used as Kubernetes' backing store for all cluster state and configuration data.
Which Kubernetes object automatically replaces a Pod if it crashes or is deleted?