
Answer-first summary for fast verification
Answer: The kubeconfig is missing credentials. Use the `gcloud container clusters get-credentials` command.
The correct answer is **C** because when kubectl cannot connect to the cluster, it's often due to missing credentials in the kubeconfig file. The solution is to set the cluster context by running the `gcloud container clusters get-credentials` command. This command retrieves the necessary credentials and updates the kubeconfig file. - **Options A & D** are incorrect because they suggest modifying firewall rules, which is not the issue here. SSH access is automatically configured and doesn't require manual firewall adjustments. - **Option B** is incorrect as it suggests using the `auth login` command, which is not applicable in this scenario. The `auth login` command is used when the resource is not found, not for connection issues.
Author: LeetQuiz Editorial Team
Ultimate access to all questions.
No comments yet.
You're attempting to deploy a container to Kubernetes, but kubectl fails to connect to the cluster. What is the most probable reason for this issue and how can it be resolved?
A
The kubeconfig lacks the necessary credentials. Execute the gcloud container clusters auth login command.
B
Firewall rules are blocking the connection. Modify the firewall rules to permit traffic on port 3682.
C
The kubeconfig is missing credentials. Use the gcloud container clusters get-credentials command.
D
Firewall rules are obstructing the connection. Adjust the firewall rules to allow traffic on port 1337.