CKAD practice questions and answers
All 60 questions from Full Practice Test 1 for Certified Kubernetes Application Developer (CKAD), with the correct answer and a full explanation for each — including why the other options are wrong. Free to read, no signup.
What this set covers
Questions are weighted to match the official CKAD exam guide. The real exam is 15-20 performance-based tasks ("The exams consist of 15-20 performance-based tasks.") questions in 120 minutes with a pass mark of 66%.
- Application Design and Build12 q · 20%
- Application Deployment12 q · 20%
- Application Observability and Maintenance10 q · 15%
- Application Environment, Configuration and Security14 q · 25%
- Services and Networking12 q · 20%
A Pod shows status CrashLoopBackOff. What does this indicate?
- AThe container keeps exiting and the kubelet is waiting longer between restart attempts✓
- BThe image could not be pulled from the registry
- CThe Pod cannot be scheduled to any node
- DThe Service has no matching endpoints
Correct answer: A — The container keeps exiting and the kubelet is waiting longer between restart attempts
CrashLoopBackOff means the container starts, exits, and is restarted with an increasing backoff delay, so the fix lies in the container's logs or command. Pull failures show as ImagePullBackOff, scheduling failures leave the Pod Pending, and endpoint problems are a Service concern.
Kubernetes — Debug PodsA container image has no shell, making kubectl exec impossible. Which feature allows attaching a temporary debugging container to the running Pod?
- Akubectl debug with an ephemeral container✓
- Bkubectl cp
- Ckubectl port-forward
- Dkubectl attach
Correct answer: A — kubectl debug with an ephemeral container
Ephemeral containers are added to a running Pod for troubleshooting and can use an image that includes debugging tools. kubectl cp copies files, port-forward tunnels a port, and attach connects to an existing container's process streams, which still requires that container to be usable.
Kubernetes — Ephemeral containersWhich two are correct about a failing liveness probe? (Select TWO.)
- AThe kubelet restarts the container✓
- BRepeated failures can produce a CrashLoopBackOff state✓
- CThe Pod is removed from Service endpoints but not restarted
- DThe Pod is rescheduled to another node immediately
- EThe Deployment automatically rolls back
Correct answer: A, B — The kubelet restarts the container · Repeated failures can produce a CrashLoopBackOff state
Liveness failures cause container restarts, and persistent failures produce the backoff loop. Removal from endpoints without restart is readiness behaviour, the Pod is not moved to another node, and Deployments do not roll back automatically on probe failure.
Kubernetes — Liveness probesWhich Service type exposes an application on a static port on every node's IP address?
- ANodePort✓
- BClusterIP
- CExternalName
- DHeadless
Correct answer: A — NodePort
NodePort allocates a port on every node that forwards to the Service. ClusterIP is internal only, ExternalName maps to a DNS name via CNAME, and a headless Service returns Pod addresses directly rather than opening a node port.
Kubernetes — Service typesWhich command creates a Service that exposes an existing Deployment inside the cluster on port 80?
- Akubectl expose deployment web --port=80 --target-port=8080✓
- Bkubectl scale deployment web --replicas=3
- Ckubectl rollout status deployment web
- Dkubectl annotate deployment web port=80
Correct answer: A — kubectl expose deployment web --port=80 --target-port=8080
kubectl expose creates a Service whose selector matches the Deployment's Pods, mapping the Service port to the container's target port. Scaling changes replica count, rollout status reports progress, and annotations are metadata.
Kubernetes — Connect applications with ServicesA container is killed with reason OOMKilled. What is the direct cause?
- AThe container exceeded its memory limit✓
- BThe container exceeded its CPU limit
- CThe liveness probe timed out
- DThe node was cordoned
Correct answer: A — The container exceeded its memory limit
Memory is incompressible, so exceeding the memory limit causes the kernel to kill the process and Kubernetes reports OOMKilled. Exceeding a CPU limit causes throttling instead, probe timeouts report a different reason, and cordoning only prevents new scheduling.
Kubernetes — Resource managementWhich kubectl flag streams new log lines from a container as they are produced?
- A--follow✓
- B--previous
- C--dry-run=client
- D--record
Correct answer: A — --follow
The follow flag tails the log stream continuously, which is what you want while reproducing a problem. previous reads the prior container instance, dry-run renders without applying, and record annotated the change cause on older kubectl versions.
Kubernetes — kubectl logsWhich tool packages an application's manifests into a versioned chart with configurable values?
- AHelm✓
- Bcrictl
- Cetcdctl
- Dkubeadm
Correct answer: A — Helm
Helm charts template manifests with values and track releases so upgrades and rollbacks are versioned. crictl talks to the container runtime, etcdctl administers etcd, and kubeadm bootstraps clusters.
Helm — ChartsWhere should an application write its logs so that kubectl logs and cluster log collection work correctly?
- ATo stdout and stderr✓
- BTo a file inside the container's filesystem
- CTo a hostPath directory on the node
- DTo a remote syslog server only
Correct answer: A — To stdout and stderr
The container runtime captures standard output and error, which is what kubectl logs reads and what node log agents collect. Files inside the container are lost on restart, hostPath couples the Pod to a node, and sending only to a remote server bypasses the platform's own log pipeline.
Kubernetes — Logging architectureWhich command forwards a local port to a port on a Pod for testing without exposing a Service?
- Akubectl port-forward pod/web 8080:80✓
- Bkubectl proxy --port=8080
- Ckubectl expose pod web --port=80
- Dkubectl cp web:/tmp ./tmp
Correct answer: A — kubectl port-forward pod/web 8080:80
port-forward tunnels a local port through the API server to the Pod, which is ideal for ad hoc testing. kubectl proxy exposes the API server, expose creates a Service, and cp copies files.
Kubernetes — Use port forwardingWhich field assigns a specific service account to a Pod instead of the namespace default?
- Aspec.serviceAccountName✓
- Bspec.securityContext.runAsUser
- Cmetadata.labels
- Dspec.schedulerName
Correct answer: A — spec.serviceAccountName
serviceAccountName in the Pod spec selects the identity whose token is mounted and whose RBAC applies. runAsUser sets the Linux UID, labels are metadata, and schedulerName picks which scheduler places the Pod.
Kubernetes — Configure service accounts for PodsA ConfigMap is updated after the Pods are running. Which statement is correct?
- AValues mounted as a volume are eventually updated in the container, while environment variables are not✓
- BBoth mounted files and environment variables update immediately
- CNeither mounted files nor environment variables ever update
- DThe Pod is automatically restarted by the API server
Correct answer: A — Values mounted as a volume are eventually updated in the container, while environment variables are not
The kubelet refreshes projected ConfigMap volumes after a sync period, but environment variables are set at container start and stay fixed until a restart. Kubernetes does not restart Pods automatically when a ConfigMap changes.
Kubernetes — ConfigMapsWhich Pod restart policy is required for a Job's Pods?
- ANever or OnFailure✓
- BAlways
- CAny policy is accepted
- DRestart policies do not apply to Jobs
Correct answer: A — Never or OnFailure
A Job's Pod template must use Never or OnFailure because Always would prevent the Pod from ever reaching a terminal completed state. Restart policies do apply, and Always is specifically rejected for Jobs.
Kubernetes — Job Pod templateA CronJob must not start a new run while the previous one is still executing. Which field enforces this?
- Aspec.concurrencyPolicy set to Forbid✓
- Bspec.suspend set to true
- Cspec.schedule set to a longer interval
- Dspec.successfulJobsHistoryLimit set to 1
Correct answer: A — spec.concurrencyPolicy set to Forbid
Forbid skips a scheduled run if the previous Job is still active. Suspend stops all scheduling, a longer interval does not guarantee the previous run has finished, and the history limit only controls how many completed Jobs are retained.
Kubernetes — CronJobA container must not run as the root user. Which securityContext setting enforces this?
- ArunAsNonRoot set to true, with runAsUser set to a non-zero UID✓
- Bprivileged set to true
- ChostIPC set to true
- Dcapabilities add SYS_ADMIN
Correct answer: A — runAsNonRoot set to true, with runAsUser set to a non-zero UID
runAsNonRoot makes the kubelet refuse to start a container that would run as UID 0, and runAsUser pins the identity. Privileged mode, host IPC sharing, and adding SYS_ADMIN all expand privilege rather than restricting it.
Kubernetes — Security contextWhich resource type would a namespace administrator use to cap the total number of Pods and the total memory requested in that namespace?
- AResourceQuota✓
- BLimitRange
- CHorizontalPodAutoscaler
- DPodDisruptionBudget
Correct answer: A — ResourceQuota
A ResourceQuota bounds aggregate consumption and object counts for the namespace. LimitRange operates per container or Pod, the autoscaler changes replica counts, and disruption budgets constrain evictions.
Kubernetes — Resource quotasA container needs a value from a Secret exposed as a single environment variable. Which field is used?
- Aenv with valueFrom.secretKeyRef naming the key✓
- BenvFrom with a configMapRef
- CvolumeMounts with an emptyDir
- Dargs referencing the Secret name
Correct answer: A — env with valueFrom.secretKeyRef naming the key
secretKeyRef selects one key from a Secret and binds it to a named environment variable. configMapRef injects a ConfigMap rather than a Secret, emptyDir is scratch space, and args cannot dereference a Secret by name.
Kubernetes — Use Secrets as environment variablesWhich object routes external HTTP traffic to different Services based on host and path?
- AIngress with an ingress controller installed✓
- BA ClusterIP Service
- CA NetworkPolicy
- DAn EndpointSlice
Correct answer: A — Ingress with an ingress controller installed
Ingress declares layer 7 routing rules that an ingress controller implements. ClusterIP Services provide internal load balancing without host or path rules, NetworkPolicies filter traffic, and EndpointSlices list backing addresses.
Kubernetes — IngressA blue/green style cutover is needed where two Deployments exist and traffic is switched atomically. Which change performs the switch?
- AUpdate the Service selector to match the new Deployment's Pod labels✓
- BDelete the old Deployment first
- CScale the new Deployment to zero
- DChange the Service type to NodePort
Correct answer: A — Update the Service selector to match the new Deployment's Pod labels
Because a Service routes to whatever Pods its selector matches, changing the selector shifts all traffic in one step and can be reversed just as quickly. Deleting the old Deployment removes the rollback path, scaling the new one to zero serves nothing, and changing the Service type does not choose a backend version.
Kubernetes — Service selectorsTwo containers in the same Pod must share files. Which volume type is the simplest fit when the data need not survive the Pod?
- AemptyDir✓
- BPersistentVolumeClaim
- ChostPath
- DconfigMap
Correct answer: A — emptyDir
emptyDir is created when the Pod is assigned to a node, is shared by all containers in the Pod, and is deleted with the Pod, which matches the requirement exactly. A PVC provides durable storage that is unnecessary here, hostPath couples the Pod to a node, and configMap volumes project configuration data.
Kubernetes — VolumesWhich two statements about multi-container Pods are correct? (Select TWO.)
- AContainers in a Pod share the same network namespace and can reach each other on localhost✓
- BContainers in a Pod can share data through a volume mounted in each of them✓
- CEach container in a Pod gets its own IP address
- DContainers in a Pod are always scheduled to different nodes
- EContainers in a Pod cannot have different images
Correct answer: A, B — Containers in a Pod share the same network namespace and can reach each other on localhost · Containers in a Pod can share data through a volume mounted in each of them
Pod containers share one network namespace and can share volumes, which is what makes sidecar patterns work. The Pod holds a single IP, all its containers run on the same node, and each container specifies its own image.
Kubernetes — PodsWhich Kubernetes extension mechanism defines a new object type that an application-specific controller can act upon?
- ACustomResourceDefinition✓
- BConfigMap
- CServiceAccount
- DEndpoint
Correct answer: A — CustomResourceDefinition
A CRD registers a new resource kind with the API server so custom controllers can watch and reconcile it. ConfigMaps hold data, ServiceAccounts provide workload identity, and Endpoints list Service backends.
Kubernetes — Custom resourcesWhich two are valid ways to make a Pod's application configuration environment specific without rebuilding the image? (Select TWO.)
- AMount a ConfigMap as a volume of configuration files✓
- BInject environment variables from a ConfigMap or Secret✓
- CBake the configuration into the container image per environment
- DUse a different container registry per environment
- EChange the Pod's restartPolicy
Correct answer: A, B — Mount a ConfigMap as a volume of configuration files · Inject environment variables from a ConfigMap or Secret
ConfigMap volumes and injected environment variables both keep configuration outside the image so one artefact runs everywhere. Baking configuration in requires per-environment images, registry choice does not change configuration, and restartPolicy governs restarts.
Kubernetes — Configure a Pod to use a ConfigMapWhich command lists recent cluster events in a namespace, useful for diagnosing scheduling and image problems?
- Akubectl get events --sort-by=.lastTimestamp✓
- Bkubectl get all
- Ckubectl config current-context
- Dkubectl version
Correct answer: A — kubectl get events --sort-by=.lastTimestamp
Events record scheduling decisions, image pull results, and probe failures, and sorting by timestamp puts the newest activity in context. Listing all objects, printing the current context, and showing versions provide no diagnostic detail.
Kubernetes — Debug applicationsWhich approach applies environment-specific differences to a common set of manifests without templating?
- AKustomize bases and overlays✓
- BCopying the manifests per environment and editing them by hand
- CUsing kubectl edit in each cluster
- DSetting different container image tags at build time
Correct answer: A — Kustomize bases and overlays
Kustomize keeps one base and applies patches per overlay, so shared configuration stays in one place. Hand-copied manifests and live kubectl edits both drift, and changing build-time tags does not address environment configuration differences.
Kubernetes — KustomizeWhich resource automatically adjusts a Deployment's replica count based on a target CPU utilisation?
- AHorizontalPodAutoscaler✓
- BPodDisruptionBudget
- CLimitRange
- DPriorityClass
Correct answer: A — HorizontalPodAutoscaler
The HorizontalPodAutoscaler scales replicas up and down toward a metric target such as average CPU utilisation. PodDisruptionBudgets limit voluntary evictions, LimitRanges set default and maximum resources, and PriorityClasses affect preemption.
Kubernetes — Horizontal Pod AutoscalingWhich command shows the revision history of a Deployment so a specific revision can be rolled back to?
- Akubectl rollout history deployment/web✓
- Bkubectl get events
- Ckubectl top pods
- Dkubectl api-resources
Correct answer: A — kubectl rollout history deployment/web
rollout history lists revisions and can show the change cause for each, and undo accepts a revision number. Events show recent activity, top shows resource usage, and api-resources lists available object types.
Kubernetes — Checking rollout historyWhich two statements about Kubernetes Secrets are correct? (Select TWO.)
- ASecret data is base64 encoded in the object, not encrypted by that encoding✓
- BAccess to Secrets should be restricted with RBAC✓
- CSecrets are encrypted at rest in every cluster by default
- DSecrets can only be mounted as files, never as environment variables
- ESecrets are cluster-scoped objects
Correct answer: A, B — Secret data is base64 encoded in the object, not encrypted by that encoding · Access to Secrets should be restricted with RBAC
Base64 is an encoding rather than protection, so RBAC and encryption at rest are what actually protect Secrets. Encryption at rest requires explicit configuration, Secrets can be consumed as files or environment variables, and they are namespaced objects.
Kubernetes — SecretsA batch workload must run 10 Pods, five at a time, until all complete. Which two Job fields should be set? (Select TWO.)
- Acompletions: 10✓
- Bparallelism: 5✓
- Creplicas: 10
- DconcurrencyPolicy: Allow
- Eschedule: '*/5 * * * *'
Correct answer: A, B — completions: 10 · parallelism: 5
completions sets the total successful runs required and parallelism caps how many run simultaneously. replicas belongs to Deployments and ReplicaSets, and concurrencyPolicy and schedule are CronJob fields.
Kubernetes — Parallel JobsFor a HorizontalPodAutoscaler targeting CPU utilisation to work, what must the Pod template define?
- ACPU resource requests on the containers✓
- BA hostPath volume
- CA NodePort Service
- DAn init container
Correct answer: A — CPU resource requests on the containers
Utilisation is computed as a percentage of the request, so without a CPU request the autoscaler cannot calculate a target. Volumes, Service types, and init containers have no bearing on the metric calculation.
Kubernetes — HPA algorithmWhich command reports current CPU and memory usage per Pod, assuming a metrics server is installed?
- Akubectl top pods✓
- Bkubectl get pods -o wide
- Ckubectl describe quota
- Dkubectl explain pod
Correct answer: A — kubectl top pods
kubectl top reads from the metrics API and shows live resource consumption. get with wide output shows node and IP information, describe quota shows namespace limits, and explain documents API fields.
Kubernetes — Resource metrics pipelineWhat is the in-cluster DNS name for a Service named api in the namespace prod?
- Aapi.prod.svc.cluster.local✓
- Bprod.api.cluster.local
- Capi.cluster.local.prod
- Dsvc.api.prod.local
Correct answer: A — api.prod.svc.cluster.local
Kubernetes DNS follows the pattern service.namespace.svc.cluster.local, and within the same namespace the short name api also resolves. The other orderings do not match the cluster DNS schema.
Kubernetes — DNS for Services and PodsWhich two practices reduce a container's privileges in a Pod specification? (Select TWO.)
- ASet readOnlyRootFilesystem to true✓
- BDrop all Linux capabilities and add back only those required✓
- CSet privileged to true so the container can manage itself
- DMount the host root filesystem into the container
- EEnable hostNetwork for simpler networking
Correct answer: A, B — Set readOnlyRootFilesystem to true · Drop all Linux capabilities and add back only those required
A read-only root filesystem and a minimal capability set are two standard hardening measures. Privileged mode, mounting the host filesystem, and host networking all expand what a compromised container can reach.
Kubernetes — Security contextA container image should not ship compilers or package managers into production. Which build technique achieves this?
- AA multi-stage build that copies only the compiled artefact into a minimal final image✓
- BInstalling all build tools in the final stage for convenience
- CUsing a full distribution base image with development packages
- DRunning the build inside the container at start-up
Correct answer: A — A multi-stage build that copies only the compiled artefact into a minimal final image
Multi-stage builds keep the toolchain in an earlier stage and copy only the finished artefact into a small runtime image, cutting both size and attack surface. The other options all leave build tooling in the shipped image or move the build to run time.
Kubernetes — ImagesWhich probe should be used for a container that takes up to three minutes to initialise, so that the liveness probe does not kill it during start-up?
- AA startup probe with a generous failureThreshold✓
- BA readiness probe with a short period
- CA liveness probe with no initial delay
- DNo probe at all
Correct answer: A — A startup probe with a generous failureThreshold
The startup probe defers liveness and readiness checks until the application has started, which protects slow-starting containers from being restarted. A readiness probe does not prevent liveness restarts, an immediate liveness probe is the problem, and removing probes gives up health checking entirely.
Kubernetes — Startup probesWhich kubectl flag lets you generate a manifest from an imperative command without creating the object, so it can be saved and edited?
- A--dry-run=client -o yaml✓
- B--force
- C--cascade=orphan
- D--watch
Correct answer: A — --dry-run=client -o yaml
Client-side dry run with YAML output prints the object definition without sending a create request, which is the fastest way to scaffold a manifest. force deletes and recreates, cascade orphan leaves dependents behind, and watch streams changes.
Kubernetes — kubectl usage conventionsA Deployment rollout has introduced a bug. Which command returns it to the previous revision?
- Akubectl rollout undo deployment/web✓
- Bkubectl rollout pause deployment/web
- Ckubectl rollout restart deployment/web
- Dkubectl rollout status deployment/web
Correct answer: A — kubectl rollout undo deployment/web
rollout undo reverts to the previous ReplicaSet revision, which is why revision history is retained. Pause halts an in-flight rollout, restart recreates Pods with the same spec, and status reports progress.
Kubernetes — Rolling back a DeploymentWhich command creates a ConfigMap from a local properties file?
- Akubectl create configmap app-config --from-file=app.properties✓
- Bkubectl create secret generic app-config --from-file=app.properties
- Ckubectl apply -f app.properties
- Dkubectl label configmap app-config file=app.properties
Correct answer: A — kubectl create configmap app-config --from-file=app.properties
create configmap with from-file builds a ConfigMap whose key is the file name and whose value is its contents. The secret variant creates a different object type, applying a properties file directly is not valid Kubernetes YAML, and labelling only adds metadata.
Kubernetes — Configure a Pod to use a ConfigMapWhich two fields must align for a Service to forward traffic correctly to a container? (Select TWO.)
- AThe Service selector and the Pod template labels✓
- BThe Service targetPort and the container's listening port✓
- CThe Service name and the Deployment name
- DThe namespace label and the node name
- EThe image tag and the Service port
Correct answer: A, B — The Service selector and the Pod template labels · The Service targetPort and the container's listening port
The selector determines which Pods back the Service and targetPort must match where the container actually listens. Service and Deployment names need not match, and node names and image tags play no part in routing.
Kubernetes — ServiceWhich admission control mechanism enforces Pod security standards such as baseline or restricted at the namespace level?
- APod Security Admission configured with namespace labels✓
- BA NetworkPolicy in the namespace
- CA LimitRange
- DA node taint
Correct answer: A — Pod Security Admission configured with namespace labels
Pod Security Admission applies the privileged, baseline, or restricted profile based on labels applied to the namespace, in enforce, audit, or warn mode. NetworkPolicies govern traffic, LimitRanges govern resources, and taints influence scheduling.
Kubernetes — Pod Security AdmissionA Pod must wait until a database is reachable before its application container starts. Which construct should be used?
- AAn init container that blocks until the dependency responds✓
- BA liveness probe on the application container
- CA PodDisruptionBudget
- DA node selector
Correct answer: A — An init container that blocks until the dependency responds
Init containers run to completion in order before app containers start, so a blocking check is the standard way to express a startup dependency. A liveness probe restarts a container that is already running, a disruption budget limits evictions, and a node selector constrains placement.
Kubernetes — Init containersWhich two conditions will cause a Deployment rollout to be reported as failed? (Select TWO.)
- ANew Pods never become ready before progressDeadlineSeconds elapses✓
- BThe new image cannot be pulled, so replicas never reach the desired state✓
- CThe Deployment has more than three revisions in history
- DThe Service uses type ClusterIP
- EThe namespace has a label applied
Correct answer: A, B — New Pods never become ready before progressDeadlineSeconds elapses · The new image cannot be pulled, so replicas never reach the desired state
A rollout stalls when new Pods cannot become ready in time, whether because the application fails readiness checks or the image cannot be pulled. Revision count, Service type, and namespace labels do not affect rollout success.
Kubernetes — Failed deploymentAn application container must run a shutdown script when the Pod is terminated, before the process is killed. Which mechanism provides this?
- AA preStop lifecycle hook✓
- BA postStart lifecycle hook
- CA readiness probe
- DAn init container
Correct answer: A — A preStop lifecycle hook
The preStop hook runs before the container receives its termination signal, which is where graceful drain logic belongs. postStart runs at container start, readiness probes gate traffic, and init containers run before the application starts.
Kubernetes — Container lifecycle hooksWhich two design practices make a containerised application easier to run on Kubernetes? (Select TWO.)
- AWrite logs to stdout and stderr rather than to files inside the container✓
- BRead configuration from environment variables or mounted files rather than baking it into the image✓
- CStore session state on the container's local filesystem
- DRequire a fixed hostname for each replica
- EAssume the container will never be restarted
Correct answer: A, B — Write logs to stdout and stderr rather than to files inside the container · Read configuration from environment variables or mounted files rather than baking it into the image
Logging to standard streams lets the platform collect output, and externalised configuration lets the same image run in every environment. Local session state, fixed hostnames, and assuming no restarts all fight the way Kubernetes schedules and replaces Pods.
Kubernetes — Logging architectureA Pod must run a helper container that ships logs alongside the main application container for the Pod's lifetime. Which pattern is this?
- ASidecar✓
- BInit container
- CAmbassador only
- DAdapter only
Correct answer: A — Sidecar
A sidecar runs alongside the application container for the whole Pod lifetime, sharing volumes and the network namespace, which is exactly how log shippers are deployed. Init containers run to completion before the app starts, and ambassador and adapter are more specific sidecar variants for proxying and reformatting.
Kubernetes — Sidecar containersWhich field in a Job specification controls how many Pods must complete successfully before the Job is considered finished?
- Aspec.completions✓
- Bspec.parallelism
- Cspec.backoffLimit
- Dspec.activeDeadlineSeconds
Correct answer: A — spec.completions
completions sets the number of successful Pod completions required. parallelism controls how many run at once, backoffLimit caps retries, and activeDeadlineSeconds bounds total runtime.
Kubernetes — JobsTwo Pods in different namespaces must communicate. What is required by default in a cluster with no NetworkPolicies?
- ANothing extra, because all Pods can reach all other Pods by default✓
- BA VPN between the namespaces
- CA NodePort Service in each namespace
- DA shared PersistentVolumeClaim
Correct answer: A — Nothing extra, because all Pods can reach all other Pods by default
The Kubernetes network model gives every Pod a routable address and allows all Pod-to-Pod traffic unless a NetworkPolicy restricts it, regardless of namespace. Namespaces are not a network boundary by themselves, and VPNs, node ports, and shared storage are irrelevant here.
Kubernetes — Cluster networkingA NetworkPolicy is created selecting a set of Pods with an empty ingress rule list. What is the effect?
- AAll ingress traffic to those Pods is denied✓
- BAll ingress traffic to those Pods is allowed
- CThe policy has no effect
- DEgress traffic from those Pods is denied
Correct answer: A — All ingress traffic to those Pods is denied
Once a Pod is selected by any NetworkPolicy with an ingress section, only traffic explicitly allowed by a rule is permitted, so an empty rule list denies everything inbound. Egress is unaffected unless the policy also declares an egress type.
Kubernetes — Network policiesA Pod must consume every key in a ConfigMap as environment variables. Which field should be used?
- AenvFrom with a configMapRef✓
- BvolumeMounts with a hostPath
- Cargs on the container
- DnodeSelector
Correct answer: A — envFrom with a configMapRef
envFrom with a configMapRef injects all keys as environment variables without listing each one. hostPath mounts a node directory, args set command arguments, and nodeSelector constrains scheduling.
Kubernetes — ConfigMap as environment variablesWhich two are true about a headless Service, defined with clusterIP set to None? (Select TWO.)
- ADNS returns the individual Pod addresses rather than a single virtual IP✓
- BIt is commonly used with StatefulSets for stable per-Pod DNS names✓
- CIt provides layer 7 routing rules
- DIt allocates a NodePort automatically
- EIt requires a cloud load balancer
Correct answer: A, B — DNS returns the individual Pod addresses rather than a single virtual IP · It is commonly used with StatefulSets for stable per-Pod DNS names
A headless Service skips the virtual IP so DNS resolves to Pod addresses, which is what gives StatefulSet members individually addressable names. Layer 7 routing belongs to Ingress, and no node port or cloud load balancer is involved.
Kubernetes — Headless ServicesAn Ingress must terminate TLS for a hostname. Where is the certificate supplied from?
- AA Secret of type kubernetes.io/tls referenced in the Ingress spec.tls section✓
- BA ConfigMap containing the certificate
- CAn annotation containing the PEM text
- DThe container image
Correct answer: A — A Secret of type kubernetes.io/tls referenced in the Ingress spec.tls section
TLS Secrets hold the certificate and key and are referenced by host in the Ingress tls section. ConfigMaps are for non-sensitive data, annotations are not a certificate store, and baking certificates into images makes rotation impossible.
Kubernetes — Ingress TLSWhich object sets default and maximum CPU and memory values for containers created in a namespace?
- ALimitRange✓
- BResourceQuota
- CPriorityClass
- DPodDisruptionBudget
Correct answer: A — LimitRange
A LimitRange applies default requests and limits and enforces minimum and maximum values per container or Pod. A ResourceQuota caps namespace-wide totals, PriorityClasses affect preemption, and disruption budgets limit evictions.
Kubernetes — Limit rangesA canary release requires a small share of traffic to hit the new version using only core Kubernetes objects. Which approach works?
- ARun a second Deployment with fewer replicas whose Pods carry the same Service selector labels✓
- BCreate a second Service with a different name and no clients
- CSet maxSurge to 100% on the existing Deployment
- DAdd a taint to half the nodes
Correct answer: A — Run a second Deployment with fewer replicas whose Pods carry the same Service selector labels
With both Deployments' Pods matching one Service selector, traffic is split roughly in proportion to replica counts, which is the basic canary without a mesh. A second unused Service receives no traffic, maxSurge only affects rollout speed, and taints influence placement rather than traffic share.
Kubernetes — Canary deploymentsWhich command performs a rolling update of a Deployment to a new container image?
- Akubectl set image deployment/web web=myapp:2.0✓
- Bkubectl scale deployment/web --replicas=0
- Ckubectl delete deployment/web
- Dkubectl cordon node1
Correct answer: A — kubectl set image deployment/web web=myapp:2.0
kubectl set image updates the Pod template, which triggers the Deployment's rolling update strategy. Scaling to zero causes an outage, deleting removes the workload, and cordoning marks a node unschedulable.
Kubernetes — Updating a DeploymentWhich object grants a Pod's service account permission to list ConfigMaps within a single namespace?
- AA Role plus a RoleBinding referencing the service account✓
- BA ClusterRoleBinding to cluster-admin
- CA NetworkPolicy
- DA ResourceQuota
Correct answer: A — A Role plus a RoleBinding referencing the service account
A namespaced Role defines the permitted verbs and resources and a RoleBinding grants it to the service account. Binding cluster-admin grants far more than required, NetworkPolicies control traffic, and quotas cap resource consumption.
Kubernetes — RBACWhich field extends the time Kubernetes waits for a container to exit gracefully before sending SIGKILL?
- Aspec.terminationGracePeriodSeconds✓
- Bspec.activeDeadlineSeconds
- Cspec.restartPolicy
- Dspec.dnsPolicy
Correct answer: A — spec.terminationGracePeriodSeconds
terminationGracePeriodSeconds sets how long the kubelet waits after SIGTERM before forcing termination. activeDeadlineSeconds bounds total Pod runtime, restartPolicy governs restarts, and dnsPolicy controls name resolution.
Kubernetes — Pod terminationWhich Service type maps a Service name to an external DNS name using a CNAME record, with no proxying?
- AExternalName✓
- BLoadBalancer
- CNodePort
- DClusterIP
Correct answer: A — ExternalName
An ExternalName Service returns a CNAME to the configured external hostname and does not proxy traffic or allocate an IP. LoadBalancer and NodePort publish the Service externally, and ClusterIP provides an internal virtual IP.
Kubernetes — ExternalName ServiceA Service has no endpoints even though matching Pods are running. What should be checked first?
- AWhether the Service selector matches the Pod labels and the Pods are passing readiness✓
- BWhether the node has a public IP
- CWhether the container image is signed
- DWhether the namespace has a ResourceQuota
Correct answer: A — Whether the Service selector matches the Pod labels and the Pods are passing readiness
Endpoints are populated from Pods whose labels match the selector and that are ready, so a mismatch or failing readiness probe explains an empty endpoint list. Node addressing, image signing, and quotas do not affect endpoint population.
Kubernetes — Debug ServicesA container is restarting repeatedly. Which command shows the logs from the previous, crashed instance?
- Akubectl logs <pod> --previous✓
- Bkubectl logs <pod> --follow
- Ckubectl describe node <node>
- Dkubectl get pod <pod> -o yaml
Correct answer: A — kubectl logs <pod> --previous
The previous flag retrieves the log output of the container instance that terminated, which is where the crash reason usually is. Following tails the current instance, describing a node shows node conditions, and the YAML output shows spec and status without log content.
Kubernetes — Debug running PodsWhich two Deployment strategy fields tune how many Pods may be unavailable or created above the desired count during a rolling update? (Select TWO.)
- AmaxUnavailable✓
- BmaxSurge✓
- CrevisionHistoryLimit
- DprogressDeadlineSeconds
- EminReadySeconds
Correct answer: A, B — maxUnavailable · maxSurge
maxUnavailable and maxSurge together define the rolling update window. revisionHistoryLimit controls how many old ReplicaSets are kept, progressDeadlineSeconds decides when a rollout is declared stalled, and minReadySeconds sets how long a Pod must be ready before counting as available.
Kubernetes — Rolling update strategyReady to try it under exam conditions?
Reading answers is not the same as recalling them with a clock running. Take the same 60 questions as a timed mock exam — 120 minutes, no feedback until you submit, then a score broken down by exam domain so you know what to study.
Start the timed CKAD test →