Question

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

A cloud engineer needs to deploy a containerized web application to an existing Google Kubernetes Engine (GKE) cluster and make it accessible to external users via a Google Cloud Load Balancer. Place the operational steps in the correct sequence from start to finish.

  1. 1Run `gcloud container clusters get-credentials` to configure local `kubectl` context with cluster authentication details.
  2. 2Define a Kubernetes Deployment manifest file (`deployment.yaml`) specifying the container image, container port, and replica count.
  3. 3Execute `kubectl apply -f deployment.yaml` to create the deployment resource and launch pods across cluster nodes.
  4. 4Execute `kubectl expose deployment` with `--type=LoadBalancer` to provision an external Cloud Load Balancer for the workload.
  5. 5Execute `kubectl get service` to retrieve the provisioned external IP address and confirm ingress connectivity.

Answer

The correct operational sequence begins with fetching cluster credentials using `gcloud container clusters get-credentials`, followed by drafting the Deployment YAML manifest, deploying the manifest with `kubectl apply`, exposing the deployment via a `LoadBalancer` Service, and concluding with `kubectl get service` to obtain the external IP address.
The canonical workflow for deploying GKE workloads requires authenticating `kubectl` via `gcloud container clusters get-credentials`, defining the workload manifest file, applying the manifest via `kubectl apply`, exposing the deployment to external users via a `LoadBalancer` Service, and finally inspecting the allocated IP using `kubectl get service`.

Step-by-Step Solution

1
Authenticate kubectl against the target GKE cluster
The local `kubeconfig` file is updated with cluster credentials and control plane endpoint data.
Authentication credentials are required for `kubectl` to execute API requests against GKE.
2
Draft the deployment specification
A valid declarative YAML configuration (`deployment.yaml`) is created.
Kubernetes resources require declarative definitions outlining desired state.
3
Apply the deployment manifest to GKE
The Kubernetes control plane creates the Deployment object and provisions application pods.
`kubectl apply` transmits the manifest specification to the Kubernetes API server.
4
Expose the application pods via a LoadBalancer Service
GCP provisions a Cloud Load Balancer pointing to the application pods.
Creating a Service of type LoadBalancer bridges external network traffic to internal pod endpoints.
5
Inspect the Service status for external IP assignment
The external IP address assigned by Google Cloud is displayed.
`kubectl get service` allows verification of external network ingress.

Key Concept

GKE Workload Deployment and Service Exposure Workflow
Estimated Time:1m 30s
Rate this question