Skip to content

KCNA · Domain 1: Kubernetes Fundamentals · 44% of the exam

Task 1.2: Administration

Working with a cluster through kubectl and kubeconfig contexts, declarative and imperative object management, resource quotas and limit ranges, node maintenance, upgrades and the version skew policy, and backing up etcd.

Study it

  • Working with a cluster: kubectl, kubeconfig contexts, apply versus create

    Lesson coming

  • Quotas, limit ranges, node maintenance, upgrades and etcd backups

    Lesson coming

Sample questions

Try each one before opening the answer. Every option is explained, with the CNCF documentation page that proves it.

Question 1 · choose 1

A team keeps its manifests in Git. Its pipeline must create the objects on the first run and update them on every later run, without failing because the objects already exist. Which command fits?

  1. Akubectl create -f manifests/
  2. Bkubectl apply -f manifests/
  3. Ckubectl replace -f manifests/
  4. Dkubectl run app --image=app:1.0
Show the answer and why
  • Akubectl create -f manifests/

    Incorrect

    create is imperative object configuration for new objects; it reports an error when an object already exists.

  • Bkubectl apply -f manifests/

    Correct

    Declarative configuration lets kubectl detect per object whether to create or patch it, and it works on whole directories.

  • Ckubectl replace -f manifests/

    Incorrect

    replace overwrites live objects that must already exist and drops changes not in the file, so the first run fails.

  • Dkubectl run app --image=app:1.0

    Incorrect

    run starts a single Pod imperatively and does not read the manifests at all.

Declarative object configuration with kubectl apply is the fit for files kept in version control: the same command creates, updates and works on directories.

Question 2 · choose 1

An engineer's kubeconfig file defines two contexts, staging and production. kubectl commands currently go to staging. Which command makes the following commands go to production?

  1. Akubectl config use-context production
  2. Bkubectl config set-context production
  3. Ckubectl config view --minify
  4. Dkubectl cluster-info
Show the answer and why
  • Akubectl config use-context production

    Correct

    use-context sets the current context in the kubeconfig file, and kubectl uses it for every later command.

  • Bkubectl config set-context production

    Incorrect

    set-context does not switch which context is current, so later commands would still go to staging.

  • Ckubectl config view --minify

    Incorrect

    view prints the configuration; with --minify it shows only what the current context uses. It changes nothing.

  • Dkubectl cluster-info

    Incorrect

    cluster-info prints the addresses of the control plane and services for the current context.

A kubeconfig file can hold many clusters, users and contexts; kubectl config use-context picks the one that later commands use.

Question 3 · choose 1

A worker node needs a kernel update and a reboot. The administrator wants the node's Pods moved elsewhere gracefully, honoring PodDisruptionBudgets, and no new Pods placed on it meanwhile. Which command does this?

  1. Akubectl delete node <node>
  2. Bkubectl taint nodes <node> maintenance=true:NoSchedule
  3. Ckubectl drain <node> --ignore-daemonsets
  4. Dkubectl rollout restart deployment --all
Show the answer and why
  • Akubectl delete node <node>

    Incorrect

    Deleting the Node object removes it from the API instead of evicting its Pods through the Eviction API, so it is not a graceful maintenance step.

  • Bkubectl taint nodes <node> maintenance=true:NoSchedule

    Incorrect

    A NoSchedule taint keeps new Pods off but leaves the running Pods where they are.

  • Ckubectl drain <node> --ignore-daemonsets

    Correct

    drain marks the node unschedulable and evicts its Pods through the Eviction API, which respects PodDisruptionBudgets. DaemonSet Pods are skipped with the flag.

  • Dkubectl rollout restart deployment --all

    Incorrect

    Restarting every Deployment recreates Pods across the cluster, possibly on the same node, and ignores Pods not owned by Deployments.

kubectl drain is the maintenance command: it cordons the node and evicts Pods with respect for disruption budgets, so workloads move before the reboot.

Question 4 · choose 1

A shared cluster gives each team its own namespace. The administrator wants all of team-a's Pods together to request no more than 20 CPUs and 64Gi of memory. Which object enforces that?

  1. ALimitRange in team-a
  2. BPriorityClass for team-a's Pods
  3. CResourceQuota in team-a
  4. DPodDisruptionBudget for team-a's Deployments
Show the answer and why
  • ALimitRange in team-a

    Incorrect

    A LimitRange constrains individual Pods or containers, not the total for the namespace.

  • BPriorityClass for team-a's Pods

    Incorrect

    Priority orders Pods for scheduling and preemption. It sets no ceiling on what a team consumes.

  • CResourceQuota in team-a

    Correct

    A ResourceQuota limits the aggregate resource consumption of a namespace and rejects requests that would exceed it.

  • DPodDisruptionBudget for team-a's Deployments

    Incorrect

    A disruption budget limits how many Pods voluntary disruptions may take down at once. It says nothing about resources.

Namespace-wide totals are the job of ResourceQuota; once a quota covers CPU or memory, Pods in that namespace must state requests or limits for them.

Question 5 · choose 1

A developer wants to read, from the terminal, the documented fields under a Deployment's spec.strategy for the API version that the cluster serves. Which command shows them?

  1. Akubectl describe deployment web
  2. Bkubectl api-resources
  3. Ckubectl get deployment web -o yaml --show-managed-fields
  4. Dkubectl explain deployment.spec.strategy
Show the answer and why
  • Akubectl describe deployment web

    Incorrect

    describe shows the live state and recent events of one object, not field documentation.

  • Bkubectl api-resources

    Incorrect

    api-resources lists the kinds the server supports, with short names and scope, but no field documentation.

  • Ckubectl get deployment web -o yaml --show-managed-fields

    Incorrect

    This prints one object's current values. Fields that are unset do not appear and nothing is explained.

  • Dkubectl explain deployment.spec.strategy

    Correct

    explain describes the fields and structure of a resource, addressed with a simple JSONPath-style identifier, using the cluster's API schema.

