# Kubernetes quiz questions

> 97 multiple-choice questions on Pods, Deployments, Services, scheduling, storage, networking, security and kubectl, with answers and explanations.

Quiz page: https://k8wiz.com/kubernetes/difficulty

## Beginner (Easy): 27 questions

Interactive quiz: https://k8wiz.com/kubernetes/quiz/easy

### Which kubectl command is used to view the logs of a pod?

Kubernetes, Easy (Beginner), Commands. https://k8wiz.com/uquiz/which-kubectl-command-is-used-to-view-the-logs-of-a-pod

- A. kubectl logs <pod-name>
- B. kubectl get logs <pod-name>
- C. kubectl describe logs <pod-name>
- D. kubectl view logs <pod-name>

**Answer:** kubectl logs <pod-name>

**Explanation:** The 'kubectl logs <pod-name>' command is used to view the logs of a specified pod. This is useful for debugging and monitoring applications running in pods.

### What is a Pod in Kubernetes?

Kubernetes, Easy (Beginner), Concepts. https://k8wiz.com/uquiz/what-is-a-pod-in-kubernetes

- A. A single instance of a running process in a cluster
- B. The smallest and simplest Kubernetes object that represents a set of running containers
- C. A group of nodes in a Kubernetes cluster
- D. A persistent storage volume

**Answer:** The smallest and simplest Kubernetes object that represents a set of running containers

**Explanation:** A Pod is the smallest deployable unit in Kubernetes and represents a single instance of an application. It can contain one or more containers that share network and storage resources.

### What is the purpose of a Kubernetes Service?

Kubernetes, Easy (Beginner), Networking. https://k8wiz.com/uquiz/what-is-the-purpose-of-a-kubernetes-service

- A. To provide persistent storage for pods
- B. To expose an application running on a set of pods as a network service
- C. To schedule pods on available nodes
- D. To manage the lifecycle of containers

**Answer:** To expose an application running on a set of pods as a network service

**Explanation:** A Kubernetes Service is an abstraction that defines a logical set of Pods and a policy to access them. Services enable network access to a set of pods and handle service discovery within the cluster.

### Which command would you use to create a deployment from a YAML file?

Kubernetes, Easy (Beginner), Commands. https://k8wiz.com/uquiz/which-command-would-you-use-to-create-a-deployment-from-a-yaml-file

- A. kubectl create -f deployment.yaml
- B. kubectl apply -f deployment.yaml
- C. kubectl deploy -f deployment.yaml
- D. kubectl start -f deployment.yaml

**Answer:** kubectl apply -f deployment.yaml

**Explanation:** The 'kubectl apply -f deployment.yaml' command is used to create or update resources defined in a YAML file. It's the recommended way to manage Kubernetes resources declaratively.

### Which kubectl command would you use to get detailed information about a specific pod?

Kubernetes, Easy (Beginner), Commands. https://k8wiz.com/uquiz/which-kubectl-command-would-you-use-to-get-detailed-information-about-a-specific-pod

- A. kubectl get pod <pod-name>
- B. kubectl describe pod <pod-name>
- C. kubectl info pod <pod-name>
- D. kubectl details pod <pod-name>

**Answer:** kubectl describe pod <pod-name>

**Explanation:** The 'kubectl describe pod <pod-name>' command provides detailed information about a specific pod, including its current status, events, containers, and configuration details. This is very useful for troubleshooting.

### What is a Kubernetes Namespace used for?

Kubernetes, Easy (Beginner), Concepts. https://k8wiz.com/uquiz/what-is-a-kubernetes-namespace-used-for

- A. To isolate nodes in a cluster
- B. To partition resources and provide a scope for names
- C. To define network policies between pods
- D. To manage storage classes for persistent volumes

**Answer:** To partition resources and provide a scope for names

**Explanation:** Namespaces provide a mechanism for isolating groups of resources within a single cluster. They are intended for use in environments with many users spread across multiple teams or projects, allowing for resource quotas and name isolation.

### What is the purpose of a ConfigMap in Kubernetes?

Kubernetes, Easy (Beginner), Concepts. https://k8wiz.com/uquiz/what-is-the-purpose-of-a-configmap-in-kubernetes

- A. To store sensitive information like passwords and tokens
- B. To store non-confidential configuration data as key-value pairs
- C. To configure resource limits for pods
- D. To map network ports between containers

**Answer:** To store non-confidential configuration data as key-value pairs

**Explanation:** ConfigMaps allow you to decouple configuration artifacts from image content to keep containerized applications portable. They store non-confidential data in key-value pairs that can be consumed by pods as environment variables, command-line arguments, or configuration files.

### Which command would you use to scale a deployment named 'nginx-deployment' to 5 replicas?

Kubernetes, Easy (Beginner), Commands. https://k8wiz.com/uquiz/which-command-would-you-use-to-scale-a-deployment-named-nginx-deployment-to-5-replicas

- A. kubectl scale deployment nginx-deployment --replicas=5
- B. kubectl resize deployment nginx-deployment --size=5
- C. kubectl update deployment nginx-deployment --replicas=5
- D. kubectl set replicas=5 deployment/nginx-deployment

**Answer:** kubectl scale deployment nginx-deployment --replicas=5

**Explanation:** The 'kubectl scale deployment nginx-deployment --replicas=5' command is used to scale a deployment to a specified number of replicas. This adjusts the number of pods managed by the deployment.

### Which kubectl command would you use to view all pods in all namespaces?

Kubernetes, Easy (Beginner), Commands. https://k8wiz.com/uquiz/which-kubectl-command-would-you-use-to-view-all-pods-in-all-namespaces

- A. kubectl get pods
- B. kubectl get pods --all
- C. kubectl get pods --all-namespaces
- D. kubectl get pods -n all

**Answer:** kubectl get pods --all-namespaces

**Explanation:** The 'kubectl get pods --all-namespaces' command (or the shorter form 'kubectl get pods -A') lists all pods across all namespaces in the cluster, providing a cluster-wide view of running pods.

### Which command would you use to create a new namespace called 'development'?

Kubernetes, Easy (Beginner), Commands. https://k8wiz.com/uquiz/which-command-would-you-use-to-create-a-new-namespace-called-development

- A. kubectl create namespace development
- B. kubectl add namespace development
- C. kubectl new namespace development
- D. kubectl namespace create development

**Answer:** kubectl create namespace development

**Explanation:** The 'kubectl create namespace development' command creates a new namespace called 'development'. Namespaces provide a way to divide cluster resources between multiple users or projects.

### Which kubectl command would you use to edit a running deployment named 'web-app'?

Kubernetes, Easy (Beginner), Commands. https://k8wiz.com/uquiz/which-kubectl-command-would-you-use-to-edit-a-running-deployment-named-web-app

- A. kubectl modify deployment web-app
- B. kubectl edit deployment web-app
- C. kubectl update deployment web-app
- D. kubectl change deployment web-app

**Answer:** kubectl edit deployment web-app

**Explanation:** The 'kubectl edit deployment web-app' command opens the deployment manifest in your default editor, allowing you to make changes. After saving and exiting, Kubernetes will apply the changes to the running deployment.

### What is the purpose of a Kubernetes Secret?

Kubernetes, Easy (Beginner), Concepts. https://k8wiz.com/uquiz/what-is-the-purpose-of-a-kubernetes-secret

- A. To store non-sensitive configuration data
- B. To store sensitive information like passwords, tokens, and keys
- C. To encrypt network traffic between pods
- D. To secure access to the Kubernetes API server

**Answer:** To store sensitive information like passwords, tokens, and keys

**Explanation:** Secrets are used to store sensitive information like passwords, OAuth tokens, and SSH keys. They allow you to separate sensitive content from pod specifications and container images, reducing the risk of accidental exposure.

### Which kubectl command would you use to view the resource usage of pods?

Kubernetes, Easy (Beginner), Commands. https://k8wiz.com/uquiz/which-kubectl-command-would-you-use-to-view-the-resource-usage-of-pods

- A. kubectl top pods
- B. kubectl metrics pods
- C. kubectl resource pods
- D. kubectl usage pods

**Answer:** kubectl top pods

**Explanation:** The 'kubectl top pods' command displays the resource usage (CPU/memory) of pods. This requires the Metrics Server to be deployed in your cluster to collect and provide this data.

### What happens when you apply a resource that already exists in the cluster?

Kubernetes, Easy (Beginner), Concepts. https://k8wiz.com/uquiz/what-happens-when-you-apply-a-resource-that-already-exists-in-the-cluster

- A. The existing resource is deleted and recreated
- B. The operation fails with an error
- C. The existing resource is updated with the new configuration
- D. A new resource is created with a different name

**Answer:** The existing resource is updated with the new configuration

**Explanation:** When you use 'kubectl apply' on a resource that already exists, Kubernetes will update the existing resource with the new configuration, applying only the changes. This is part of the declarative approach to resource management in Kubernetes.

### Which command would you use to get the YAML definition of a running pod named 'web-app'?

