Courseiva

CKA Practice Question: Cluster Architecture, Installation and Configuration

An admin wants to view the current context in their kubeconfig. Which command should they use?

⚠ Common exam trap

Many exam-takers confuse `get-contexts` (which lists all contexts) with `current-context` (which shows only the active one), or they mistakenly think `cluster-info` or `config view` will directly reveal the current context without additional parsing.

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 current-context

`kubectl config current-context` is the exact command to display the currently active context from the kubeconfig file. The context includes the cluster, namespace, and user that `kubectl` will use by default. This is a direct query of the `current-context` field in the kubeconfig YAML/JSON structure.

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

    Why it's wrong here

    kubectl config get-contexts lists every context defined in the kubeconfig, displaying each context's cluster, user, and namespace in a table. It does mark the active context with an asterisk in the CURRENT column, but it is not a dedicated command to output the current context name alone. For human inspection it may suffice, but it is not the precise, scriptable way to retrieve just the active context. The admin explicitly wants to view the current context, so this command's broader output makes it the wrong choice.

  • kubectl cluster-info

    Why it's wrong here

    kubectl cluster-info queries the Kubernetes API server to show the cluster's address and service endpoints, such as the control plane and CoreDNS URLs. It is unaware of kubeconfig context names; it operates at the cluster connection level rather than the configuration file level. Even though it may connect using the current context, it does not report what that context is called. Therefore it is not a way to view the current context.

  • kubectl config current-context

    Why this is correct

    kubectl config current-context is the dedicated subcommand that reads the kubeconfig file and prints the name of the currently active context to standard output. It returns exactly one line—the context name—with no additional formatting, making it ideal for scripting and automation. This directly satisfies the admin's need to view the current context, so it is the correct command.

  • kubectl config view

    Why it's wrong here

    kubectl config view dumps the entire kubeconfig file in YAML (or JSON with --output), including all clusters, users, contexts, and the current-context field. It is a comprehensive reference for debugging but overkill for simply checking the active context. The current context must be extracted from a larger output, and unless the file is small, it is not a convenient or focused way to see the current context. Therefore it is incorrect for this specific task.

About these practice questions

Courseiva writes every CKA question from scratch — 302 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or 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.