kubectl explain reads the API schema the server publishes, so it is the quickest way to look up what a field means and which sub-fields it has.

Question 6 · choose 2

An administrator will upgrade a kubeadm cluster from Kubernetes v1.35 to v1.37. Which two steps follow the supported upgrade path? (Choose TWO.)

  1. AUpgrade the worker nodes' kubelets first so they are ready for the new API
  2. BUpgrade to v1.36 first and then from v1.36 to v1.37
  3. CRun kubeadm upgrade apply v1.37.x directly on the v1.35 control plane
  4. DUpgrade the control plane nodes before the worker nodes
  5. EUpgrade the nodes together in one step and skip the drain
Show the answer and why
  • AUpgrade the worker nodes' kubelets first so they are ready for the new API

    Incorrect

    A kubelet newer than kube-apiserver is outside the version skew policy.

  • BUpgrade to v1.36 first and then from v1.36 to v1.37

    Correct

    kubeadm supports upgrades of one minor version at a time; skipping a minor version is unsupported.

  • CRun kubeadm upgrade apply v1.37.x directly on the v1.35 control plane

    Incorrect

    That skips a minor version, which kubeadm does not support.

  • DUpgrade the control plane nodes before the worker nodes

    Correct

    The workflow upgrades the primary control plane node, then the other control plane nodes, then the workers, because a kubelet must not be newer than the API server.

  • EUpgrade the nodes together in one step and skip the drain

    Incorrect

    The documented procedure drains each node before upgrading its kubelet so workloads move off first.

Go one minor version at a time, control plane first and nodes after, draining each node before its kubelet is upgraded.

Question 7 · choose 1

In a shared namespace, developers often forget to set CPU and memory requests and limits. The administrator wants such containers to receive sensible defaults automatically. What should be created?

  1. Akubectl set resources run on each Deployment
  2. BA PriorityClass marked globalDefault
  3. CA VerticalPodAutoscaler for each Deployment
  4. DA LimitRange with default requests and limits
Show the answer and why
  • Akubectl set resources run on each Deployment

    Incorrect

    That sets values once per workload by hand; new containers still get none.

  • BA PriorityClass marked globalDefault

    Incorrect

    That sets a default priority, not resource values.

  • CA VerticalPodAutoscaler for each Deployment

    Incorrect

    VPA recommends or adjusts requests from usage; it is not a namespace-wide default for new containers.

  • DA LimitRange with default requests and limits

    Correct

    A LimitRange can set default requests and limits that the admission controller applies to containers that do not set them.

LimitRange sets per-container defaults and bounds inside a namespace, so containers that state nothing still get sensible values.

Question 8 · choose 1

A cleanup script is about to run kubectl delete namespace staging. What happens to the Deployments, Services and Secrets inside it?

  1. AThey are deleted along with the namespace
  2. BThey are moved into the default namespace
  3. CThey keep running but can no longer be listed
  4. DThe command fails until the namespace is empty
Show the answer and why
  • AThey are deleted along with the namespace

    Correct

    Deleting a namespace deletes everything under it.

  • BThey are moved into the default namespace

    Incorrect

    Kubernetes does not move objects between namespaces.

  • CThey keep running but can no longer be listed

    Incorrect

    Namespaced objects cannot outlive their namespace.

  • DThe command fails until the namespace is empty

    Incorrect

    The deletion proceeds and removes the contents.

A namespace delete is a bulk delete of all its objects, so it deserves care.

Question 9 · choose 1

A service runs 3 replicas. During planned node maintenance, the team wants at least 2 of them to stay up at all times. What should it create?

  1. AA HorizontalPodAutoscaler with minReplicas set to 2
  2. BA PodDisruptionBudget with minAvailable set to 2
  3. CA PriorityClass with a high value
  4. DA readiness probe on each of the 3 replicas
Show the answer and why
  • AA HorizontalPodAutoscaler with minReplicas set to 2

    Incorrect

    The autoscaler sets the desired count; it does not hold back evictions.

  • BA PodDisruptionBudget with minAvailable set to 2

    Correct

    Voluntary evictions go through the Eviction API, which respects disruption budgets, so maintenance will not take the service below 2.

  • CA PriorityClass with a high value

    Incorrect

    Priority affects scheduling and preemption, not voluntary evictions.

  • DA readiness probe on each of the 3 replicas

    Incorrect

    Readiness controls traffic to a Pod; it does not limit how many Pods are evicted.

PodDisruptionBudgets limit how many replicas voluntary disruptions, such as node maintenance, may take down at once.

Question 10 · choose 1

A field was removed from a manifest, and the next client-side kubectl apply also removed it from the live object. Where does kubectl find out which fields the previous apply had set?

  1. AIn the status field of the live object
  2. BIn its last-applied-configuration annotation
  3. CIn a local cache file next to the manifest
  4. DIn the Deployment's revision history
Show the answer and why
  • AIn the status field of the live object

    Incorrect

    status reports current state written by controllers.

  • BIn its last-applied-configuration annotation

    Correct

    Client-side apply stores the applied configuration in this annotation and compares it with the new file.

  • CIn a local cache file next to the manifest

    Incorrect

    kubectl keeps no per-object cache on disk for this.

  • DIn the Deployment's revision history

    Incorrect

    Revision history tracks Pod template changes, not every applied field.

The last-applied-configuration annotation lets apply compute what to add, change and delete.

Practise domain 1 →Practise all domains →