Kubernetes, Easy (Beginner), Commands. https://k8wiz.com/uquiz/which-command-would-you-use-to-get-the-yaml-definition-of-a-running-pod-named-web-app

- A. kubectl get pod web-app -o yaml
- B. kubectl describe pod web-app -o yaml
- C. kubectl export pod web-app
- D. kubectl yaml pod web-app

**Answer:** kubectl get pod web-app -o yaml

**Explanation:** The 'kubectl get pod web-app -o yaml' command retrieves the complete YAML definition of the running pod. This is useful for understanding the current state of the pod or for creating similar pods.

### What is the purpose of the 'kubectl port-forward' command?

Kubernetes, Easy (Beginner), Commands. https://k8wiz.com/uquiz/what-is-the-purpose-of-the-kubectl-port-forward-command

- A. To expose a service to the internet
- B. To forward local ports to ports on a pod for debugging or accessing applications
- C. To configure port mapping in a container
- D. To open firewall ports in the cluster

**Answer:** To forward local ports to ports on a pod for debugging or accessing applications

**Explanation:** The 'kubectl port-forward' command forwards local ports to ports on a pod. This is useful for debugging or accessing applications directly without exposing them via a Service, especially during development.

### What happens to a pod's data when it is deleted?

Kubernetes, Easy (Beginner), Storage. https://k8wiz.com/uquiz/what-happens-to-a-pods-data-when-it-is-deleted

- A. The data is automatically backed up to a PersistentVolume
- B. The data is temporarily stored in the node's memory
- C. The data is lost unless it was stored in a PersistentVolume
- D. The data is transferred to a new pod if part of a Deployment

**Answer:** The data is lost unless it was stored in a PersistentVolume

**Explanation:** When a pod is deleted, all data in its containers' filesystems is lost. To persist data beyond the lifecycle of a pod, you must use PersistentVolumes and PersistentVolumeClaims, or other external storage solutions.

### Which command would you use to view events in a Kubernetes cluster?

Kubernetes, Easy (Beginner), Commands. https://k8wiz.com/uquiz/which-command-would-you-use-to-view-events-in-a-kubernetes-cluster

- A. kubectl get events
- B. kubectl describe events
- C. kubectl logs events
- D. kubectl show events

**Answer:** kubectl get events

**Explanation:** The 'kubectl get events' command displays events in the cluster, such as pod scheduling, container creation, and errors. This is useful for troubleshooting and understanding what's happening in the cluster.

### Which kubectl command would you use to view the current context?

Kubernetes, Easy (Beginner), Commands. https://k8wiz.com/uquiz/which-kubectl-command-would-you-use-to-view-the-current-context

- A. kubectl config current-context
- B. kubectl context show
- C. kubectl get context
- D. kubectl describe context

**Answer:** kubectl config current-context

**Explanation:** The 'kubectl config current-context' command displays the current context, which determines which cluster kubectl communicates with. This is useful when working with multiple clusters.

### What is the purpose of the 'kubectl exec' command?

Kubernetes, Easy (Beginner), Commands. https://k8wiz.com/uquiz/what-is-the-purpose-of-the-kubectl-exec-command

- A. To execute a new deployment
- B. To run a command in a container of a pod
- C. To execute a script on a node
- D. To run a Kubernetes job

**Answer:** To run a command in a container of a pod

**Explanation:** The 'kubectl exec' command allows you to execute a command inside a container of a running pod. This is useful for debugging, running administrative commands, or accessing a shell inside the container.

### After maintenance on a drained Kubernetes node, which command lets the scheduler place new pods on it again?

Kubernetes, Easy (Beginner), Commands. https://k8wiz.com/uquiz/after-maintenance-on-a-drained-kubernetes-node-which-command-lets-the-scheduler-place-new-pods-on-it-again

- A. kubectl drain <node> --undo
- B. kubectl uncordon <node>
- C. kubectl taint node <node> --restore
- D. kubectl rollout restart node <node>

**Answer:** kubectl uncordon <node>

**Explanation:** kubectl drain cordons the node before evicting pods, which marks it unschedulable. kubectl uncordon removes that mark so the scheduler can use the node again. It doesn't move existing pods back; the node only receives new pods.

### A Kubernetes container shows reason OOMKilled with exit code 137. What does the exit code 137 tell you?

Kubernetes, Easy (Beginner), Troubleshooting. https://k8wiz.com/uquiz/a-kubernetes-container-shows-reason-oomkilled-with-exit-code-137-what-does-the-exit-code-137-tell-you

- A. The process was killed by SIGTERM, signal 15
- B. The process was killed by SIGKILL, signal 9
- C. The process was killed by SIGSEGV, signal 11
- D. The process was killed by SIGABRT, signal 6

**Answer:** The process was killed by SIGKILL, signal 9

**Explanation:** A process killed by a signal reports an exit code of 128 plus the signal number, and 128 + 9 = 137. The kernel OOM killer uses SIGKILL, which can't be caught. SIGTERM would give 143, and a SIGKILL can also come from the kubelet after a grace period runs out, so check the OOMKilled reason too.

### A container restarted after an out-of-memory kill. Which field of the Kubernetes pod status records that the previous run was OOMKilled?

Kubernetes, Easy (Beginner), Troubleshooting. https://k8wiz.com/uquiz/a-container-restarted-after-an-out-of-memory-kill-which-field-of-the-kubernetes-pod-status-records-that-the-previous-run-was-oom

- A. status.containerStatuses[].state.waiting.reason
- B. status.conditions[].reason
- C. status.reason
- D. status.containerStatuses[].lastState.terminated.reason

**Answer:** status.containerStatuses[].lastState.terminated.reason

**Explanation:** Once the kubelet restarts the container, state describes the new run and lastState keeps how the previous run ended, including reason OOMKilled and exitCode 137. kubectl describe shows it as Last State. status.reason is set at the pod level for things like a kubelet eviction, not for a container OOM kill.

### A container writes files to an emptyDir volume with medium: Memory. What do those files count against?

Kubernetes, Easy (Beginner), Storage. https://k8wiz.com/uquiz/a-container-writes-files-to-an-emptydir-volume-with-medium-memory-what-do-those-files-count-against

- A. The memory limit of the container that wrote them
- B. The ephemeral-storage limit of the pod
- C. The node's imagefs eviction threshold
- D. Nothing, tmpfs memory is not accounted to pods

**Answer:** The memory limit of the container that wrote them

**Explanation:** With medium: Memory, Kubernetes mounts a tmpfs, and files written there count against the memory limit of the container that wrote them. Filling the volume can get that container OOM-killed even though its process heap is small. Setting a sizeLimit on the volume caps how much it can hold.

### Which command shows when each certificate in a kubeadm cluster's control plane PKI expires?

Kubernetes, Easy (Beginner), Commands. https://k8wiz.com/uquiz/which-command-shows-when-each-certificate-in-a-kubeadm-clusters-control-plane-pki-expires

- A. kubectl get certificates -A
- B. kubeadm upgrade plan --show-certs
- C. kubeadm certs check-expiration
- D. kubeadm certs list --expiry

**Answer:** kubeadm certs check-expiration

**Explanation:** kubeadm certs check-expiration reads the certificates in /etc/kubernetes/pki and the client certificates embedded in admin.conf, controller-manager.conf and scheduler.conf, and prints their expiry date and residual time. It works from the files on disk, so it runs even when the API server is down. kubectl get certificates lists cert-manager Certificate resources, not the kubeadm PKI.

### With default settings, how long are the leaf certificates that kubeadm generates for the control plane valid?

Kubernetes, Easy (Beginner), Security. https://k8wiz.com/uquiz/with-default-settings-how-long-are-the-leaf-certificates-that-kubeadm-generates-for-the-control-plane-valid

- A. 90 days
- B. 1 year
- C. 5 years
- D. 10 years

**Answer:** 1 year

**Explanation:** kubeadm signs leaf certificates such as apiserver and the admin.conf client certificate for one year by default (certificateValidityPeriod: 8760h). Ten years is the default for the CA certificates (caCertificateValidityPeriod: 87600h), not for the certificates they sign.

### kubectl get pods shows a Pod with STATUS SchedulingGated. What makes the scheduler start trying to place it?

Kubernetes, Easy (Beginner), Troubleshooting. https://k8wiz.com/uquiz/kubectl-get-pods-shows-a-pod-with-status-schedulinggated-what-makes-the-scheduler-start-trying-to-place-it

- A. Adding a toleration that matches each gate name
- B. Removing every entry from spec.schedulingGates
- C. Waiting for the gate's tolerationSeconds to pass
- D. Restarting kube-scheduler to refresh its queue

**Answer:** Removing every entry from spec.schedulingGates

**Explanation:** A Pod with a non-empty spec.schedulingGates list gets a PodScheduled condition with reason SchedulingGated, and the scheduler does not attempt to place it. Once the controller or user removes all gates, the Pod enters the normal scheduling queue. Gates are not taints, so tolerations have no effect on them.

## Advanced (Medium): 41 questions

Interactive quiz: https://k8wiz.com/kubernetes/quiz/medium

