Prepare and test your skills

Prepare and test your skills

Free sample question with answers and detailed explanation below. The Associate Cloud Engineer practice bank has an additional 2,014 practice questions.Try 10 free realistic questions: instant score, no credit card, and no account required.
You manage two Google Kubernetes Engine (GKE) clusters within your project: staging-cluster and prod-cluster. Your local kubeconfig file contains the credentials and contexts for both clusters. You are currently targeting staging-cluster, but you must switch your active CLI environment to prod-cluster and verify cluster connectivity and authorization by inspecting the health and status of all worker nodes.
Which sequence of kubectl commands should you run?
kubectl config get-contexts to switch the active context, and then run kubectl describe cluster to check node readiness and status.kubectl config get-contexts and kubectl describe cluster doThe command kubectl config get-contexts lists all configured contexts recorded in the kubeconfig file, displaying their cluster, user, and namespace associations. When supplied with a context name, it filters the display to that single entry. The command kubectl describe cluster is invalid syntax because cluster is not a standard Kubernetes resource type recognized by kubectl describe.
kubectl config get-contexts only prints configuration metadata to standard output; it does not set or modify the active context.kubectl describe cluster results in an error (error: the server doesn't have a resource type "cluster"). To inspect GKE cluster-level infrastructure, one must use gcloud container clusters describe or inspect individual nodes via kubectl describe nodes.get-contexts helps administrators view available connection endpoints and identify the active context marked with an asterisk (*).Node objects (nodes or no), not cluster objects.You wanted to review the configuration details of a specific context in your local kubeconfig file without altering your active session.
kubectl config current-context to switch the active context, and then run kubectl get namespaces to check node readiness and status.kubectl config current-context and kubectl get namespaces doThe command kubectl config current-context is a read-only command that displays the name of the currently active context from your kubeconfig file. It does not accept a context name as an argument to switch targets. The command kubectl get namespaces queries the cluster API server for virtual cluster partitions (namespaces).
kubectl config current-context does not change the context; it either ignores the argument or returns an error depending on the CLI version.kubectl get namespaces lists logical namespace boundaries (e.g., default, kube-system). It provides zero information regarding underlying worker node health, readiness, or infrastructure capacity.current-context is used strictly to check which cluster context is currently active.You needed to print the name of your current active cluster to the terminal and list the logical workload partitions configured in that cluster.
kubectl config set-cluster to switch the active context, and then run kubectl top nodes to check node readiness and status.kubectl config set-cluster and kubectl top nodes doThe command kubectl config set-cluster is used to create or modify the endpoint URL and certificate authority data of a specific cluster entry inside the kubeconfig file. It does not select or switch the active target context. The command kubectl top nodes queries the Kubernetes Metrics Server to display real-time CPU and memory resource consumption across nodes.
kubectl config set-cluster edits cluster attributes rather than changing the current-context pointer. The active target remains set to staging-cluster.kubectl top nodes reports resource utilization (cores and bytes), not node lifecycle states or conditions (such as Ready or DiskPressure). Furthermore, if Metrics Server is not installed or initializing, kubectl top nodes will return an error even if the cluster and nodes are fully operational.set-cluster expects parameters like --server or --certificate-authority to configure connection endpoints.kubectl top relies strictly on the aggregated Metrics API (metrics.k8s.io), making it a performance monitoring tool rather than a connectivity and node readiness diagnostic.The goal were to update the control plane API server IP address in the configuration file and then monitor the CPU and memory utilization of existing nodes rather than verify context switching and basic node health.
kubectl config use-context to switch the active context, and then run kubectl get nodes to check node readiness and status.kubectl config use-context and kubectl get nodes areThe command kubectl config use-context updates the current-context entry in your local kubeconfig file (~/.kube/config). A context in Kubernetes bundles a specific cluster definition, user credential, and optional default namespace into a single named target. The command kubectl get nodes queries the Kubernetes API server for the list of registered worker nodes in the active cluster, returning their operational state, roles, age, and Kubernetes version.

kubectl config use-context immediately changes the target cluster without modifying or deleting credentials for other clusters.kubectl get nodes makes an authenticated API call to the cluster control plane. A successful response confirms network connectivity, valid authentication tokens, and sufficient Role-Based Access Control (RBAC) permissions to read cluster-level infrastructure resources.Ready or NotReady), fulfilling the verification requirement.gke-gcloud-auth-plugin) refreshing OAuth tokens.current-context), preserving all existing cluster endpoints and certificates.This sequence directly uses native kubectl configuration subcommands to select the desired target and executes the standard diagnostic resource query to inspect node-level health in a single, standard operational workflow.
Answer them yourself and get your score the moment you finish. No account needed.
Full access includes
Keep the momentum going with these hand-picked practice scenarios
Last updated