Courseiva

CKA Practice Question: Cluster Architecture, Installation and Configuration

Which TWO commands can be used to view the configuration of a kubeconfig file?

⚠ Common exam trap

Many exam-takers confuse commands that modify the kubeconfig (like `set-context`) with commands that display it, or mistakenly think `current-context` shows the full configuration when it only shows the active context name.

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 get-contexts

Option E, `kubectl config view`, is correct because it prints the merged kubeconfig settings (clusters, contexts, users, and current-context) from the kubeconfig file, optionally with `--minify` or `--raw`. Option D, `kubectl config get-contexts`, is correct because it lists the contexts defined in the kubeconfig, showing NAME, CLUSTER, AUTHINFO, and NAMESPACE, which is a way to view part of the configuration. Option A is wrong because a kubeconfig is a client-side file, not a ConfigMap object, so `kubectl describe configmap kubeconfig` would only work if such a ConfigMap existed in the cluster. Option B is wrong because `kubectl config set-context` modifies a context rather than displaying configuration. Option C is wrong because `kubectl config current-context` only displays the name of the active context, not the configuration itself.

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 describe configmap kubeconfig

    Why it's wrong here

    kubectl describe configmap kubeconfig is invalid for this purpose because kubeconfig is a client-side configuration file, not a Kubernetes API object. By default there is no ConfigMap named 'kubeconfig' in any namespace, so the command will fail with an error saying the ConfigMap does not exist; it cannot display the kubeconfig contents.

  • ✗

    kubectl config set-context

    Why it's wrong here

    kubectl config set-context is a mutating command that creates or modifies a context's cluster, user, and namespace properties in the kubeconfig file. It requires arguments (e.g., --cluster, --user, --namespace) and writes changes rather than displaying the existing configuration, so it is not a view operation.

  • ✗

    kubectl config current-context

    Why it's wrong here

    kubectl config current-context only prints the name of the context currently selected by the 'current-context' field in the kubeconfig. It does not show the cluster, user, namespace, or any other context details, so it cannot display the full configuration of contexts in the file.

  • ✓

    kubectl config get-contexts

    Why this is correct

    kubectl config get-contexts returns a table of all contexts defined in the kubeconfig, listing each context's name, cluster, authinfo, and namespace (along with a marker for the current context). This is a read-only command that directly satisfies the requirement to view context configuration, making it a correct choice.

  • ✓

    kubectl config view

    Why this is correct

    kubectl config view outputs the complete kubeconfig contents, including clusters, users, contexts, and the current-context setting. It merges configuration from all kubeconfig files specified by the KUBECONFIG environment variable, so it provides the full configuration view required by the question.

About these practice questions

One of 726 original CKA practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. 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.