### Which component of the Kubernetes control plane is responsible for maintaining the desired state of the cluster?

Kubernetes, Medium (Advanced), Architecture. https://k8wiz.com/uquiz/which-component-of-the-kubernetes-control-plane-is-responsible-for-maintaining-the-desired-state-of-the-cluster

- A. kube-apiserver
- B. etcd
- C. kube-controller-manager
- D. kube-scheduler

**Answer:** kube-controller-manager

**Explanation:** The kube-controller-manager runs controller processes that regulate the state of the cluster. These controllers include the Node Controller, Replication Controller, Endpoints Controller, and others that work to maintain the desired state.

### What is the difference between a Deployment and a StatefulSet?

Kubernetes, Medium (Advanced), Concepts. https://k8wiz.com/uquiz/what-is-the-difference-between-a-deployment-and-a-statefulset

- A. Deployments are for stateless applications, while StatefulSets are for stateful applications
- B. Deployments can only use ClusterIP services, while StatefulSets can use LoadBalancer services
- C. Deployments can scale horizontally, while StatefulSets cannot scale
- D. Deployments use ReplicaSets, while StatefulSets use DaemonSets

**Answer:** Deployments are for stateless applications, while StatefulSets are for stateful applications

**Explanation:** Deployments are designed for stateless applications where any pod is interchangeable with any other. StatefulSets are used for stateful applications that require stable network identities, persistent storage, and ordered deployment and scaling.

### A pod is stuck in 'Pending' state. What is the most likely cause?

Kubernetes, Medium (Advanced), Troubleshooting. https://k8wiz.com/uquiz/a-pod-is-stuck-in-pending-state-what-is-the-most-likely-cause

- A. The pod's image is being pulled from a registry
- B. There are insufficient resources (CPU, memory) to schedule the pod
- C. The pod is waiting for a ConfigMap or Secret to be created
- D. The pod's containers are still starting up

**Answer:** There are insufficient resources (CPU, memory) to schedule the pod

**Explanation:** When a pod is stuck in 'Pending' state, it often means the scheduler cannot find a node with sufficient resources to run the pod. This could be due to CPU, memory, or other resource constraints specified in the pod's requirements.

### Which component is responsible for maintaining network rules on nodes and enabling pod-to-pod communication?

Kubernetes, Medium (Advanced), Architecture. https://k8wiz.com/uquiz/which-component-is-responsible-for-maintaining-network-rules-on-nodes-and-enabling-pod-to-pod-communication

- A. kube-proxy
- B. kubelet
- C. kube-scheduler
- D. Container Network Interface (CNI)

**Answer:** kube-proxy

**Explanation:** kube-proxy maintains network rules on nodes and is responsible for implementing the Kubernetes Service concept. It enables pod-to-pod communication and handles network proxying by maintaining network rules on the host.

### What is a DaemonSet used for in Kubernetes?

Kubernetes, Medium (Advanced), Concepts. https://k8wiz.com/uquiz/what-is-a-daemonset-used-for-in-kubernetes

- A. To ensure all nodes run a copy of a specific pod
- B. To run batch jobs to completion
- C. To maintain stateful applications
- D. To expose services externally

**Answer:** To ensure all nodes run a copy of a specific pod

**Explanation:** A DaemonSet ensures that all (or some) nodes run a copy of a pod. As nodes are added to the cluster, pods are added to them. As nodes are removed, those pods are garbage collected. This is useful for running cluster-wide services like log collectors, monitoring agents, or storage daemons.

### What happens when a node in a Kubernetes cluster fails?

Kubernetes, Medium (Advanced), Architecture. https://k8wiz.com/uquiz/what-happens-when-a-node-in-a-kubernetes-cluster-fails

- A. All pods on that node are immediately rescheduled to other nodes
- B. The pods on that node are marked as 'Unknown' and eventually rescheduled if controlled by a controller
- C. The cluster automatically repairs the node
- D. The pods remain on the failed node until manually deleted

**Answer:** The pods on that node are marked as 'Unknown' and eventually rescheduled if controlled by a controller

**Explanation:** When a node fails, the pods running on it are marked as 'Unknown' or 'NotReady'. If these pods are managed by controllers like Deployments or ReplicaSets, new pods will be scheduled on other available nodes to maintain the desired state.

### What is the purpose of a PersistentVolume in Kubernetes?

Kubernetes, Medium (Advanced), Storage. https://k8wiz.com/uquiz/what-is-the-purpose-of-a-persistentvolume-in-kubernetes

- A. To provide temporary storage for containers
- B. To provide persistent storage that exists beyond the lifecycle of a pod
- C. To store configuration data for applications
- D. To cache container images for faster pod startup

**Answer:** To provide persistent storage that exists beyond the lifecycle of a pod

**Explanation:** PersistentVolumes (PVs) provide a way to store data that persists beyond the lifecycle of a pod. They are a cluster-wide resource that exists independently of pods and are provisioned by cluster administrators or dynamically using Storage Classes.

### What is the difference between a ClusterIP and a NodePort service?

Kubernetes, Medium (Advanced), Networking. https://k8wiz.com/uquiz/what-is-the-difference-between-a-clusterip-and-a-nodeport-service

- A. ClusterIP exposes the service on each node's IP, while NodePort exposes it on a cluster internal IP
- B. ClusterIP exposes the service on a cluster internal IP, while NodePort exposes it on each node's IP at a static port
- C. ClusterIP is only accessible within the cluster, while NodePort is accessible from outside the cluster
- D. ClusterIP is for stateless services, while NodePort is for stateful services

**Answer:** ClusterIP exposes the service on a cluster internal IP, while NodePort exposes it on each node's IP at a static port

**Explanation:** A ClusterIP service is only accessible within the cluster and exposes the service on an internal cluster IP. A NodePort service exposes the service on each node's IP at a static port, making it accessible from outside the cluster using <NodeIP>:<NodePort>.

### What is a Kubernetes Ingress?

Kubernetes, Medium (Advanced), Networking. https://k8wiz.com/uquiz/what-is-a-kubernetes-ingress

- A. A load balancer for external traffic
- B. A network policy that controls pod-to-pod communication
- C. An API object that manages external access to services, typically HTTP
- D. A component that routes traffic between containers in a pod

**Answer:** An API object that manages external access to services, typically HTTP

**Explanation:** Ingress is an API object that manages external access to services in a cluster, typically HTTP. It provides load balancing, SSL termination, and name-based virtual hosting. Ingress requires an Ingress controller to function properly.

### A pod is in 'CrashLoopBackOff' state. What does this indicate?

Kubernetes, Medium (Advanced), Troubleshooting. https://k8wiz.com/uquiz/a-pod-is-in-crashloopbackoff-state-what-does-this-indicate

- A. The pod is waiting for resources to become available
- B. The pod's containers are repeatedly crashing after starting
- C. The pod is being terminated due to node failure
- D. The pod's image cannot be pulled from the registry

**Answer:** The pod's containers are repeatedly crashing after starting

**Explanation:** CrashLoopBackOff indicates that the pod's containers are starting, crashing, then restarting repeatedly. This is often due to application errors, misconfiguration, or resource issues. Check the pod logs with 'kubectl logs' to diagnose the problem.

### Which component is responsible for executing containers on nodes?

Kubernetes, Medium (Advanced), Architecture. https://k8wiz.com/uquiz/which-component-is-responsible-for-executing-containers-on-nodes

- A. kube-apiserver
- B. kubelet
- C. kube-scheduler
- D. kube-controller-manager

**Answer:** kubelet

**Explanation:** The kubelet is an agent that runs on each node in the cluster. It ensures that containers are running in a Pod. The kubelet takes a set of PodSpecs and ensures that the containers described in those PodSpecs are running and healthy.

### What is the purpose of a Kubernetes ReplicaSet?

Kubernetes, Medium (Advanced), Concepts. https://k8wiz.com/uquiz/what-is-the-purpose-of-a-kubernetes-replicaset

- A. To ensure a specified number of pod replicas are running at any given time
- B. To create exact copies of nodes in a cluster
- C. To replicate data across persistent volumes
- D. To duplicate network services for high availability

**Answer:** To ensure a specified number of pod replicas are running at any given time

**Explanation:** A ReplicaSet's purpose is to maintain a stable set of replica Pods running at any given time. It is often used to guarantee the availability of a specified number of identical Pods. Deployments are a higher-level concept that manage ReplicaSets.

### Which network plugin is commonly used in Kubernetes to implement the Container Network Interface (CNI)?

Kubernetes, Medium (Advanced), Networking. https://k8wiz.com/uquiz/which-network-plugin-is-commonly-used-in-kubernetes-to-implement-the-container-network-interface-cni

- A. Docker Bridge
- B. Calico
- C. HAProxy
- D. Nginx

**Answer:** Calico

**Explanation:** Calico is a popular CNI plugin that provides networking and network policy for Kubernetes clusters. Other common CNI plugins include Flannel, Weave Net, and Cilium. These plugins implement the Container Network Interface specification to provide networking capabilities.

