Home / Certified Kubernetes Administrator (CKA) / Mock exam
Certified Kubernetes Administrator (CKA) Exam-style mock test

Certified Kubernetes Administrator (CKA)|Practice test

Full explanations Exam format Pass line 70%
33 USD One-time · lifetime access
Enroll →

Sample questions

Example1 · Cluster Architecture, Installation and Configuration
A global bank runs a nightly reconciliation CronJob in the settlement namespace under the ServiceAccount recon-sa. Security sign-off requires that the job can read ConfigMaps in settlement and nothing else. Which RBAC setup satisfies this least-privilege requirement?
・Create a cluster-wide ClusterRole granting get and list on configmaps, then bind it to recon-sa.
Incorrect. A ClusterRoleBinding applies the rules in every namespace, so recon-sa could read ConfigMaps cluster-wide, exceeding the approved scope.
・Create a Role granting the verb * on configmaps in settlement and bind it to recon-sa with a RoleBinding there.
Incorrect. The wildcard verb * also allows create, update, patch and delete on ConfigMaps, which goes beyond the read-only requirement.
・Add recon-sa as a subject of the built-in cluster-admin ClusterRoleBinding so the job never hits a permission error.
Incorrect. cluster-admin grants unrestricted access to every resource in the cluster, the opposite of least privilege for a batch workload.
✓Create a Role in settlement granting get and list on configmaps, plus a RoleBinding to recon-sa.
Correct. A namespaced Role with only get and list on configmaps, bound by a RoleBinding in settlement, grants exactly the required access and nothing more.
Explanation
Least privilege means scoping both the verbs and the namespace. A Role limited to get and list on configmaps in settlement, bound with a RoleBinding to the ServiceAccount, is the minimal grant; ClusterRole/ClusterRoleBinding or wildcard verbs widen the blast radius unnecessarily.
Example2 · Workloads and Scheduling
Meridian Capital Bank runs its payment-gateway Deployment with 4 replicas. Compliance mandates that the full serving capacity of 4 ready pods is preserved at every moment while a new image version rolls out. Which strategy configuration satisfies this requirement?
✓rollingUpdate with maxSurge: 1 and maxUnavailable: 0 under type: RollingUpdate, so an extra pod comes up ready before any old one is removed.
Correct. maxUnavailable: 0 forbids removing any old pod until a surge pod is ready, so 4 ready replicas exist throughout the rollout.
・rollingUpdate with maxSurge: 0 and maxUnavailable: 1 under type: RollingUpdate, removing an old pod before its replacement is ready.
Incorrect. maxUnavailable: 1 lets the controller remove an old pod before its replacement is ready, dropping capacity to 3.
・strategy type: Recreate so every replica is terminated and then restarted together on the new image at once.
Incorrect. Recreate terminates every pod before new ones start, causing a complete outage of the gateway.
・rollingUpdate with maxSurge: 0 and maxUnavailable: 25% under type: RollingUpdate, progressing by deleting an old pod first.
Incorrect. 25% of 4 replicas rounds to 1 unavailable pod, and with maxSurge: 0 the rollout can only progress by deleting an old pod first.
Explanation
Setting maxUnavailable: 0 means the Deployment controller never terminates an old pod until an extra surge pod has become ready, so ready capacity never dips below the declared replica count. maxSurge must be at least 1 so the rollout can still make progress by creating replacements first.
Example3 · Services and Networking
At LedgerBank, a global financial services firm, the risk-engine Service in namespace trading has a ClusterIP and its DNS name resolves, but client connections time out. kubectl get endpointslices -n trading shows the slice for the Service lists no endpoints at all, while the pods are Running and Ready with label app=risk-engine. The Service spec uses selector app: riskengine. What should the administrator do?
・Change the Service to type: NodePort so kube-proxy programs forwarding rules on every node
Incorrect. The Service type only changes how it is exposed; a NodePort still forwards to the same empty endpoint set, so connections keep failing.
・Set the Service targetPort to the container port, because a port mismatch removes every endpoint from the slice
Incorrect. A wrong targetPort causes connections to fail at the pod, but the endpoints controller still lists the pod IPs; it does not produce an empty EndpointSlice.
✓Patch the Service selector to app: risk-engine so it matches the labels on the running pods, letting the endpoints controller populate the slice
Correct. An EndpointSlice with zero endpoints while matching-looking pods are Ready points to a selector/label mismatch; aligning the selector with app=risk-engine lets the endpoints controller populate the slice.
・Restart the kube-proxy pods to force a resync of the iptables rules on each node
Incorrect. kube-proxy only consumes EndpointSlice data; restarting it cannot create endpoints that the endpoints controller never generated.
Explanation
A Service with ready pods but zero endpoints almost always indicates that the Service selector does not match the pod labels. Here app: riskengine does not match app=risk-engine, so the endpoints controller publishes an empty EndpointSlice and kube-proxy has nothing to forward to. Port mismatches and proxy restarts do not explain an empty endpoint list.
Example4 · Storage
StreamForge, a media streaming platform, creates a PVC named thumbs-cache against the StorageClass ssd-wffc, which sets volumeBindingMode: WaitForFirstConsumer. Ten minutes later the PVC is still Pending, and kubectl describe pvc thumbs-cache shows the event "waiting for first consumer to be created before binding". No Pod references the claim yet. What is the correct reading of this state?
・The CSI external-provisioner sidecar is offline, and restarting its controller Deployment will immediately resume the provisioning loop.
Incorrect. A dead provisioner would surface provisioning errors or silence, not the specific "waiting for first consumer" event, which is emitted by design for WaitForFirstConsumer classes.
・NetworkPolicy from entries can only match on namespaces; filtering by pod label needs named ports in a section
Incorrect. No scheduling decision has happened because no Pod consumes the claim; capacity-versus-node evaluation only occurs once a consumer Pod is being scheduled.
✓The two selectors are separate list items, so the rule admits either match independently; both must instead be nested inside one from element
Correct. WaitForFirstConsumer intentionally delays both binding and dynamic provisioning until a Pod that uses the PVC is scheduled, so the volume can be created in the topology (zone/node) chosen by the scheduler. Creating the consuming Pod resolves the Pending state.
・A podSelector in a from clause is silently ignored whenever a namespaceSelector appears anywhere in the ingress rule
Incorrect. allowVolumeExpansion only governs resizing of existing volumes; it has no effect on whether a new volume can be provisioned.
Explanation
With volumeBindingMode: WaitForFirstConsumer, the PVC deliberately stays Pending and shows "waiting for first consumer" until a Pod referencing it is scheduled. This lets the provisioner create the volume in the same zone or node the scheduler picks, avoiding topology mismatches. The fix is simply to deploy the workload that mounts the claim.
Example5 · Troubleshooting
A worker node in Helixa Genomics' sequencing cluster reports NotReady, and `kubectl describe node node-03` shows the condition message "Kubelet stopped posting node status". You have SSH access to node-03. Which step most directly reveals why the kubelet stopped reporting?
・Run kubectl logs node/node-03 --previous to retrieve the kubelet's prior log output from the apiserver
Incorrect. kubectl logs only works against pods; nodes are not log-addressable objects, and the kubelet writes to the node's journal, not to the apiserver.
・Run kubectl get events --field-selector involvedObject.name=node-03 to read the kubelet's crash backtrace
Incorrect. Node events record lifecycle messages such as NodeNotReady but never contain the kubelet process's own logs or a crash backtrace.
✓Run journalctl -u kubelet on node-03 and inspect recent kubelet service log entries
Correct. The kubelet runs as a systemd service, so journalctl -u kubelet on the node shows startup errors, config problems, or crash output explaining the silence.
・Run systemctl restart containerd on node-03 to reinitialize the container runtime socket
Incorrect. Restarting containerd is a blind remediation, not a diagnostic step, and there is no evidence yet that the container runtime is at fault.
Explanation
When a node condition says the kubelet stopped posting status, the kubelet process itself is the suspect, and its systemd journal on the node is the primary evidence source. kubectl logs and events cannot show kubelet process output, and restarting services before diagnosis risks masking the root cause.
Example6 · Cluster Architecture, Installation and Configuration
A hospital platform team runs its electronic-health-records API in the namespace ehr-prod. A CI pipeline ServiceAccount must be able to get and list Secrets in ehr-prod and nowhere else. Which RBAC setup satisfies this with least privilege?
・Define a ClusterRole granting get and list on secrets, then bind it with a ClusterRoleBinding
Incorrect. A ClusterRoleBinding grants the permissions in every namespace in the cluster, so the pipeline could read Secrets far beyond ehr-prod.
✓Define a Role in ehr-prod with get and list on secrets, bound by a RoleBinding in that namespace
Correct. A namespaced Role with only the get and list verbs, bound by a RoleBinding in ehr-prod, limits both the verbs and the scope to exactly what the pipeline needs.
・Define a ClusterRole with verbs ["*"] on secrets, then bind it with a RoleBinding created inside the ehr-prod namespace
Incorrect. The wildcard verb list also allows create, update, patch, and delete on Secrets, which exceeds the stated read-only requirement even though the RoleBinding scopes it to one namespace.
・Define a Role in ehr-prod with get and list on secrets, then bind it to the ServiceAccount using a ClusterRoleBinding
Incorrect. A ClusterRoleBinding's roleRef must point at a ClusterRole; it cannot reference a namespaced Role, so the API server rejects this binding.
Explanation
Least privilege for namespace-scoped read access means a Role defining only get and list on secrets plus a RoleBinding in the same namespace. ClusterRoleBindings always apply cluster-wide, and a ClusterRoleBinding can never reference a namespaced Role.
Example7 · Cluster Architecture, Installation and Configuration
At a tire-manufacturing plant, a telemetry aggregator Pod runs under the ServiceAccount sensor-reader in namespace factory-metrics and must list and watch Pods across every namespace in the cluster. Which configuration grants this access with least privilege?
・Create a Role allowing list and watch on pods inside kube-system, since bindings there are inherited by all other namespaces.
Incorrect. A Role is strictly namespaced; nothing created in kube-system is inherited by other namespaces, so the aggregator could only see Pods in kube-system.
・Create a ClusterRole allowing list and watch on pods, then bind it with a RoleBinding created inside the factory-metrics namespace.
Incorrect. Binding a ClusterRole with a RoleBinding scopes the permissions down to the binding's own namespace, so sensor-reader could only list Pods in factory-metrics.
✓Create a ClusterRole that allows the list and watch verbs on the pods resource, then bind it to the sensor-reader ServiceAccount with a ClusterRoleBinding.
Correct. A ClusterRole holds the pod list/watch rules and a ClusterRoleBinding applies them cluster-wide, granting exactly the two verbs required across all namespaces.
・Bind the built-in cluster-admin ClusterRole directly to the sensor-reader ServiceAccount by creating a ClusterRoleBinding for it.
Incorrect. cluster-admin grants every verb on every resource, which massively exceeds the list/watch-on-pods requirement and violates least privilege.
Explanation
Cluster-wide read access to Pods requires a ClusterRole combined with a ClusterRoleBinding. A RoleBinding would confine the same ClusterRole to one namespace, and cluster-admin would grant far more than the two verbs the workload needs.
Example8 · Cluster Architecture, Installation and Configuration
A freight-tracking SaaS already defines a ClusterRole named cm-viewer that allows get and list on ConfigMaps. The group sortation-ops now needs exactly that access, but only inside the sortation namespace. Which single command satisfies the requirement?
・kubectl create clusterrolebinding cm-view --clusterrole=cm-viewer --group=sortation-ops with no namespace scoping
Incorrect. A ClusterRoleBinding would grant the group ConfigMap read access in every namespace of the cluster, not just sortation.
・kubectl create rolebinding cm-view --role=cm-viewer --group=sortation-ops referencing a namespaced Role
Incorrect. The --role flag references a namespaced Role named cm-viewer inside sortation, which does not exist; the existing object is a ClusterRole.
✓kubectl create rolebinding cm-view --clusterrole=cm-viewer --group=sortation-ops -n sortation
Correct. A RoleBinding may reference a ClusterRole, and doing so restricts the ClusterRole's rules to the namespace where the RoleBinding lives, here sortation.
・kubectl edit clusterrole cm-viewer to add a namespaceSelector for sortation
Incorrect. ClusterRole rules have no namespaceSelector field; scoping is decided by the kind of binding, not by editing the role's rule entries.
Explanation
Referencing an existing ClusterRole from a RoleBinding is the standard way to reuse a rule set while confining it to one namespace. A ClusterRoleBinding would apply it cluster-wide, and roles themselves carry no namespace selection mechanism.
Example9 · Cluster Architecture, Installation and Configuration
A warehouse-robotics platform uses an aggregated ClusterRole fleet-monitor whose aggregationRule selects the label rbac.fleetops.io/aggregate-monitor: "true". Auditors must now view the new custom resource robotroutes through fleet-monitor, but rules an operator adds directly to fleet-monitor keep disappearing. What is the correct change?
・Re-apply the edited fleet-monitor manifest using kubectl replace --force so that the controller finally stops reconciling the rules field it manages.
Incorrect. The aggregation controller continuously overwrites the rules field of an aggregated ClusterRole; a forced replace is reverted on the next reconcile.
・Attach the label rbac.fleetops.io/aggregate-monitor: "true" to the robotroutes CustomResourceDefinition so the aggregationRule selects that resource.
Incorrect. An aggregationRule's clusterRoleSelectors match labels on other ClusterRoles, not on CustomResourceDefinitions, so labeling the CRD changes nothing.
✓Create a new ClusterRole granting get, list, and watch on robotroutes and attach the label rbac.fleetops.io/aggregate-monitor: "true" to it.
Correct. The aggregation controller unions the rules of every ClusterRole whose labels match the aggregationRule selector, so a labeled helper ClusterRole adds robotroutes access durably.
・Create a RoleBinding to fleet-monitor for the auditors in every namespace where robotroutes objects currently exist.
Incorrect. Bindings only assign existing rules to subjects; fleet-monitor still lacks any rule for robotroutes, so the auditors remain unauthorized.
Explanation
Rules in an aggregated ClusterRole are owned by the aggregation controller and any direct edits are reverted. The supported pattern is to create a small ClusterRole carrying the new rules and label it so the aggregationRule's selector merges it in.
Example10 · Cluster Architecture, Installation and Configuration
At Invoicely, a B2B invoicing SaaS, the platform team maintains a ClusterRole named deploy-ops that allows update and patch on Deployments. The release ServiceAccount in the billing namespace must receive these permissions in billing only. Which object do you create?
・A ClusterRoleBinding linking the release ServiceAccount to deploy-ops cluster-wide
Incorrect. A ClusterRoleBinding grants the deploy-ops rules across every namespace, exceeding the billing-only requirement.
✓A RoleBinding in billing referencing the deploy-ops ClusterRole
Correct. A RoleBinding may reference a ClusterRole, and the granted permissions are then scoped to the RoleBinding's own namespace.
・A duplicate of deploy-ops created as a kube-system Role, bound with a ClusterRoleBinding
Incorrect. A Role placed in kube-system has no effect on billing, and a ClusterRoleBinding cannot reference a namespaced Role at all.
・An aggregated ClusterRole merging the deploy-ops rules into the admin role
Incorrect. Aggregation merges rules into another ClusterRole; it does not scope deploy-ops down to a single namespace.
Explanation
A RoleBinding can reference a ClusterRole in order to reuse a common rule set while limiting its effect to the binding's namespace. This is the standard least-privilege pattern for granting a shared permission bundle in exactly one namespace without duplicating Roles.
Example11 · Cluster Architecture, Installation and Configuration
Online gaming studio PixelForge installs a CRD named tournaments.game.io. Operators who are already bound to the default view ClusterRole must automatically gain read access to tournaments resources, without anyone editing view itself. What should you create?
・A RoleBinding in every application namespace that re-attaches the existing view ClusterRole to each operator group
Incorrect. More RoleBindings only re-grant what view already contains; they do not add any rules for the new CRD.
✓A new ClusterRole with get, list, watch on tournaments carrying the label rbac.authorization.k8s.io/aggregate-to-view: "true"
Correct. The built-in view ClusterRole has an aggregationRule, so the controller automatically merges rules from any ClusterRole labeled aggregate-to-view into it.
・An aggregationRule block added to the new tournaments ClusterRole with a label selector matching aggregate-to-view: "true" on other roles
Incorrect. The aggregationRule belongs on the consuming ClusterRole (view already has one); placing it on the new role makes that role collect others instead of contributing rules to view.
・A kubectl patch appending the tournaments rules into the built-in view ClusterRole
Incorrect. The rules of an aggregated ClusterRole are controller-managed, so a direct patch is overwritten on the next reconcile, and the requirement forbids editing view.
Explanation
Aggregated ClusterRoles work through labels: view, edit, and admin carry aggregationRule selectors, and the controller folds in any ClusterRole whose labels match. Shipping a small labeled ClusterRole alongside a CRD is the supported way to extend the default roles.
Example12 · Cluster Architecture, Installation and Configuration
On the ministry's shared cluster, a ServiceAccount named audit-bot in the civic-data namespace must be able to read Pods and their logs in that namespace only. An admin created a Role granting get/list on pods but the bot still gets 'forbidden' fetching logs via /api/v1/namespaces/civic-data/pods/<name>/log. Which single change fixes this?
・Replace the Role with a ClusterRole so the permission is evaluated across all namespaces first.
Incorrect. A ClusterRole widens scope to all namespaces but still would not include pods/log unless that subresource is named in resources.
・Switch the RoleBinding to a ClusterRoleBinding to escape the namespace.
Incorrect. A ClusterRoleBinding changes the account's reach to cluster scope and over-grants access, yet it does not add the missing pods/log subresource.
・Grant the verb watch on pods, since log streaming is internally treated as a watch operation.
Incorrect. watch controls change notifications on the pods list, not reading container log output, which is a distinct subresource.
✓Add the subresource pods/log to the Role's resources so the verbs apply to log retrieval.
Correct. The log endpoint is the pods/log subresource; it must be listed explicitly in resources even when pods is already granted, because subresource access is not inherited from the parent resource.
Explanation
In RBAC, subresources such as pods/log must be named explicitly in a rule's resources field; permission on pods alone never implies pods/log. The verb (get) is correct, so only adding the subresource is required.
Example13 · Cluster Architecture, Installation and Configuration
A university platform team wants the grader Deployment in namespace exams to call the Kubernetes API using a dedicated identity instead of the namespace default ServiceAccount. They created ServiceAccount sa-grader and a matching RoleBinding. Pods still authenticate as system:serviceaccount:exams:default. Which fix makes the Pods use sa-grader?
✓Set spec.template.spec.serviceAccountName: sa-grader in the Deployment so new Pods mount that token.
Correct. A Pod's identity comes from its serviceAccountName in the pod spec; without setting it on the template the Pods keep using default regardless of any binding.
・Delete the default ServiceAccount to force a fallback to sa-grader.
Incorrect. Deleting default does not redirect Pods; the controller recreates it and Pods that reference no account still select default by name.
・Set automountServiceAccountToken: true on sa-grader because the RoleBinding alone will not mount its token.
Incorrect. automountServiceAccountToken controls whether a token is mounted, not which account the Pod runs as, so it cannot switch identity.
・Add sa-grader as a subject so the default account's permissions are merged in.
Incorrect. ServiceAccounts are not composed from other accounts; identity is chosen by name in the pod spec, not merged from subjects.
Explanation
The ServiceAccount a Pod authenticates as is determined solely by serviceAccountName in the pod spec; a RoleBinding only grants that identity permissions. The Deployment template must name sa-grader for workloads to adopt it.
Example14 · Cluster Architecture, Installation and Configuration
At the insurer Meridian Assurance, a claims-audit ServiceAccount named 'audit-sa' in namespace 'claims' must only read Pods and their logs in that one namespace, nothing more. Which object grants exactly this least-privilege access when bound to 'audit-sa'?
✓A ClusterRole with verbs ['get','list'] on ['pods','pods/log'] referenced by a RoleBinding in 'claims'
Correct. A ClusterRole defining the read verbs on pods and pods/log, bound by a RoleBinding, scopes the permissions to only the 'claims' namespace while reusing the role definition.
・A ClusterRole with verbs ['get','list'] on ['pods','pods/log'] referenced by a ClusterRoleBinding
Incorrect. A ClusterRoleBinding grants the ClusterRole cluster-wide across every namespace, violating the single-namespace requirement.
・A Role in 'claims' with the verbs ['get','list','watch','create'] on resources ['pods','pods/log']
Incorrect. Adding 'watch' and 'create' exceeds read-only least privilege, letting the account launch Pods.
・A Role in 'claims' granting verbs ['*'] on resources ['pods'] plus a separate read rule on ['pods/log']
Incorrect. The wildcard verb '*' on pods grants delete, create, and patch, far beyond read access.
Explanation
A ClusterRole can be bound either cluster-wide (ClusterRoleBinding) or to a single namespace (RoleBinding). Least privilege here means only get/list on pods and pods/log, scoped by a RoleBinding to the 'claims' namespace.
Example15 · Cluster Architecture, Installation and Configuration
A booking-service Pod at the travel platform WanderRail runs under ServiceAccount 'booking-sa' and must list ConfigMaps in its own namespace 'reservations'. Its API calls return 403 Forbidden. 'kubectl get rolebinding -n reservations' shows a RoleBinding 'booking-rb' referencing Role 'cm-reader', but the subject is 'User: booking-sa'. What single change fixes the authorization?
・Recreate Role 'cm-reader' with an apiGroups entry of 'core' so ConfigMaps resolve
Incorrect. The core group is the empty string "", not 'core', and the group is unrelated to the subject-matching failure.
・Add verb 'watch' to Role 'cm-reader' so the list request is permitted by RBAC
Incorrect. 'list' is already distinct from 'watch'; the request fails because the subject never matched, not because of a missing verb.
・Switch 'booking-rb' into a ClusterRoleBinding so the ServiceAccount is finally matched
Incorrect. A ClusterRoleBinding still would not match a subject whose kind is wrongly set to User.
✓Change the binding subject's kind to ServiceAccount, giving the SA's exact name together with its own namespace
Correct. A ServiceAccount identity is matched only when the binding subject uses kind 'ServiceAccount' with the correct name and namespace, not kind 'User'.
Explanation
RBAC subjects for ServiceAccounts must use kind: ServiceAccount with name and namespace; a subject of kind User with the SA's name never matches the authenticated SA identity. The 403 is a binding-subject mismatch, not a missing verb or apiGroup.
▶ Try 10 free questions (graded)
Measure your readiness with a full mock exam
All questions · full explanations · lifetime access
Enroll(33 USD)