CKA Free Quiz
No account or credit card needed — your score shows right here.On a kubeadm cluster, etcd runs as a static Pod whose `etcd-data` hostPath volume points to /var/lib/etcd. You stopped all API server instances. Then you ran `etcdutl --data-dir /var/lib/etcd-restore snapshot restore snapshot.db`, and it succeeded. etcd still serves the old data. What must you do next so etcd uses the restored data?
Correct Answer
Restoring a snapshot is like unpacking a backup into a new folder. The program keeps opening its old folder until you change its settings and restart it.
A restore to a new data directory only takes effect after etcd's configuration points to it and etcd restarts.
- The restore wrote data to a new folder, /var/lib/etcd-restore.
- The etcd static Pod still mounts /var/lib/etcd through the
etcd-datahostPath volume. - The docs say to change that
volumes.hostPath.pathin/etc/kubernetes/manifests/etcd.yaml. - Then delete the etcd Pod or restart kubelet (or both) so etcd starts on the new directory.
- B
--etcd-serverstakes etcd client URLs, not a data directory path.- It only needs changing if the restored cluster's access URLs changed.
- C
etcdctl snapshot savecreates a backup from a live member.- It does not load restored data into etcd.
- D
- Restoring into the same folder requires deleting it and stopping etcd first.
- Restoring while etcd keeps running breaks that rule.
- Assuming a successful
snapshot restoreis live immediately; it only writes a data directory that etcd must be configured to use.
- With
etcdutl,<data-dir-location>is a directory created during the restore process. - Using
etcdctlfor restore is deprecated since etcd v3.5.x and slated for removal in v3.6. - Before restoring, stop all API server instances, restore all etcd instances, then restart the API servers.
- The project also recommends restarting kube-scheduler, kube-controller-manager and kubelet to avoid stale data.
- If the restored cluster's access URLs change, restart API servers with
--etcd-servers=$NEW_ETCD_CLUSTER.
Answered
0/10
Correct
0
Score
0%
An admin wants to upgrade a kubeadm cluster from 1.36.x to 1.37.x. They SSH into worker node `node1`, which has no `/etc/kubernetes/admin.conf` file. They install kubeadm 1.37.x and run `sudo kubeadm upgrade plan`, but the command fails. What should the admin do to check which versions are available and whether the cluster is upgradeable?
Correct Answer
Only the building manager holding the master key can inspect every floor and plan renovations. A tenant with a new toolbox still cannot do that survey from their own apartment.
kubeadm upgrade plan runs only on control plane nodes where admin.conf exists.
kubeadm upgrade planchecks available versions and validates that the cluster is upgradeable.- It can only run on control plane nodes where the kubeconfig file
admin.confexists. - node1 is a worker without
admin.conf, so the plan must run on a control plane node instead.
- A
- Draining only marks a node unschedulable and evicts workloads.
- It does not create
admin.conf, so plan still cannot run on node1.
- B
--allow-experimental-upgradesonly shows alpha/beta/release candidate versions.- It does not remove the requirement for
admin.confon a control plane node.
- C
- The documented workflow upgrades kubeadm before running
kubeadm upgrade plan. - The kubeadm version on node1 is not the problem; the missing
admin.confis.
- The documented workflow upgrades kubeadm before running
- Assuming kubeadm upgrade plan can run on any node that has the new kubeadm binary installed.
- The upgrade order is primary control plane, then additional control plane nodes, then workers.
- The first control plane node used for the upgrade must have
/etc/kubernetes/admin.conf. - Additional control plane nodes use
kubeadm upgrade nodeand do not needkubeadm upgrade plan. - Skipping MINOR versions when upgrading is unsupported.
- The
--kubeconfigflag for plan defaults to/etc/kubernetes/admin.conf.
Answered
0/10
Correct
0
Score
0%
An admin creates a ClusterRole named secret-reader that allows get, watch and list on secrets, with no resourceNames. The admin then creates a RoleBinding named read-secrets in the development namespace. Its roleRef is kind ClusterRole, name secret-reader, and its only subject is user dave. No other bindings grant dave any permissions. What happens when dave runs a get on a Secret in the production namespace?
Correct Answer
A master key template (ClusterRole) is useless until someone cuts a key for a door. A RoleBinding cuts a key for one room; a ClusterRoleBinding cuts a key for the whole building.
The binding type sets the scope: a RoleBinding grants a ClusterRole's rules only in the RoleBinding's own namespace.
- The RoleBinding lives in the development namespace.
- A RoleBinding that references a ClusterRole binds it to the RoleBinding's namespace only.
- No binding grants dave access in production, so the request is denied there.
- A
- A ClusterRole spans all namespaces only when granted through a ClusterRoleBinding.
- Here it is granted through a RoleBinding, so its reach is limited to development.
- C
- A RoleBinding can reference a ClusterRole as well as a Role in the same namespace.
- The binding is valid; it just scopes the ClusterRole to development.
- D
- An empty resourceNames set means every resource name is allowed.
- Namespace scope blocks dave in production for get and list alike.
- Assuming "ClusterRole" means cluster-wide access. The binding kind, not the role kind, sets the namespace scope.
- To bind a ClusterRole to all namespaces, use a ClusterRoleBinding.
- RBAC permissions are purely additive; there are no deny rules.
- After a binding is created, its roleRef cannot be changed; delete and recreate it instead.
- Cluster-scoped resources such as nodes need a ClusterRole bound with a ClusterRoleBinding to be effective.
- The built-in admin, edit and view ClusterRoles are meant to be granted within a namespace using a RoleBinding.
Answered
0/10
Correct
0
Score
0%
A team runs a Kubernetes cluster on bare-metal servers. The cluster has no cloud provider integration and no load balancer implementation installed. QA testers on the office network must reach a web Deployment over TCP by connecting to the servers' IP addresses. No Ingress or Gateway is available. Which Service type meets this requirement?
Correct Answer
NodePort is like opening the same numbered door on every building. Visitors can walk into any building through that door and get sent to the right office.
Use NodePort to reach a Service from outside the cluster through node IPs when no external load balancer exists.
- NodePort exposes the Service on each node's IP at a static port.
- Clients outside the cluster connect to any node at the assigned port.
- It needs no cloud provider or external load balancer, which suits this bare-metal cluster.
- A
- ClusterIP makes the Service only reachable from within the cluster.
- External access would need an Ingress or Gateway, which the scenario rules out.
- B
- Kubernetes does not directly offer a load balancing component; you must provide one or integrate a cloud provider.
- This cluster has neither, so no external load balancer is provisioned.
- D
- ExternalName only makes cluster DNS (Domain Name System) return a CNAME to an external hostname.
- No proxying is set up, so it cannot carry testers' traffic to the Pods.
- Assuming LoadBalancer works everywhere; it needs a provided implementation or cloud provider integration.
- The default node port range is 30000-32767, set by
--service-node-port-range. - A NodePort Service also gets a cluster IP, as if
type: ClusterIPwere requested. - You can request a specific port in the
nodePortfield; the request fails if it is unavailable. - LoadBalancer typically builds on NodePort; the cloud-controller-manager forwards traffic to the node port.
- ClusterIP is the default type when
typeis not specified.
Answered
0/10
Correct
0
Score
0%
A cluster uses a CNI plugin that enforces NetworkPolicy. In namespace `payments`, the only policy selects `app=api` pods with `policyTypes: [Ingress]`. Its single ingress rule has a `from` array with two separate elements: `- namespaceSelector: {matchLabels: {user: alice}}` and `- podSelector: {matchLabels: {role: client}}`. The `payments` namespace is not labeled `user=alice`. No egress policies exist anywhere. Which client can connect to the `app=api` pods?
Correct Answer
Two separate guest lists mean you get in if you are on either list. One list with two requirements means you must meet both.
Separate entries in a from array are ORed; both selectors inside one entry are ANDed.
- The from array has two elements, so either one alone admits traffic.
- The namespaceSelector element allows any Pod in any namespace labeled user=alice.
- The client pod's labels do not matter under that element.
- With no egress policies, the client is non-isolated for egress, so its side allows the connection.
- A
- This is the AND meaning, which needs both selectors in a single from entry.
- Here they are two separate entries, so they combine as OR.
- C
- A podSelector selects Pods in the same namespace as the NetworkPolicy.
- A role=client pod outside payments matches neither element.
- D
- A namespaceSelector selects namespaces whose Pods are allowed as ingress sources.
- So pods in user=alice namespaces outside payments are admitted.
- Reading two list items as one combined selector; a single YAML dash changes AND into OR.
- A single from entry with both namespaceSelector and podSelector selects particular Pods within particular namespaces.
- Use kubectl describe to see how Kubernetes interpreted the policy.
- A pod is non-isolated for egress by default; all outbound connections are allowed.
- A connection needs both the source egress and destination ingress policies to allow it.
- Network policies are additive; allowed traffic is the union of applicable policies.
Answered
0/10
Correct
0
Score
0%
A cluster has the DefaultStorageClass admission plugin enabled. StorageClass `standard` is marked as the default. An administrator creates a static 10Gi ReadWriteOnce PersistentVolume with no `storageClassName` and the label `app: reports`. A developer must create a 10Gi ReadWriteOnce PVC that binds to this PV and must not trigger dynamic provisioning. How should the developer set the PVC's class?
Correct Answer
Leaving the class blank on a form gets you the standard option filled in for you. Writing "none" explicitly gets you the unlabeled item on the shelf.
A PVC with storageClassName: "" binds only to PVs with no class, while an unset field picks up the default class.
- The PV has no class, so only a claim requesting no class can bind to it.
storageClassName: ""is always read as "request a PV with no class".- Claims that request the class
""disable dynamic provisioning for themselves.
- A
- A PV of a class binds only to PVCs requesting that class, and the reverse holds too.
- This PV has no class, so a claim for
standardcannot bind to it.
- C
- With the plugin on and a default set, a PVC with no
storageClassNamebinds only to PVs of the default class. - Selector and class are ANDed, so the classless PV still fails the class requirement.
- With the plugin on and a default set, a PVC with no
- D
- An unset
storageClassNamereceives the default classstandard. - The claim then cannot match the classless PV and may be dynamically provisioned instead.
- An unset
- Treating an omitted
storageClassNameas equal to""; omitted means "use the default class", empty means "no class".
- A default StorageClass is set with the annotation
storageclass.kubernetes.io/is-default-class: "true". - If more than one default exists, the newest default is used for dynamic provisioning.
- When a default appears later, PVCs without
storageClassNameare updated to it; PVCs set to""are not. - A PVC with a non-empty
selectorcannot have a PV dynamically provisioned for it. - With a selector and a class, both requirements are ANDed for binding.
Answered
0/10
Correct
0
Score
0%
An admin sees kube-worker-1 as NotReady. `kubectl describe node kube-worker-1` shows `Unschedulable: false` and the taints `node.kubernetes.io/unreachable:NoExecute` and `node.kubernetes.io/unreachable:NoSchedule`. Ready, MemoryPressure, DiskPressure and PIDPressure all have status `Unknown`, with reason `NodeStatusUnknown` and message "Kubelet stopped posting node status." Assume default kube-controller-manager settings. Which conclusion is best supported?
Correct Answer
It is like a coworker who stops answering messages. You do not know they are sick; you only know you cannot reach them, so you mark them "status unknown."
When a node becomes unreachable, the node controller sets its Ready condition to Unknown.
- Every condition is Unknown with "Kubelet stopped posting node status", so the node has stopped reporting.
- The node controller sets Ready to Unknown when a node becomes unreachable.
- The unreachable taints match this: the node controller adds taints for node problems like node unreachable.
- B
- The output shows
Unschedulable: false, so the node is not cordoned. - Cordoning only stops new Pods from being scheduled. It does not set Ready to Unknown.
- The output shows
- C
- MemoryPressure shows Unknown, not a reported pressure state.
- The message says the kubelet stopped posting status, so it is not reporting anything.
- D
- By default, the node controller waits 5 minutes after marking the node Unknown before the first eviction request.
- Eviction is not immediate.
- Treating Unknown as a resource-pressure report. It actually means the kubelet stopped posting status and the node is unreachable.
- By default, the node controller checks each node's state every 5 seconds (
--node-monitor-period). - Nodes send two heartbeats:
.statusupdates and a Lease object in thekube-node-leasenamespace. - The node controller adds taints for unreachable or not-ready nodes, so the scheduler will not place Pods there.
- On worker nodes, kubelet logs are in
/var/log/kubelet.log; on systemd systems you may needjournalctl.
Answered
0/10
Correct
0
Score
0%
A Pod's container keeps crashing and restarting. The app exits with an error but never writes to /dev/termination-log. Its crash details go only to stdout logs. The container uses the default termination message settings. You will recreate the Pod from an edited manifest. You want lastState.terminated.message in the Pod status to show why it crashed. What should you change?
Correct Answer
If the crash report form is left blank, FallbackToLogsOnError tells the clerk to copy the last few lines of the diary instead. Only the last few lines are copied, not the whole diary.
FallbackToLogsOnError uses the last chunk of log output when the termination file is empty and the container exited with an error.
- The termination file is empty, so the default File policy surfaces nothing.
- The app exits with an error, which meets the fallback condition.
- FallbackToLogsOnError then fills the message from the last chunk of container log output.
- A
- The default File policy retrieves messages only from the termination message file.
- It never falls back to logs.
- B
- You cannot set the termination message path after a Pod is launched.
- Changing the path also does not make Kubernetes read logs.
- D
- The fallback does not store the complete log.
- Log output is limited to 2048 bytes or 80 lines, whichever is smaller.
- Assuming the default File policy falls back to logs, or that the fallback copies the whole log.
- The default terminationMessagePath is /dev/termination-log.
- The kubelet truncates termination messages longer than 4096 bytes.
- Total termination message length across all containers is limited to 12KiB, divided equally among containers.
- kubectl describe pods shows container state and recent restarts.
- A Go template on .status.containerStatuses can print each container's lastState.terminated.message.
Answered
0/10
Correct
0
Score
0%
Three kube-apiserver instances sit behind a load balancer. On one instance, `/livez` returns 200. `/readyz` returns a failure status code because it is waiting for etcd to become available. The other two instances return 200 on both endpoints. What should the load balancer do with the failing instance?
Correct Answer
A cashier who is still counting the float is alive but not open yet. You send customers to another till; you don't send the cashier home.
A failing /readyz means route traffic away; a failing /livez means restart.
/readyzreports whether the API server can accept traffic.- A readiness failure while waiting for etcd means it is initializing or temporarily unable to serve.
- The docs say traffic should be routed away from it.
/livezreturns 200, so nothing signals that a restart is needed.
- B
/healthzhas been deprecated since Kubernetes v1.16.- The docs say to use the more specific
livezandreadyzendpoints instead.
- C
- A restart is indicated when
/livezfails, which points to a non-recoverable state such as a deadlock. - Here
/livezreturns 200.
- A restart is indicated when
- D
- Verbose output is meant for human operators and is not intended for machines.
- Machines should rely on the HTTP (Hypertext Transfer Protocol) status code.
- Treating any health-check failure as a reason to restart. Only a
/livezfailure calls for a restart; a/readyzfailure calls for rerouting traffic.
- The API server exposes
healthz,livezandreadyz;healthzis deprecated since v1.16. - A status code of 200 means healthy, live or ready, depending on the endpoint called.
--livez-grace-periodsets the startup duration forlivez.--shutdown-delay-durationwith/readyzsupports a graceful shutdown.exclude=etcdcan skip a check, for examplereadyz?verbose&exclude=etcd.
Answered
0/10
Correct
0
Score
0%
A Deployment `web` runs 3 replicas of `nginx:1.16.1` at revision 1. An engineer runs `kubectl set image deployment/web nginx=nginx:1.161`, a typo. `kubectl rollout status` shows the rollout stuck, with one new Pod in ImagePullBackOff. To add capacity, a teammate then runs `kubectl scale deployment/web --replicas=6`. The rollout is not paused. Finally, the engineer runs `kubectl rollout undo deployment/web`. What is the resulting state?
Correct Answer
Undo restores an earlier version of the recipe, not the number of cooks. If you added more cooks, they stay.
A rollback restores only the Deployment's Pod template (.spec.template), not its replica count.
- Only changes to
.spec.template, such as the image, create a revision. - The typo image created the revision that
rollout undoreverts, so the image returns to nginx:1.16.1. - Scaling creates no revision and is outside the Pod template, so replicas stay at 6.
- A
- A rollback does not restore the whole spec. Only the Pod template is rolled back, so the replica count of 6 is kept.
- B
- Scaling does not create a Deployment revision. No newer revision blocks the undo, and the Deployment is not paused.
- C
- Undo moves to the previous revision, not the last command. Scaling is not a revision, so the bad image is what gets reverted.
- Assuming undo reverts the whole Deployment spec, or the last command run. It only reverts the Pod template revision.
- A rollout and a new revision are triggered only when
.spec.templatechanges. kubectl rollout undo --to-revision=Nrolls back to a specific revision..spec.revisionHistoryLimitdefaults to 10. Setting it to 0 removes the ability to roll back.- You cannot roll back a paused Deployment until you resume it.
kubectl rollout statusreturns a non-zero exit code if the progress deadline is exceeded.
Answered
0/10
Correct
0
Score
0%
You got of 10 correct.
Get your full breakdown by email
Per-question review, weak spots to study, and explanations.
The full CKA question bank with complete explanations is part of the Exam Pass.