### What is the purpose of a PersistentVolumeClaim (PVC)?

Kubernetes, Medium (Advanced), Storage. https://k8wiz.com/uquiz/what-is-the-purpose-of-a-persistentvolumeclaim-pvc

- A. To provision storage dynamically in the cluster
- B. To request specific storage resources from a PersistentVolume
- C. To claim unused CPU and memory resources
- D. To reserve node capacity for critical workloads

**Answer:** To request specific storage resources from a PersistentVolume

**Explanation:** A PersistentVolumeClaim (PVC) is a request for storage by a user. It is similar to a Pod in that Pods consume node resources and PVCs consume PV resources. PVCs can request specific size, access modes, and storage classes.

### Which command would you use to delete a pod named 'nginx' immediately without a grace period?

Kubernetes, Medium (Advanced), Commands. https://k8wiz.com/uquiz/which-command-would-you-use-to-delete-a-pod-named-nginx-immediately-without-a-grace-period

- A. kubectl delete pod nginx
- B. kubectl delete pod nginx --now
- C. kubectl delete pod nginx --force
- D. kubectl delete pod nginx --grace-period=0 --force

**Answer:** kubectl delete pod nginx --grace-period=0 --force

**Explanation:** The 'kubectl delete pod nginx --grace-period=0 --force' command forcefully and immediately deletes the pod without waiting for the normal graceful termination period. This should be used with caution as it may cause data corruption or unexpected behavior.

### What is the difference between 'kubectl create' and 'kubectl apply'?

Kubernetes, Medium (Advanced), Commands. https://k8wiz.com/uquiz/what-is-the-difference-between-kubectl-create-and-kubectl-apply

- A. There is no difference; they are aliases of the same command
- B. 'create' is for initial creation only, while 'apply' can create and update resources
- C. 'create' works with all resource types, while 'apply' only works with certain types
- D. 'create' is faster but less reliable than 'apply'

**Answer:** 'create' is for initial creation only, while 'apply' can create and update resources

**Explanation:** 'kubectl create' is imperative and will fail if the resource already exists. 'kubectl apply' is declarative and can both create new resources and update existing ones. 'apply' is generally preferred for managing resources in production environments.

### What is a Kubernetes Taint?

Kubernetes, Medium (Advanced), Concepts. https://k8wiz.com/uquiz/what-is-a-kubernetes-taint

- A. A security vulnerability in a Kubernetes cluster
- B. A property of a node that repels certain pods from being scheduled on it
- C. A corrupted data segment in etcd
- D. A network policy that blocks certain traffic

**Answer:** A property of a node that repels certain pods from being scheduled on it

**Explanation:** Taints are properties of nodes that repel certain pods. When you taint a node, it will not accept pods unless they have a matching toleration. This is useful for dedicating nodes to specific workloads or preventing scheduling on problematic nodes.

### What is the purpose of a NetworkPolicy in Kubernetes?

Kubernetes, Medium (Advanced), Networking. https://k8wiz.com/uquiz/what-is-the-purpose-of-a-networkpolicy-in-kubernetes

- A. To configure load balancing between services
- B. To specify how groups of pods are allowed to communicate with each other and other network endpoints
- C. To define how services are exposed outside the cluster
- D. To optimize network performance between nodes

**Answer:** To specify how groups of pods are allowed to communicate with each other and other network endpoints

**Explanation:** NetworkPolicies are specifications of how groups of pods are allowed to communicate with each other and with other network endpoints. They provide fine-grained control over the network traffic to and from pods, similar to a firewall for pod traffic.

### What is a Kubernetes StatefulSet used for?

Kubernetes, Medium (Advanced), Concepts. https://k8wiz.com/uquiz/what-is-a-kubernetes-statefulset-used-for

- A. To run stateless applications
- B. To manage deployment and scaling of a set of pods with unique identities and stable storage
- C. To ensure exactly one pod runs on each node
- D. To run batch jobs to completion

**Answer:** To manage deployment and scaling of a set of pods with unique identities and stable storage

**Explanation:** StatefulSets are used for applications that require stable, unique network identifiers, stable persistent storage, and ordered deployment and scaling. Examples include databases, distributed key-value stores, and applications that require stable cluster membership.

### Which component stores the state of the Kubernetes cluster?

Kubernetes, Medium (Advanced), Architecture. https://k8wiz.com/uquiz/which-component-stores-the-state-of-the-kubernetes-cluster

- A. kube-apiserver
- B. etcd
- C. kube-controller-manager
- D. kubelet

**Answer:** etcd

**Explanation:** etcd is a consistent and highly-available key-value store used as Kubernetes' backing store for all cluster data. It stores the configuration data of the cluster, representing the state of the cluster at any given point in time.

### What is the purpose of a Kubernetes Job?

Kubernetes, Medium (Advanced), Concepts. https://k8wiz.com/uquiz/what-is-the-purpose-of-a-kubernetes-job

- A. To run continuous background processing
- B. To run pods that perform a finite task and then terminate
- C. To schedule maintenance tasks on nodes
- D. To manage user access to the cluster

**Answer:** To run pods that perform a finite task and then terminate

**Explanation:** A Job creates one or more pods and ensures that a specified number of them successfully terminate. Jobs are useful for batch processing, where each pod executes a task to completion and then stops, rather than running continuously like a Deployment.

### What is a Kubernetes CronJob?

Kubernetes, Medium (Advanced), Concepts. https://k8wiz.com/uquiz/what-is-a-kubernetes-cronjob

- A. A job that runs continuously in the background
- B. A job that runs on a time-based schedule
- C. A job that runs when CPU usage is low
- D. A job that runs when triggered by an external event

**Answer:** A job that runs on a time-based schedule

**Explanation:** A CronJob creates Jobs on a repeating schedule, similar to cron jobs in Linux. CronJobs are useful for scheduled tasks like backups, report generation, or any task that needs to run periodically.

### What is the purpose of a Kubernetes HorizontalPodAutoscaler?

Kubernetes, Medium (Advanced), Concepts. https://k8wiz.com/uquiz/what-is-the-purpose-of-a-kubernetes-horizontalpodautoscaler

- A. To automatically scale the number of nodes in a cluster
- B. To automatically scale the number of pods in a deployment based on CPU utilization or other metrics
- C. To automatically scale the resources allocated to a pod
- D. To automatically scale the storage capacity of persistent volumes

**Answer:** To automatically scale the number of pods in a deployment based on CPU utilization or other metrics

**Explanation:** The HorizontalPodAutoscaler automatically scales the number of pods in a deployment, replication controller, or replica set based on observed CPU utilization or other select metrics. This helps ensure that applications have the resources they need during peak times and saves resources during low-usage periods.

### What is the difference between a liveness probe and a readiness probe?

Kubernetes, Medium (Advanced), Concepts. https://k8wiz.com/uquiz/what-is-the-difference-between-a-liveness-probe-and-a-readiness-probe

- A. Liveness probes check if a container is alive, while readiness probes check if a container is ready to serve traffic
- B. Liveness probes check external dependencies, while readiness probes check internal health
- C. Liveness probes are mandatory, while readiness probes are optional
- D. Liveness probes run at pod startup, while readiness probes run periodically

**Answer:** Liveness probes check if a container is alive, while readiness probes check if a container is ready to serve traffic

**Explanation:** Liveness probes determine if a container is healthy; if the probe fails, the container is restarted. Readiness probes determine if a container is ready to receive traffic; if the probe fails, the pod's IP is removed from the endpoints of all Services that match it, effectively taking it out of service rotation without restarting it.

### What is the purpose of a ServiceAccount in Kubernetes?

Kubernetes, Medium (Advanced), Security. https://k8wiz.com/uquiz/what-is-the-purpose-of-a-serviceaccount-in-kubernetes

- A. To authenticate human users to the cluster
- B. To provide an identity for processes running in a pod
- C. To manage billing for Kubernetes services
- D. To create service-level agreements for applications

**Answer:** To provide an identity for processes running in a pod

**Explanation:** ServiceAccounts provide an identity for processes running in a pod. They are used to control which resources the pod can access through the Kubernetes API. Each namespace has a default ServiceAccount, but custom ones can be created for more fine-grained access control.

### Which command would you use to create a secret from a file?

Kubernetes, Medium (Advanced), Commands. https://k8wiz.com/uquiz/which-command-would-you-use-to-create-a-secret-from-a-file

- A. kubectl create secret generic my-secret --from-file=path/to/file
- B. kubectl apply secret my-secret --file=path/to/file
- C. kubectl secret create my-secret --from-file=path/to/file
- D. kubectl generate secret my-secret --file=path/to/file

**Answer:** kubectl create secret generic my-secret --from-file=path/to/file

**Explanation:** The 'kubectl create secret generic my-secret --from-file=path/to/file' command creates a secret from the contents of a file. This is useful for storing configuration files, certificates, or other sensitive data that needs to be accessed by pods.

### What is the purpose of a Kubernetes InitContainer?

Kubernetes, Medium (Advanced), Concepts. https://k8wiz.com/uquiz/what-is-the-purpose-of-a-kubernetes-initcontainer

