Question

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

A system administrator needs to configure a fresh workstation to manage workloads on an existing Google Kubernetes Engine (GKE) Standard cluster named `analytics-prod` located in the `us-central1` region. The administrator has already installed the Google Cloud SDK (`gcloud`) and `kubectl`, and has authenticated using `gcloud auth login`. The application requires applying a Kubernetes deployment manifest named `app-deploy.yaml` and using a dedicated node pool optimized for high-reliability background processing without unexpected node preemption. Which of the following steps are required to achieve this deployment successfully? (Select TWO.)

  1. Run `gcloud container clusters get-credentials analytics-prod --region us-central1` to retrieve cluster credentials and update the local `kubeconfig` context.Answer
  2. B
    Execute `gcloud config set container/cluster analytics-prod` to point `kubectl` commands to the target cluster.
  3. Execute `kubectl apply -f app-deploy.yaml` to deploy the application resources to the cluster once cluster credentials are configured.Answer
  4. D
    Provision a Spot VM node pool for the background processing workload to guarantee zero node terminations during execution.

Answer

To successfully deploy the workload, the administrator must fetch the cluster credentials using `gcloud container clusters get-credentials analytics-prod --region us-central1` and then deploy the manifest using `kubectl apply -f app-deploy.yaml`.
The correct steps involve first fetching the cluster credentials into the local kubeconfig file using `gcloud container clusters get-credentials analytics-prod --region us-central1`, and second using `kubectl apply -f app-deploy.yaml` to deploy the declared resources to the GKE cluster.

Step-by-Step Solution

1
Fetch GKE Cluster Kubeconfig Credentials
The local `~/.kube/config` file is populated with the endpoint address, CA certificate, and authentication token for `analytics-prod`.
Before `kubectl` can issue commands to a GKE cluster, local kubeconfig credentials must be generated by the `gcloud container clusters get-credentials` command.
2
Deploy Workload Manifest using kubectl
The Kubernetes API server accepts `app-deploy.yaml` and schedules the pods onto available cluster nodes.
Applying the manifest creates or updates the deployment object defined in the YAML file on the authenticated cluster context.

Key Concept

Configuring kubectl authentication for GKE clusters via gcloud and executing workload deployments.
Rate this question