Soru

Zorluk: Çok zorDeploying and Managing Google Kubernetes Engine (GKE) Clusters and Workloads

A cloud engineer needs to configure an automated deployment script running on a fresh administrative workstation to deploy a microservice workload to a newly provisioned Google Kubernetes Engine (GKE) Standard cluster. Arrange the required administrative and operational steps in the correct chronological sequence from initial environment configuration to verifying successful pod rollout.

  1. 1Configure default Google Cloud CLI environment properties for the target project and compute region using `gcloud config set` commands.
  2. 2Fetch cluster entry and authentication credentials into the local `kubeconfig` file using `gcloud container clusters get-credentials`.
  3. 3Verify control plane API reachability and node status using `kubectl get nodes`.
  4. 4Submit the Kubernetes Deployment manifest file to the cluster API using `kubectl apply -f deployment.yaml`.
  5. 5Monitor workload pod initialization and ready status using `kubectl rollout status deployment/<deployment-name>`.

Cevap

The correct operational sequence begins with configuring default CLI project and region properties via `gcloud config set`, followed by generating cluster credentials with `gcloud container clusters get-credentials`. Next, cluster reachability is confirmed using `kubectl get nodes`, after which the application manifest is deployed via `kubectl apply -f deployment.yaml`. Finally, deployment success is confirmed using `kubectl rollout status deployment/<deployment-name>`.
Deploying workloads to a GKE cluster follows a strict prerequisite hierarchy: first set CLI defaults (`gcloud config set`), generate the cluster API kubeconfig authentication entry (`gcloud container clusters get-credentials`), validate cluster node connectivity (`kubectl get nodes`), submit workload manifests (`kubectl apply`), and finally verify pod execution (`kubectl rollout status`).

Adım Adım Çözüm

1
Set CLI target environment variables and context.
The local `gcloud` tool points to the correct GCP Project ID and Compute Region.
Prevents credential retrieval commands from failing or targeting clusters in wrong projects/zones.
2
Execute `gcloud container clusters get-credentials CLUSTER_NAME --region REGION`.
The local `kubeconfig` context is updated with cluster API server endpoint addresses and short-lived IAM credentials.
`kubectl` cannot issue requests to a GKE cluster without a valid context entry in `kubeconfig`.
3
Run `kubectl get nodes` to test control plane access.
The cluster returns a list of worker nodes and their current status (e.g., `Ready`).
Verifies that IAM permissions, network routing, and API server authentication are fully functional prior to workload submission.
4
Execute `kubectl apply -f deployment.yaml`.
Kubernetes manifest specifications are parsed and applied to create Deployment and ReplicaSet objects.
Declaratively initiates pod scheduling and container provisioning within the cluster.
5
Run `kubectl rollout status deployment/<deployment-name>`.
The command tracks pod creation until all desired replicas pass readiness probes and reach the `Running` state.
Confirms deployment completion and flags any image pull or initialization errors.

Anahtar Kavram

Google Kubernetes Engine Workload Deployment and Lifecycle Management Workflow
Bu soruyu puanla