- A. To initialize the Kubernetes cluster
- B. To run before app containers in a pod and complete before app containers start
- C. To initialize the container runtime on a node
- D. To create initial configuration for a deployment

**Answer:** To run before app containers in a pod and complete before app containers start

**Explanation:** InitContainers run before the app containers in a pod and must complete successfully before the app containers can start. They are useful for setup tasks like database schema initialization, dependency checking, or delaying application startup until prerequisites are met.

### Which component is responsible for scheduling pods onto nodes?

Kubernetes, Medium (Advanced), Architecture. https://k8wiz.com/uquiz/which-component-is-responsible-for-scheduling-pods-onto-nodes

- A. kube-apiserver
- B. kube-scheduler
- C. kubelet
- D. kube-controller-manager

**Answer:** kube-scheduler

**Explanation:** The kube-scheduler is responsible for deciding which node should run each pod. It takes into account factors such as resource requirements, hardware/software constraints, affinity and anti-affinity specifications, and more to make optimal scheduling decisions.

### What is the purpose of a Kubernetes ResourceQuota?

Kubernetes, Medium (Advanced), Concepts. https://k8wiz.com/uquiz/what-is-the-purpose-of-a-kubernetes-resourcequota

- A. To limit the total resource consumption in a namespace
- B. To allocate resources to nodes in a cluster
- C. To request resources for a pod
- D. To monitor resource usage across the cluster

**Answer:** To limit the total resource consumption in a namespace

**Explanation:** ResourceQuotas provide constraints that limit aggregate resource consumption per namespace. They can limit the quantity of objects that can be created in a namespace by type, as well as the total amount of compute resources (CPU, memory) that may be consumed by resources in that namespace.

### What is the difference between a RollingUpdate and a Recreate deployment strategy?

Kubernetes, Medium (Advanced), Concepts. https://k8wiz.com/uquiz/what-is-the-difference-between-a-rollingupdate-and-a-recreate-deployment-strategy

- A. RollingUpdate gradually replaces pods, while Recreate terminates all existing pods before creating new ones
- B. RollingUpdate is for stateful applications, while Recreate is for stateless applications
- C. RollingUpdate requires more resources, while Recreate is more resource-efficient
- D. RollingUpdate is the default strategy, while Recreate must be explicitly configured

**Answer:** RollingUpdate gradually replaces pods, while Recreate terminates all existing pods before creating new ones

**Explanation:** With a RollingUpdate strategy, the Deployment updates pods in a rolling fashion, creating new pods and terminating old ones gradually, ensuring availability during updates. With a Recreate strategy, all existing pods are terminated before new ones are created, causing downtime but ensuring no two versions run simultaneously.

### Which command would you use to view the logs of a specific container in a multi-container pod?

Kubernetes, Medium (Advanced), Commands. https://k8wiz.com/uquiz/which-command-would-you-use-to-view-the-logs-of-a-specific-container-in-a-multi-container-pod

- A. kubectl logs <pod-name> -c <container-name>
- B. kubectl log <pod-name> --container=<container-name>
- C. kubectl get logs <pod-name> <container-name>
- D. kubectl describe logs <pod-name> <container-name>

**Answer:** kubectl logs <pod-name> -c <container-name>

**Explanation:** The 'kubectl logs <pod-name> -c <container-name>' command allows you to view the logs of a specific container in a multi-container pod. This is useful when a pod has multiple containers and you need to debug or monitor a specific container.

### What is a Kubernetes Toleration?

Kubernetes, Medium (Advanced), Concepts. https://k8wiz.com/uquiz/what-is-a-kubernetes-toleration

- A. A setting that allows a pod to be scheduled on nodes with matching taints
- B. A limit on how many errors a pod can tolerate before being restarted
- C. A threshold for resource usage before scaling occurs
- D. A permission that allows a pod to access certain resources

**Answer:** A setting that allows a pod to be scheduled on nodes with matching taints

**Explanation:** Tolerations allow pods to be scheduled on nodes with matching taints. Taints repel pods from nodes, but pods with matching tolerations can still be scheduled on those nodes. This is useful for dedicating nodes to specific workloads or ensuring certain pods run on specialized hardware.

### What is the purpose of a Kubernetes StorageClass?

Kubernetes, Medium (Advanced), Storage. https://k8wiz.com/uquiz/what-is-the-purpose-of-a-kubernetes-storageclass

- A. To classify different types of storage media
- B. To provide a way to describe the 'classes' of storage offered by administrators
- C. To limit storage access to certain pods
- D. To encrypt data stored in persistent volumes

**Answer:** To provide a way to describe the 'classes' of storage offered by administrators

**Explanation:** StorageClasses provide a way to describe the 'classes' of storage offered by cluster administrators. Different classes might map to quality-of-service levels, backup policies, or arbitrary policies determined by the cluster administrators. They enable dynamic provisioning of PersistentVolumes.

### Which command would you use to drain a node for maintenance?

Kubernetes, Medium (Advanced), Commands. https://k8wiz.com/uquiz/which-command-would-you-use-to-drain-a-node-for-maintenance

- A. kubectl drain <node-name>
- B. kubectl cordon <node-name> --drain
- C. kubectl maintenance <node-name>
- D. kubectl node drain <node-name>

**Answer:** kubectl drain <node-name>

**Explanation:** The 'kubectl drain <node-name>' command safely evicts all pods from a node before you perform maintenance on it. It marks the node as unschedulable to prevent new pods from being scheduled to it, and then evicts the pods to other nodes.

### What is the purpose of the 'kubectl rollout' command?

Kubernetes, Medium (Advanced), Commands. https://k8wiz.com/uquiz/what-is-the-purpose-of-the-kubectl-rollout-command

- A. To roll out new features in a Kubernetes cluster
- B. To manage deployments, including viewing status and undoing changes
- C. To roll back failed pod creations
- D. To rotate encryption keys and certificates

**Answer:** To manage deployments, including viewing status and undoing changes

**Explanation:** The 'kubectl rollout' command manages the rollout of resources like deployments. It can be used to view the status of a rollout, pause or resume a rollout, or undo a previous rollout. This is useful for monitoring and controlling the deployment of application updates.

### What is a Kubernetes Endpoint?

Kubernetes, Medium (Advanced), Networking. https://k8wiz.com/uquiz/what-is-a-kubernetes-endpoint

- A. The URL of the Kubernetes API server
- B. A list of IP addresses and ports that represent the instances of a Service
- C. The entry point for external traffic into a cluster
- D. A node's network interface

**Answer:** A list of IP addresses and ports that represent the instances of a Service

**Explanation:** Endpoints in Kubernetes are a list of IP addresses and ports that correspond to the pods that are backing a Service. They are automatically created and updated by Kubernetes when a Service is created, but can also be manually created for special use cases.

### Which command would you use to label a node?

Kubernetes, Medium (Advanced), Commands. https://k8wiz.com/uquiz/which-command-would-you-use-to-label-a-node

- A. kubectl label node <node-name> key=value
- B. kubectl node label <node-name> key=value
- C. kubectl set label node <node-name> key=value
- D. kubectl annotate node <node-name> key=value

**Answer:** kubectl label node <node-name> key=value

**Explanation:** The 'kubectl label node <node-name> key=value' command adds or updates labels on a node. Labels are key-value pairs that can be used to organize and select subsets of objects, such as nodes with specific capabilities or in specific regions.

### Which HTTP status code does the Kubernetes Eviction API return when a PodDisruptionBudget blocks an eviction?

Kubernetes, Medium (Advanced), Troubleshooting. https://k8wiz.com/uquiz/which-http-status-code-does-the-kubernetes-eviction-api-return-when-a-poddisruptionbudget-blocks-an-eviction

- A. 403 Forbidden
- B. 409 Conflict
- C. 429 Too Many Requests
- D. 503 Service Unavailable

**Answer:** 429 Too Many Requests

**Explanation:** The API server answers 429 Too Many Requests when evicting the pod would violate its PodDisruptionBudget, meaning the eviction may succeed later. kubectl drain treats this as retryable and tries again every five seconds. A 500 error means a misconfiguration instead, such as two budgets selecting the same pod.

### The kubelet evicts a pod because its node has crossed the memory.available hard eviction threshold. What happens to that pod?

Kubernetes, Medium (Advanced), Troubleshooting. https://k8wiz.com/uquiz/the-kubelet-evicts-a-pod-because-its-node-has-crossed-the-memoryavailable-hard-eviction-threshold-what-happens-to-that-pod

- A. Its containers are restarted in place according to restartPolicy
- B. It waits until its PodDisruptionBudget allows the eviction
- C. Its phase is set to Failed and it is not restarted on that node
- D. It goes back to Pending and the scheduler places it on another node

**Answer:** Its phase is set to Failed and it is not restarted on that node

**Explanation:** During node-pressure eviction the kubelet sets the pod's phase to Failed, with reason Evicted, and terminates it. It ignores PodDisruptionBudgets and uses a zero grace period for hard thresholds. A controller such as a Deployment then creates a new pod, which can land elsewhere. A container OOM kill is different: the kubelet restarts the container in place.

