KCNA Container Orchestration 5 — Questions and Answers
Question 1: Which Kubernetes object should you use to expose a set of Pods as a network service with a stable IP and DNS name?
- Ingress
- Service (Correct answer)
- Endpoint
- NetworkPolicy
Correct answer: Service
A Service provides a stable virtual IP and DNS name that load-balances traffic across a set of Pods matching its selector.
Question 2: What is the effect of setting `terminationGracePeriodSeconds: 0` on a Pod?
- The Pod waits indefinitely for containers to stop
- The Pod is immediately killed with no grace period (Correct answer)
- The Pod restarts instead of terminating
- Kubernetes ignores the setting and uses 30s default
Correct answer: The Pod is immediately killed with no grace period
Setting this to 0 causes the Pod to be force-killed immediately without allowing containers to handle SIGTERM.
Question 3: In Kubernetes, what is the purpose of a Namespace?
- Provides network isolation between Pods
- Partitions cluster resources between multiple users or teams (Correct answer)
- Defines the container runtime to use
- Manages TLS certificates for Pods
Correct answer: Partitions cluster resources between multiple users or teams
Namespaces provide a mechanism to divide cluster resources between multiple users, teams, or projects with logical isolation.
Question 4: What is the primary difference between `kubectl apply` and `kubectl create`?
- `apply` creates resources only; `create` updates and creates
- `apply` is declarative and updates existing resources; `create` fails if the resource already exists (Correct answer)
- `create` uses GitOps; `apply` uses imperative commands
- They are functionally identical
Correct answer: `apply` is declarative and updates existing resources; `create` fails if the resource already exists
`kubectl apply` is declarative and merges changes into existing resources, while `kubectl create` returns an error if the resource already exists.
Question 5: Which container runtime interface does Kubernetes use to communicate with container runtimes like containerd or CRI-O?
- Docker Engine API
- Container Runtime Interface (CRI) (Correct answer)
- Open Container Initiative (OCI)
- Container Network Interface (CNI)
Correct answer: Container Runtime Interface (CRI)
The Container Runtime Interface (CRI) is the API that kubelet uses to interact with compatible container runtimes.
Question 6: A Pod is stuck in `Pending` state. What is the most likely cause?
- The container image failed to start
- No node satisfies the Pod's scheduling requirements (Correct answer)
- The container exited with a non-zero code
- The readinessProbe is failing
Correct answer: No node satisfies the Pod's scheduling requirements
A Pod remains Pending when the scheduler cannot find a suitable node due to insufficient resources, taints, or affinity rules.
Question 7: What is the role of the kubelet on a Kubernetes worker node?
- Routes traffic between Services and Pods
- Manages iptables rules for network connectivity
- Ensures containers described in PodSpecs are running and healthy (Correct answer)
- Stores cluster state in a distributed database
Correct answer: Ensures containers described in PodSpecs are running and healthy
The kubelet is an agent on each node that watches for PodSpecs and ensures the containers are running as expected.
Which Kubernetes object should you use to expose a set of Pods as a network service with a stable IP and DNS name?