Soru

Zorluk: KolayDeploying and Managing Google Kubernetes Engine (GKE) Clusters and Workloads

You need to deploy a containerized application to a newly provisioned Google Kubernetes Engine (GKE) cluster using Google Cloud CLI and `kubectl`. Place the following administrative and deployment steps in the correct chronological sequence from first to last.

  1. 1Set the active project context in gcloud using `gcloud config set project [PROJECT_ID]`.
  2. 2Fetch cluster authentication credentials to update local kubeconfig using `gcloud container clusters get-credentials [CLUSTER_NAME] --zone [ZONE]`.
  3. 3Apply the workload configuration to the cluster using `kubectl apply -f deployment.yaml`.
  4. 4Verify the deployment status and confirm pod readiness using `kubectl get pods`.

Cevap

The correct operational sequence is: 1) Set the active GCP project context via gcloud, 2) Fetch GKE cluster authentication credentials into kubeconfig via get-credentials, 3) Submit the application deployment manifest via kubectl apply, and 4) Verify pod execution state using kubectl get pods.
The correct operational workflow requires specifying the active GCP project first, fetching the Kubernetes API credentials for the target cluster into `kubeconfig` second, applying the YAML deployment specification third, and verifying workload execution fourth.

Adım Adım Çözüm

1
Select the active Google Cloud project context.
Ensures all subsequent gcloud commands target the correct project resources.
Setting the project context prevents accidentally interacting with resources in a different project.
2
Generate local kubeconfig authentication credentials using `gcloud container clusters get-credentials`.
Populates local API endpoint address and authentication certificates into `~/.kube/config`.
Without fetching cluster credentials, `kubectl` commands cannot authenticate to the GKE control plane.
3
Execute `kubectl apply -f deployment.yaml`.
Submits the Deployment manifest definition to the GKE Kubernetes API server.
The API server creates the Deployment, ReplicaSet, and Pod objects on worker nodes.
4
Execute `kubectl get pods` to inspect pod state.
Returns current pod status (e.g., Running, ContainerCreating, CrashLoopBackOff).
Verification confirms whether the containers pull successfully and start without errors.

Anahtar Kavram

GKE Workload Deployment Workflow
Bu soruyu puanla