### After running kubeadm certs renew all, openssl still shows the old expiry date on the certificate served on port 6443. What is the most likely reason?

Kubernetes, Medium (Advanced), Troubleshooting. https://k8wiz.com/uquiz/after-running-kubeadm-certs-renew-all-openssl-still-shows-the-old-expiry-date-on-the-certificate-served-on-port-6443-what-is-the

- A. The kube-apiserver static pod was not restarted to load the new files
- B. The renewal only rewrites the kubeadm-config ConfigMap in kube-system
- C. The new certificate stays inactive until the old one actually expires
- D. kubeadm writes renewed certificates to /var/lib/kubelet/pki by default

**Answer:** The kube-apiserver static pod was not restarted to load the new files

**Explanation:** kubeadm certs renew replaces the files on disk, but the running kube-apiserver keeps the old certificate in memory until it restarts. kubeadm ends with a reminder to restart kube-apiserver, kube-controller-manager, kube-scheduler and etcd. Because these are static pods, you restart them by moving their manifest out of /etc/kubernetes/manifests and back after the kubelet's fileCheckFrequency (20s by default).

### A Deployment wants 5 replicas but only 3 Pods exist and none is Pending. Where does a ResourceQuota rejection show up?

Kubernetes, Medium (Advanced), Troubleshooting. https://k8wiz.com/uquiz/a-deployment-wants-5-replicas-but-only-3-pods-exist-and-none-is-pending-where-does-a-resourcequota-rejection-show-up

- A. As a FailedScheduling event on the Deployment
- B. In the status of the ResourceQuota object itself
- C. In the kube-scheduler logs for the namespace
- D. As a FailedCreate event on the ReplicaSet

**Answer:** As a FailedCreate event on the ReplicaSet

**Explanation:** ResourceQuota is enforced by an admission plugin, so the API server rejects the Pod create request and no Pod object ever exists. The ReplicaSet controller made that request, and it records a FailedCreate event with a message like 'Error creating: pods "web-6f7d9c8b5-" is forbidden: exceeded quota: ...'. The scheduler never sees the Pod, so there is no FailedScheduling event.

## Expert (Hard): 29 questions

Interactive quiz: https://k8wiz.com/kubernetes/quiz/hard

### What is a Kubernetes Operator?

Kubernetes, Hard (Expert), Concepts. https://k8wiz.com/uquiz/what-is-a-kubernetes-operator

- A. A person who manages Kubernetes clusters
- B. A software extension to Kubernetes that makes use of custom resources to manage applications
- C. A component of the control plane that operates the scheduler
- D. A type of Kubernetes service that operates external load balancers

**Answer:** A software extension to Kubernetes that makes use of custom resources to manage applications

**Explanation:** A Kubernetes Operator is a method of packaging, deploying, and managing a Kubernetes application. It uses custom resources to define the application and custom controllers to manage it, automating complex, application-specific operational tasks.

### What is a Kubernetes Admission Controller?

Kubernetes, Hard (Expert), Architecture. https://k8wiz.com/uquiz/what-is-a-kubernetes-admission-controller

- A. A component that controls access to the Kubernetes API
- B. A plugin that intercepts requests to the Kubernetes API server before object persistence
- C. A controller that manages the admission of new nodes to the cluster
- D. A user interface for approving new deployments

**Answer:** A plugin that intercepts requests to the Kubernetes API server before object persistence

**Explanation:** Admission Controllers are plugins that intercept requests to the Kubernetes API server after authentication and authorization, but before object persistence. They can validate, mutate, or reject requests based on custom logic, enforcing security policies, resource quotas, or other requirements.

### What is a Kubernetes Custom Resource Definition (CRD)?

Kubernetes, Hard (Expert), Concepts. https://k8wiz.com/uquiz/what-is-a-kubernetes-custom-resource-definition-crd

- A. A custom implementation of a Kubernetes resource
- B. A way to extend the Kubernetes API with custom resource types
- C. A definition of custom metrics for autoscaling
- D. A custom configuration for the Kubernetes scheduler

**Answer:** A way to extend the Kubernetes API with custom resource types

**Explanation:** Custom Resource Definitions (CRDs) allow you to extend the Kubernetes API by defining custom resources. Once a CRD is created, you can create and manage custom objects using kubectl or the Kubernetes API, just like built-in resources such as pods or services.

### What is a Kubernetes PodDisruptionBudget used for?

Kubernetes, Hard (Expert), Concepts. https://k8wiz.com/uquiz/what-is-a-kubernetes-poddisruptionbudget-used-for

- A. To limit the number of pods that can be disrupted during voluntary disruptions
- B. To set resource limits for pods
- C. To control how pods are scheduled across nodes
- D. To define how pods are terminated when a node fails

**Answer:** To limit the number of pods that can be disrupted during voluntary disruptions

**Explanation:** A PodDisruptionBudget (PDB) limits the number of pods that can be down simultaneously during voluntary disruptions like node drains or pod evictions. This helps ensure application availability during cluster maintenance or scaling operations.

### What is the purpose of a Kubernetes ValidatingWebhookConfiguration?

Kubernetes, Hard (Expert), Security. https://k8wiz.com/uquiz/what-is-the-purpose-of-a-kubernetes-validatingwebhookconfiguration

- A. To validate user credentials before allowing access to the cluster
- B. To validate webhook endpoints are functioning correctly
- C. To intercept and potentially reject API requests based on custom logic
- D. To validate that web services are properly configured

**Answer:** To intercept and potentially reject API requests based on custom logic

**Explanation:** ValidatingWebhookConfiguration is an admission controller that intercepts API requests and can reject them based on custom logic implemented in an external webhook. This allows for custom validation rules beyond what Kubernetes provides natively, such as enforcing organization-specific policies.

### What is the purpose of a Kubernetes PriorityClass?

Kubernetes, Hard (Expert), Concepts. https://k8wiz.com/uquiz/what-is-the-purpose-of-a-kubernetes-priorityclass

- A. To set the priority of API requests
- B. To determine the order in which pods are scheduled and evicted
- C. To prioritize certain nodes for workloads
- D. To set the priority of log messages

**Answer:** To determine the order in which pods are scheduled and evicted

**Explanation:** PriorityClass defines the priority of a pod relative to other pods. When pods are created, they can be assigned a priority, and the scheduler uses this priority to determine the order of scheduling. Higher-priority pods are scheduled before lower-priority pods and can preempt lower-priority pods when resources are constrained.

### What is the purpose of a Kubernetes MutatingWebhookConfiguration?

Kubernetes, Hard (Expert), Security. https://k8wiz.com/uquiz/what-is-the-purpose-of-a-kubernetes-mutatingwebhookconfiguration

- A. To modify Kubernetes resources before they are stored
- B. To mutate the state of the cluster automatically
- C. To change the behavior of the Kubernetes API server
- D. To transform log data before it's stored

**Answer:** To modify Kubernetes resources before they are stored

**Explanation:** MutatingWebhookConfiguration is an admission controller that intercepts API requests and can modify them before they are persisted. This allows for automatic modifications like adding sidecar containers, setting default values, or injecting configuration based on custom logic implemented in an external webhook.

### Every container in a pod sets CPU and memory limits but no requests. What QoS class does the pod get?

Kubernetes, Hard (Expert), Concepts. https://k8wiz.com/uquiz/every-container-in-a-pod-sets-cpu-and-memory-limits-but-no-requests-what-qos-class-does-the-pod-get

- A. Burstable
- B. BestEffort
- C. None, because the API server rejects pods without requests
- D. Guaranteed

**Answer:** Guaranteed

**Explanation:** When a container sets a limit but no request, Kubernetes sets the request equal to the limit. Every container then has CPU and memory requests equal to its limits, which is the rule for Guaranteed. If any container lacked a CPU or memory limit, the pod would be Burstable. A pod with no requests or limits at all is BestEffort.

### A container keeps trying to use more CPU than its CPU limit. What happens?

Kubernetes, Hard (Expert), Troubleshooting. https://k8wiz.com/uquiz/a-container-keeps-trying-to-use-more-cpu-than-its-cpu-limit-what-happens

- A. The kernel throttles it through the CFS quota and it keeps running
- B. The container is OOM-killed and restarted
- C. The kubelet evicts the pod from the node
- D. The scheduler moves the pod to a node with more CPU

**Answer:** The kernel throttles it through the CFS quota and it keeps running

**Explanation:** CPU is a compressible resource. When a container reaches its CPU limit, the Linux CFS quota throttles it, which shows up as latency, not restarts. Memory is different. A container that goes over its memory limit is killed by the OOM killer and reports the reason OOMKilled.

### A pod was scheduled using a requiredDuringSchedulingIgnoredDuringExecution node affinity rule. Later someone removes the matching label from the node. What happens to the pod?

