Courseiva

CKA Practice Question: Cluster Architecture, Installation and Configuration

A cluster has multiple kubeconfig files. You want to set the current context to 'admin@production' for all future kubectl commands. Which command should you run?

⚠ Common exam trap

Watch out — candidates often confuse `set-context` (which only defines or updates a context entry) with `use-context` (which actually switches the active context), leading them to select option A.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

✓

kubectl config use-context admin@production

The `kubectl config use-context` command is used to set the current context in a kubeconfig file, which determines the cluster, user, and namespace that kubectl will use by default for all subsequent commands. Option B correctly specifies `admin@production` as the context to switch to, making it the active context for future kubectl operations.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • ✗

    kubectl config set-context admin@production

    Why it's wrong here

    This command is used to define or update the parameters of a context, such as its associated cluster, user, and namespace, within the kubeconfig file. While it can create or modify the `admin@production` context definition, it does not alter the `current-context` field to make it active for subsequent CLI commands.

  • ✓

    kubectl config use-context admin@production

    Why this is correct

    This command directly updates the `current-context` field in your active kubeconfig file to `admin@production`. Once executed, all subsequent `kubectl` commands will target the cluster and use the user credentials defined within this specific context, making it the correct choice for switching active environments.

  • ✗

    kubectl config set-cluster admin@production

    Why it's wrong here

    This command modifies or creates a cluster entry in the kubeconfig, specifying connection details like the API server URL and certificate authority data. It does not define a context, which binds a user to a cluster, nor does it change the active context used by the client.

  • ✗

    kubectl config get-contexts admin@production

    Why it's wrong here

    This command is used to retrieve and display information about one or more defined contexts in your kubeconfig. Passing a specific context name as an argument filters the list to show only that context's details, but it performs no write operations and cannot change the active context.

About these practice questions

This CKA question is part of Courseiva's 726-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This CKA practice question is part of Courseiva's free CNCF certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the CKA exam.