Improve GKE Deployment Rollback and Image Cleanup

PCDOE By islever Editorial Last updated

Short answer

B Adopt Cloud Deploy for managing deployments, and implement an Artifact Registry cleanup policy.

Question

Your company uses a CI/CD pipeline with Cloud Build and Artifact Registry to deploy container images to Google Kubernetes Engine (GKE). Images are tagged with the latest commit hash and promoted to production after successful testing in the development and pre-production environments. A recent production deployment caused the application to fail due to untested integration functionality, requiring a disruptive manual rollback. During the rollback, you noticed many old and unused container images accumulating in Artifact Registry. You need to improve rollout and rollback management and clean up the old container images. What should you do?
  1. Set up a rollback pipeline in Cloud Build, and implement an Artifact Registry cleanup policy.
  2. Adopt Cloud Deploy for managing deployments, and implement an Artifact Registry cleanup policy. Correct Answer
  3. Deploy Cloud Service Mesh across the GKE clusters, and manually clean up Artifact Registry images.
  4. Adopt Cloud Deploy for managing deployments, and schedule a Cloud Build job for container image cleanup.

Key Takeaways

The main trap is choosing custom scripting over managed services; Cloud Deploy provides native rollback automation, while Artifact Registry cleanup policies offer zero-overhead image retention management.

Learn how to resolve production deployment failures and image bloat in GKE by adopting Cloud Deploy for native rollout management and using Artifact Registry cleanup policies for automated maintenance.

Common mistake: Choosing Option A (Cloud Build rollback pipeline) is common because teams may already use Cloud Build, but it misses the dedicated deployment orchestration and native cleanup features provided by Cloud Deploy and Artifact Registry policies.

Expert Analysis

Native Rollout and Rollback Management The scenario describes a CI/CD pipeline using Cloud Build and Artifact Registry, but lacks a dedicated deployment orchestration tool for GKE. The failure stems from untested integration functionality reaching production, necessitating a disruptive manual rollback. To solve this, you need a service that provides native promotion controls between environments (dev, pre-prod, prod) and automated rollback capabilities. Cloud Deploy is Google's managed service specifically designed for this purpose. It allows you to define delivery pipelines with approval gates and automatic rollbacks if health checks fail, eliminating the need for manual intervention during failures.

Automated Image Cleanup Regarding the accumulation of old container images in Artifact Registry, the most efficient and Google-recommended approach is to use cleanup policies. These policies can be configured to automatically delete images based on criteria such as age, tag patterns, or number of retained versions. This is superior to scheduling custom Cloud Build jobs (Option D) because it is a zero-overhead, native feature integrated directly into Artifact Registry, reducing operational complexity and potential errors in custom scripts.

Why Other Options Are Incorrect

  • Option A suggests setting up a rollback pipeline in Cloud Build. While possible, this requires significant custom scripting and does not provide the streamlined, native rollout management that Cloud Deploy offers.
  • Option C proposes using Cloud Service Mesh. While Istio (part of Cloud Service Mesh) can handle traffic shifting and rollbacks, it adds significant infrastructure overhead and complexity compared to Cloud Deploy for simple application deployment lifecycle management. Manual cleanup is also inefficient.
  • Option D uses Cloud Deploy correctly but relies on a scheduled Cloud Build job for cleanup. This is less optimal than native cleanup policies, which are simpler and more reliable.

The comments support this by highlighting Cloud Deploy for its native rollout/rollback features and Artifact Registry cleanup policies as the zero-overhead solution.

Exam Strategy

When a question mentions 'manual rollback' or 'deployment failures', look for managed deployment orchestration tools like Cloud Deploy rather than custom CI/CD script fixes. For storage cleanup tasks in Google Cloud, always prefer native, serverless features (like Artifact Registry policies) over scheduled compute jobs unless specific complex logic is required.

Frequently Asked Questions

What is the primary benefit of Cloud Deploy over Cloud Build for GKE?

Cloud Deploy provides native rollout and rollback management with automated health checks and approval gates, whereas Cloud Build requires custom scripting to manage deployment lifecycles.

How do Artifact Registry cleanup policies work?

They allow you to automatically delete container images based on rules like age, tag patterns, or the number of retained versions, without needing custom scripts or scheduled jobs.

More PCDOE FAQ →

Discussion 1 contributions

Compiled from public community threads and reader submissions, lightly edited for clarity. Handles and vote tallies are shown as recorded, and comments reflect the views of individual contributors.

From public community threads 1

  1. BlackCoffee 👍 1 Answered B
    Native Rollout and Rollback Management with Cloud Deploy. Artifact Registry cleanup policies are the Google-recommended, zero-overhead solution.

Reader comments & corrections

No reader corrections yet — spotted an error or have a note? Share it below.

Log in to comment, report an error, or add a note about this question.

Submitted for moderation before publishing. Keep it helpful and respectful.

Practice All PCDOE Questions

Access 75 questions with complete answers and detailed explanations.

View Full PCDOE Practice Test →

← Back to PCDOE Study Guide