Kubernetes, Hard (Expert), Concepts. https://k8wiz.com/uquiz/a-pod-was-scheduled-using-a-requiredduringschedulingignoredduringexecution-node-affinity-rule-later-someone-removes-the-matching

- A. It is evicted right away
- B. It keeps running on that node
- C. It is evicted at the next kubelet sync
- D. It is marked Unschedulable and recreated elsewhere

**Answer:** It keeps running on that node

**Explanation:** The IgnoredDuringExecution part of the name means the rule is only checked when the pod is scheduled. Changing node labels afterwards doesn't affect pods already running there. To move pods off a node, add a NoExecute taint or drain the node.

### A node gets a NoExecute taint. A pod already running on it tolerates the taint with tolerationSeconds: 300. What happens?

Kubernetes, Hard (Expert), Concepts. https://k8wiz.com/uquiz/a-node-gets-a-noexecute-taint-a-pod-already-running-on-it-tolerates-the-taint-with-tolerationseconds-300-what-happens

- A. It is evicted at once, since NoExecute ignores tolerationSeconds
- B. It keeps running until the taint is removed from the node
- C. It is restarted on the same node every 300 seconds
- D. It keeps running for 300 seconds, then is evicted

**Answer:** It keeps running for 300 seconds, then is evicted

**Explanation:** NoExecute evicts running pods that don't tolerate the taint. A pod that tolerates it without tolerationSeconds stays forever. With tolerationSeconds, the pod stays bound for that many seconds after the taint is added and is then evicted. Kubernetes gives pods this kind of toleration for the node.kubernetes.io/not-ready and unreachable taints, with a default of 300 seconds.

### What does a DNS lookup of a headless Service (clusterIP: None) with a selector return?

Kubernetes, Hard (Expert), Networking. https://k8wiz.com/uquiz/what-does-a-dns-lookup-of-a-headless-service-clusterip-none-with-a-selector-return

- A. A single virtual IP that kube-proxy load-balances
- B. The IP addresses of the nodes running the pods
- C. No records, because headless Services aren't registered in DNS
- D. The IP addresses of the ready pods behind the Service

**Answer:** The IP addresses of the ready pods behind the Service

**Explanation:** A headless Service gets no cluster IP, so kube-proxy doesn't handle it. CoreDNS answers with an A or AAAA record for each ready endpoint, and the client chooses which pod to connect to. StatefulSets rely on this to give each pod a stable DNS name such as web-0.web.default.svc.cluster.local.

### What does externalTrafficPolicy: Local do on a NodePort or LoadBalancer Service?

Kubernetes, Hard (Expert), Networking. https://k8wiz.com/uquiz/what-does-externaltrafficpolicy-local-do-on-a-nodeport-or-loadbalancer-service

- A. Only accepts connections from clients inside the cluster's network
- B. Sends traffic to the pod with the fewest connections on any node
- C. Preserves the client IP and only uses pods on the receiving node
- D. Prefers pods in the client's zone, falling back to other zones

**Answer:** Preserves the client IP and only uses pods on the receiving node

**Explanation:** With the default Cluster policy, a node can forward traffic to a pod on another node, and SNAT hides the client IP. Local skips that extra hop, so the pod sees the real client IP. The trade-off is that nodes without a ready local pod drop the traffic and load can be uneven. Cloud load balancers use the Service's healthCheckNodePort to stop sending traffic to those nodes.

### In a NetworkPolicy ingress rule, what is the difference between putting namespaceSelector and podSelector in the same 'from' entry and putting them in two separate entries?

Kubernetes, Hard (Expert), Security. https://k8wiz.com/uquiz/in-a-networkpolicy-ingress-rule-what-is-the-difference-between-putting-namespaceselector-and-podselector-in-the-same-from-entry

- A. One entry means both must match (AND). Two entries mean either can match (OR)
- B. One entry means either can match (OR). Two entries mean both must match (AND)
- C. There is no difference
- D. The API server rejects two separate entries

**Answer:** One entry means both must match (AND). Two entries mean either can match (OR)

**Explanation:** Inside a single 'from' entry the selectors combine, so the source must be a matching pod in a matching namespace. As separate list items, each one is its own allow rule: any pod in a matching namespace, or a matching pod in the policy's own namespace. One missing '-' in the YAML turns one form into the other, which is a common cause of policies that allow far more than intended.

### Two controllers read the same Deployment and both send an update based on what they read. How does the API server stop the second update from silently overwriting the first?

Kubernetes, Hard (Expert), Architecture. https://k8wiz.com/uquiz/two-controllers-read-the-same-deployment-and-both-send-an-update-based-on-what-they-read-how-does-the-api-server-stop-the-second

- A. The API server locks the object while a client has it open
- B. etcd merges both updates field by field automatically
- C. The controller manager queues updates and applies them in order
- D. A stale resourceVersion in the update gets a 409 Conflict

**Answer:** A stale resourceVersion in the update gets a 409 Conflict

**Explanation:** Kubernetes uses optimistic concurrency. Every object has a resourceVersion that changes on each write. An update that sends an outdated resourceVersion fails with 409 Conflict, and the client has to read the object again and retry. Server-side apply adds field ownership on top of this, so conflicts are reported per field.

### A namespace has been stuck in Terminating for hours. What is the most likely cause?

Kubernetes, Hard (Expert), Troubleshooting. https://k8wiz.com/uquiz/a-namespace-has-been-stuck-in-terminating-for-hours-what-is-the-most-likely-cause

- A. A ResourceQuota in the namespace is blocking the deletion
- B. Pods in it are stuck in CrashLoopBackOff and can't stop
- C. Its default ServiceAccount was deleted before the namespace
- D. Leftover finalizers, or an aggregated API that is unavailable

**Answer:** Leftover finalizers, or an aggregated API that is unavailable

**Explanation:** The namespace controller deletes every object in the namespace and waits for them to disappear. An object with a finalizer stays until its controller removes the finalizer, so if that controller was uninstalled, deletion hangs. An unavailable APIService blocks it too, because the controller can't list those resources. 'kubectl get namespace <name> -o yaml' shows the reason in status.conditions.

### What does podManagementPolicy: Parallel change in a StatefulSet?

Kubernetes, Hard (Expert), Concepts. https://k8wiz.com/uquiz/what-does-podmanagementpolicy-parallel-change-in-a-statefulset

- A. Rolling updates replace every pod at the same time instead of one by one
- B. All replicas mount one shared PersistentVolumeClaim
- C. Scaling starts and stops pods together instead of in ordinal order
- D. Each pod gets its own Service instead of a shared headless one

**Answer:** Scaling starts and stops pods together instead of in ordinal order

**Explanation:** The default OrderedReady policy starts pods in order (0, 1, 2), waits for each to be Running and Ready, and removes them in reverse order. Parallel drops that ordering for scaling. It doesn't change rolling updates, which still replace pods one at a time in reverse ordinal order.

### What does volumeBindingMode: WaitForFirstConsumer on a StorageClass do?

Kubernetes, Hard (Expert), Storage. https://k8wiz.com/uquiz/what-does-volumebindingmode-waitforfirstconsumer-on-a-storageclass-do

- A. Waits until the first pod using the volume exits before deleting it
- B. Keeps the PVC read-only until a pod writes to it
- C. Delays provisioning and binding of a PVC until a pod that uses it is scheduled
- D. Lets only the first pod that mounts the volume use it

**Answer:** Delays provisioning and binding of a PVC until a pod that uses it is scheduled

**Explanation:** In the default Immediate mode, the volume is provisioned as soon as the PVC is created, possibly in a zone where the pod can't run. WaitForFirstConsumer makes the provisioner wait for the scheduler's choice, so the volume respects the pod's node selectors, affinity and topology. This matters for zonal disks such as EBS or Persistent Disk.

### A slow-starting application is killed by its liveness probe before it finishes starting. What is the recommended fix?

Kubernetes, Hard (Expert), Troubleshooting. https://k8wiz.com/uquiz/a-slow-starting-application-is-killed-by-its-liveness-probe-before-it-finishes-starting-what-is-the-recommended-fix

- A. Set the liveness probe's failureThreshold to 0 to disable restarts
- B. Replace the liveness probe with a readiness probe on the same endpoint
- C. Set restartPolicy: Never so the kubelet stops restarting it
- D. Add a startupProbe that covers the slow start

**Answer:** Add a startupProbe that covers the slow start

**Explanation:** While a startupProbe is defined and hasn't succeeded yet, the kubelet doesn't run the liveness or readiness probes. Set failureThreshold times periodSeconds long enough to cover the slowest startup. After it succeeds, the liveness probe can stay strict for the rest of the container's life. A large initialDelaySeconds also works, but it delays failure detection on every start.

### Which Pod Security Standards level requires pods to run as non-root, drop ALL capabilities, and use a seccomp profile?

Kubernetes, Hard (Expert), Security. https://k8wiz.com/uquiz/which-pod-security-standards-level-requires-pods-to-run-as-non-root-drop-all-capabilities-and-use-a-seccomp-profile

- A. baseline
- B. restricted
- C. privileged
- D. hardened

**Answer:** restricted

