Question

Difficulty: Very hardDeploying and Managing Google Kubernetes Engine (GKE) Clusters and Workloads

A Lead Systems Engineer is configuring a new administrative workstation to manage deployments on an existing Google Kubernetes Engine (GKE) Standard cluster named `analytics-prod-cluster` in region `us-central1`. The engineer has completed authentication via `gcloud auth login` and installed `kubectl`. However, executing `kubectl get pods` results in an error indicating connection attempts to `localhost:8080`. Simultaneously, the team needs to create a new node pool dedicated to processing fault-tolerant, asynchronous batch calculations while keeping compute costs to a minimum. Which pair of actions correctly resolves the command-line authentication issue and fulfills the workload requirement?

  1. Execute `gcloud container clusters get-credentials analytics-prod-cluster --region us-central1` to populate the local kubeconfig, and provision a node pool configured with `--spot` instances.Answer
  2. B
    Execute `gcloud config set container/cluster analytics-prod-cluster` to set the cluster context, and provision a node pool configured with `--spot` instances.
  3. C
    Execute `gcloud container clusters get-credentials analytics-prod-cluster --region us-central1` to populate the local kubeconfig, and provision a node pool using standard E2 machine types while disabling autoscaling.
  4. D
    Execute `gcloud config set project analytics-prod-cluster` to set cluster scope, and convert the existing GKE Standard cluster into a GKE Autopilot cluster.

Answer

Execute `gcloud container clusters get-credentials analytics-prod-cluster --region us-central1` to populate the local kubeconfig, and provision a node pool configured with `--spot` instances.
The correct response addresses both operational requirements: running `gcloud container clusters get-credentials` updates the local kubeconfig file with API server access credentials, resolving the `localhost:8080` connection error. Additionally, configuring a GKE node pool using `--spot` instances delivers significant cost reduction for stateless, fault-tolerant batch processing workloads.

Step-by-Step Solution

1
Diagnose the local `kubectl` error.
The connection error to `localhost:8080` indicates that `kubectl` lacks valid cluster endpoint credentials in the local `~/.kube/config` file.
When `kubectl` is invoked without a configured context, it defaults to attempting a local server connection at `localhost:8080`.
2
Update kubeconfig credentials using the gcloud CLI.
Running `gcloud container clusters get-credentials analytics-prod-cluster --region us-central1` fetches cluster metadata and endpoint information, writing valid credentials to kubeconfig.
This command generates the necessary authentication token and context for `kubectl` to communicate with the GKE control plane.
3
Select the appropriate GKE compute configuration for fault-tolerant batch processing.
Provisioning a dedicated GKE node pool with Spot VMs (`--spot`) provides discounted compute capacity suitable for batch workloads that tolerate preemption.
Spot VMs offer substantial cost savings compared to standard compute instances for workloads that are stateless and fault-tolerant.

Key Concept

GKE Cluster Credential Fetching & Spot Node Pool Provisioning
Estimated Time:2m 0s
Rate this question