Skip to content

CICD-275 · Google Kubernetes Engine deployment ​

Encyclopedia · Cloud infrastructure integration · All snippets

Previous · CICD-274 · Next · CICD-276

1. Where it fits ​

  • Placement CI run step or authorized lab terminal.
  • Prerequisites provider CLI, scoped CI identity, test environment and provider configuration for named resource.
  • Platforms github-actions, cloud-cli.
  • Parameters GCP_PROJECT, GKE_CLUSTER, GKE_LOCATION, IMAGE.

2. Copy the snippet ​

bash
gcloud container clusters get-credentials "${GKE_CLUSTER:?}" --location "${GKE_LOCATION:?}" --project "${GCP_PROJECT:?}"
kubectl -n staging set image deployment/web web="${IMAGE:?}"
kubectl -n staging rollout status deployment/web --timeout=180s

3. How it works ​

Google Cloud selects the project, location and cluster and prepares the client context used by kubectl.

4. Verify the result ​

Install the GKE auth plugin and use a scoped identity. Verify the target project before writing.

Validation syntax-validated (Bash parse). Status definitions.