**Explanation:** Pod Security Admission has three levels. privileged allows everything. baseline blocks known privilege escalations such as hostPath volumes and privileged containers. restricted also requires runAsNonRoot, allowPrivilegeEscalation: false, dropping ALL capabilities (NET_BIND_SERVICE may be added back) and a RuntimeDefault or Localhost seccomp profile. You turn it on with namespace labels such as pod-security.kubernetes.io/enforce: restricted.

### A Kubernetes Deployment runs 7 replicas and its PodDisruptionBudget sets minAvailable: "50%". How many pods must stay available during a drain?

Kubernetes, Hard (Expert), Concepts. https://k8wiz.com/uquiz/a-kubernetes-deployment-runs-7-replicas-and-its-poddisruptionbudget-sets-minavailable-50-how-many-pods-must-stay-available-durin

- A. 4 pods
- B. 3 pods
- C. 5 pods
- D. 7 pods

**Answer:** 4 pods

**Explanation:** Half of 7 is 3.5, and Kubernetes rounds percentage values in a PodDisruptionBudget up to the nearest integer. So 4 pods must stay available and evictions stop once only 4 healthy pods are left. maxUnavailable percentages are rounded up too.

### A pod in CrashLoopBackOff keeps its Kubernetes PodDisruptionBudget at zero allowed disruptions and blocks a node drain. Which PDB setting lets the drain evict running pods that aren't Ready?

Kubernetes, Hard (Expert), Troubleshooting. https://k8wiz.com/uquiz/a-pod-in-crashloopbackoff-keeps-its-kubernetes-poddisruptionbudget-at-zero-allowed-disruptions-and-blocks-a-node-drain-which-pdb

- A. unhealthyPodEvictionPolicy: IfHealthyBudget
- B. unhealthyPodEvictionPolicy: EvictUnready
- C. disruptionPolicy: IgnoreNotReady
- D. unhealthyPodEvictionPolicy: AlwaysAllow

**Answer:** unhealthyPodEvictionPolicy: AlwaysAllow

**Explanation:** With AlwaysAllow, running pods that aren't Ready can be evicted whether or not the budget is met, while healthy pods stay protected. The default, IfHealthyBudget, only allows that when the application still meets its budget, so a crash-looping pod can block a drain indefinitely. The field has been stable since Kubernetes 1.31, and the upstream drain guide recommends AlwaysAllow.

### What happens when you try to evict a Kubernetes pod that is selected by two different PodDisruptionBudgets?

Kubernetes, Hard (Expert), Troubleshooting. https://k8wiz.com/uquiz/what-happens-when-you-try-to-evict-a-kubernetes-pod-that-is-selected-by-two-different-poddisruptionbudgets

- A. The stricter of the two budgets is enforced
- B. The API server refuses it with a 500 error
- C. The eviction needs both budgets to allow it
- D. The newer budget applies and the other is ignored

**Answer:** The API server refuses it with a 500 error

**Explanation:** The eviction subresource doesn't support pods covered by more than one PodDisruptionBudget, so the API server returns 500 Internal Server Error. A drain stops on that pod until you fix the overlapping selectors. Overlap is only reasonable briefly, while moving pods from one budget to another.

### On cgroup v2 nodes, which kubelet configuration field makes the kernel OOM-kill only the offending process in a container instead of every process in it?

Kubernetes, Hard (Expert), Concepts. https://k8wiz.com/uquiz/on-cgroup-v2-nodes-which-kubelet-configuration-field-makes-the-kernel-oom-kill-only-the-offending-process-in-a-container-instead

- A. kernelMemcgNotification: true
- B. memoryOOMGroup: false
- C. oomKillMode: Process
- D. singleProcessOOMKill: true

**Answer:** singleProcessOOMKill: true

**Explanation:** By default on cgroup v2 the kubelet sets memory.oom.group on each container's cgroup, so an OOM kill takes down all processes in the container together. singleProcessOOMKill: true stops the kubelet from setting that flag, which matches the old cgroup v1 behavior. kernelMemcgNotification is a real field, but it only makes the kubelet notice memory pressure faster for eviction.

### Why is kubelet.conf missing from the output of kubeadm certs check-expiration?

Kubernetes, Hard (Expert), Security. https://k8wiz.com/uquiz/why-is-kubeletconf-missing-from-the-output-of-kubeadm-certs-check-expiration

- A. kubeadm stores the kubelet client certificate inside the cluster CA bundle
- B. kubelet.conf uses a bootstrap token, so it contains no certificate at all
- C. The kubelet certificate is signed by front-proxy-ca, which kubeadm skips
- D. kubeadm leaves it to the kubelet, which rotates its own client certificate

**Answer:** kubeadm leaves it to the kubelet, which rotates its own client certificate

**Explanation:** kubeadm configures the kubelet for automatic client certificate rotation, with kubelet.conf pointing at /var/lib/kubelet/pki/kubelet-client-current.pem. The kubeadm source explicitly excludes kubelet.conf from renewal because management of that certificate is delegated to the kubelet. The bootstrap token from kubeadm join only gets the kubelet its first certificate.

### A kubeadm apiserver certificate still has 300 days left. What does kubeadm certs renew apiserver do?

Kubernetes, Hard (Expert), Commands. https://k8wiz.com/uquiz/a-kubeadm-apiserver-certificate-still-has-300-days-left-what-does-kubeadm-certs-renew-apiserver-do

- A. Exits without changes because the certificate is not close to expiry
- B. Renews it only when the remaining validity is shorter than 180 days
- C. Issues a new certificate anyway, since renewal ignores the expiry date
- D. Extends the current certificate's notAfter date without a new key

**Answer:** Issues a new certificate anyway, since renewal ignores the expiry date

**Explanation:** kubeadm certs renew runs unconditionally, regardless of the certificate's expiration date. It takes the subject and SANs from the existing certificate and signs a new one with the local CA, valid for certificateValidityPeriod (one year by default). A signed certificate cannot have its notAfter date edited in place, so renewal always means a new certificate.

### Why can a node with 10% actual CPU usage still produce 'Insufficient cpu' in a FailedScheduling event?

Kubernetes, Hard (Expert), Troubleshooting. https://k8wiz.com/uquiz/why-can-a-node-with-10-actual-cpu-usage-still-produce-insufficient-cpu-in-a-failedscheduling-event

- A. The scheduler compares the Pod's requests with allocatable minus existing requests
- B. The scheduler compares the Pod's limits with the node's free CPU from metrics-server
- C. The scheduler reserves 90% of node CPU for system daemons unless told otherwise
- D. The kubelet reports peak CPU over the last hour, not the current usage figure

**Answer:** The scheduler compares the Pod's requests with allocatable minus existing requests

**Explanation:** The NodeResourcesFit plugin rejects a node when the Pod's CPU request is larger than the node's allocatable CPU minus the summed requests of Pods already on it. Real usage and limits play no part. A node full of Pods with oversized requests is 'full' to the scheduler even when it is mostly idle.

### Why does 'pod has unbound immediate PersistentVolumeClaims' appear in a FailedScheduling message without a per-node count?

Kubernetes, Hard (Expert), Storage. https://k8wiz.com/uquiz/why-does-pod-has-unbound-immediate-persistentvolumeclaims-appear-in-a-failedscheduling-message-without-a-per-node-count

- A. The PV controller writes that part of the message, not the scheduler
- B. The scheduler counts volume failures per zone rather than per node
- C. VolumeBinding rejected the Pod in PreFilter, before nodes were checked
- D. The count is only shown when the StorageClass uses WaitForFirstConsumer

**Answer:** VolumeBinding rejected the Pod in PreFilter, before nodes were checked

**Explanation:** The VolumeBinding plugin's PreFilter returns this status when a PVC with Immediate binding is still unbound. When PreFilter fails, the scheduler's FitError message uses the PreFilter text instead of the 'count reason' histogram built from per-node Filter results. The fix lies with the PVC and the PV controller, since the scheduler waits until the claim is bound.

### A Pod requests 64 CPU on a cluster of 16-CPU nodes. Why does its event end with 'Preemption is not helpful for scheduling'?

Kubernetes, Hard (Expert), Troubleshooting. https://k8wiz.com/uquiz/a-pod-requests-64-cpu-on-a-cluster-of-16-cpu-nodes-why-does-its-event-end-with-preemption-is-not-helpful-for-scheduling

- A. Preemption is skipped for Pods that do not have any PriorityClass set
- B. NodeResourcesFit marks a request above allocatable as unresolvable
- C. Preemption only runs when fewer than half of the nodes are full
- D. The scheduler only preempts Pods whose requests are under 50%

**Answer:** NodeResourcesFit marks a request above allocatable as unresolvable

**Explanation:** When a Pod's request exceeds a node's total allocatable, NodeResourcesFit returns UnschedulableAndUnresolvable instead of Unschedulable. Preemption only considers nodes whose failure was plain Unschedulable, so these nodes get 'Preemption is not helpful for scheduling'. Evicting every Pod on a 16-CPU node still would not fit a 64-CPU request.
