Cloud Deploy: Delivery Pipelines, Rollbacks, and Skaffold Integration
A production-focused guide to Cloud Deploy: Delivery Pipelines, Rollbacks, and Skaffold Integration on Google Cloud Platform..
20+ years shipping production infrastructure and CI/CD at scale. Everything here is grounded in real deployments.
- ✓Google Cloud project with billing enabled, gcloud CLI installed and configured, kubectl, Skaffold v2.0+, GKE cluster(s) for each target, Cloud Build API enabled, Cloud Deploy API enabled, IAM roles: Cloud Deploy Service Agent, Container Developer, Cloud Build Service Account.
Cloud Deploy: Delivery Pipelines, Rollbacks, and Skaffold Integration is like having a specialized tool that handles cloud deploy so you don't have to build and manage it yourself — it just works out of the box with Google Cloud's infrastructure.
You've built a perfect CI pipeline. Code merges, tests pass, artifacts are built. Then your deployment to production silently breaks the checkout flow, and you spend 45 minutes manually reverting a Helm chart. That's the gap Cloud Deploy fills: it's not just about pushing artifacts—it's about orchestrating the rollout with gated promotions, automated rollbacks, and integration with Skaffold to keep your build and deploy in sync. Most teams treat deployment as an afterthought; the ones that don't sleep better. Cloud Deploy forces you to define explicit delivery pipelines with verification steps, so a bad release never reaches production without a fight. This isn't a CI/CD overview—it's a deep dive into how to structure your delivery pipeline for reliability, using Cloud Deploy and Skaffold together.
The Anatomy of a Delivery Pipeline
A delivery pipeline in Cloud Deploy is a series of targets (e.g., dev, staging, prod) connected by promotion rules. Each target can have a verification mechanism—like a Cloud Build test or a custom Skaffold deploy—that must pass before promotion. The pipeline is defined in a YAML file that references Skaffold configurations for each target. This separation of concerns means your build logic stays in Skaffold, while Cloud Deploy handles the orchestration and rollback. A common mistake is to treat the pipeline as a linear sequence; instead, design it with parallel verification steps and approval gates for production. For example, you might have a 'canary' target that runs a subset of traffic before full rollout. The pipeline definition is immutable after creation, so plan your target names and ordering carefully.
Skaffold as the Deploy Engine
Skaffold is the tool that Cloud Deploy uses to actually run the deployment. It handles building container images, applying Kubernetes manifests, and managing the deploy lifecycle. In the context of Cloud Deploy, Skaffold runs in a Cloud Build step triggered by a release. The Skaffold configuration (skaffold.yaml) defines the build and deploy steps, and Cloud Deploy passes environment-specific profiles (e.g., dev, staging) to customize the deployment. This integration means you can test your deployment locally with Skaffold and then use the same configuration in production. A critical detail: Cloud Deploy uses Skaffold's 'render' and 'apply' commands, so your skaffold.yaml must support those. Avoid using custom build steps that aren't idempotent—Cloud Deploy may retry deployments on failure.
Creating a Release and Promoting
A release in Cloud Deploy is a snapshot of the source code and Skaffold configuration at a point in time. You create a release from a specific commit or tag, and Cloud Deploy automatically renders the manifests and deploys to the first target (e.g., dev). Promotion moves the release to the next target, optionally requiring approval. The promotion can be manual or automated via Cloud Build triggers. A key feature is the ability to specify a 'skaffold version' per release, ensuring reproducibility. When promoting, Cloud Deploy re-renders the manifests using the target's profile, so the same release can produce different manifests for different environments. This is powerful but can lead to surprises if your profiles are not consistent.
Automated Rollbacks on Failure
Cloud Deploy can automatically roll back a deployment if the verification step fails. Verification is defined per target and can be a Cloud Build test, a custom Skaffold deploy, or a Cloud Deploy 'verify' job. When a rollout fails verification, Cloud Deploy automatically rolls back to the previous successful rollout. This is not a simple revert—it re-applies the previous release's manifests. The rollback is atomic and audited. However, automatic rollback is not a substitute for proper canary analysis; it only triggers on explicit verification failures. If your verification is weak (e.g., a simple HTTP check that passes even when the app is broken), the rollback won't save you. Design verification to be as close to production traffic as possible.
Manual Rollbacks and Rollforward
Sometimes automatic rollback isn't enough—you need to manually roll back to a specific release or roll forward to a fix. Cloud Deploy supports manual rollback by creating a new rollout from a previous release. You can also 'roll forward' by creating a new release with the fix and promoting it. The key is that rollbacks are not destructive; they create a new rollout that applies the old manifests. This means you can roll back multiple times. However, if your database schema has changed, a rollback might not be safe. Always test rollbacks in staging first. A common pattern is to keep the last N releases available for quick rollback.
Canary Deployments with Cloud Deploy
Cloud Deploy supports canary deployments by defining multiple targets for the same environment (e.g., prod-canary, prod-stable). You promote to the canary target first, run verification, and then promote to stable. This is not a native canary analysis (like traffic splitting), but a sequential promotion. For true canary analysis, you need to integrate with a service mesh or Cloud Deploy's rollout strategies. Cloud Deploy also supports 'deployment strategies' like 'canary' and 'blue-green' via Skaffold's custom deploy. However, the simplest approach is to have a separate canary cluster and use Cloud Deploy's promotion gates to control traffic. This pattern is common for high-risk deployments.
Integrating with Cloud Build for CI
Cloud Deploy is often triggered by Cloud Build after a successful CI pipeline. The typical flow: Cloud Build builds the image, runs tests, then creates a Cloud Deploy release and promotes it to dev. This is done using the gcloud deploy commands in a Cloud Build step. You can also use Cloud Build to run verification steps. A common mistake is to put too much logic in Cloud Build; keep it simple: build, test, release. The release creation should be a separate step that can be retried independently. Use Cloud Build's substitution variables to pass the image tag and commit SHA.
Handling Multi-Environment Configurations
Managing environment-specific configurations (e.g., different replica counts, secrets, or feature flags) is a common challenge. Cloud Deploy handles this through Skaffold profiles and Kustomize overlays. Each target can have a different profile that applies patches to the base manifests. For secrets, use Google Cloud Secret Manager and reference them in your manifests via environment variables or volume mounts. Avoid storing secrets in the repository. A robust pattern is to have a base set of manifests and overlay directories for each environment. Cloud Deploy will render the correct manifests based on the target's profile.
Monitoring and Auditing Deployments
Cloud Deploy integrates with Cloud Logging and Cloud Monitoring to provide visibility into deployments. Each rollout creates log entries that show the state changes, verification results, and any errors. You can set up alerts on rollout failures or rollbacks. For auditing, Cloud Deploy records who created releases and approved promotions. This is essential for compliance. A common gap is not monitoring the verification step itself—if the verification fails silently, you won't know until the rollback happens. Use Cloud Monitoring to track rollout duration and success rate.
Advanced: Custom Deploy Strategies with Skaffold
For complex deployments (e.g., blue-green, canary with traffic splitting), you can use Skaffold's custom deploy actions. Cloud Deploy supports custom Skaffold deploy by specifying a 'deploy' section in the skaffold.yaml that runs a script. This script can interact with a service mesh like Istio or use Cloud Deploy's rollout strategies. However, this adds complexity and should be used only when necessary. A simpler approach is to use Cloud Deploy's built-in 'canary' strategy, which is available for GKE targets. This strategy automatically creates a canary deployment and scales it up while monitoring.
Canary Deployment Strategy: Phased Rollouts
Cloud Deploy supports canary deployments with phased rollouts. A canary rollout deploys to a percentage of traffic first (e.g., 25%), then advances to 50%, then 100% (stable). Each phase has a deploy job and optional verify job. The phases are named canary-25, canary-50, and stable. On the first deployment to a target (no existing version), the canary phases are skipped and the app deploys directly to stable. After that, canary deployments work as expected. You can configure custom percentages and custom-automated canaries. Production insight: always enable verification on canary phases. We deployed a canary that passed the deploy step but failed the verify step due to elevated error rates. The rollout was automatically halted before reaching 100%. This caught a regression that would have affected all users.
Parallel Deployment: Multi-Target Simultaneous Rollouts
Cloud Deploy supports parallel deployment, allowing you to deploy to multiple targets simultaneously (e.g., deploy to us-central1 and europe-west1 at the same time). This is configured using a multiTarget type or by defining parallel stages in the pipeline. Parallel deployment reduces rollout time for multi-region applications. However, it increases risk—a failure in one region can affect the entire deployment. Use parallel deployment for stateless, region-independent services. For stateful or region-coupled services, use sequential deployment. Production insight: we use parallel deployment for our CDN edge service—it must be updated in all regions simultaneously to avoid cache inconsistency. For the database migration service, we use sequential deployment to avoid split-brain scenarios.
Cloud Run Deployer with Skaffold
Cloud Deploy now supports Cloud Run as a target runtime (in addition to GKE and Anthos). This is configured via Skaffold's Cloud Run deployer, which uses the serving.knative.dev/v1 schema. The setup is similar to GKE: you define a delivery pipeline with targets, and Cloud Deploy uses Skaffold's Cloud Run deployer to apply the manifests. This enables progressive delivery (canary) and rollbacks for Cloud Run services. Production insight: Cloud Run's automatic scaling combined with Cloud Deploy's canary deployment creates a powerful combination. We deploy a new revision to 25% of traffic, run verification tests, then promote to 100%. If the verification fails, Cloud Deploy rolls back automatically. This is much simpler than manual traffic splitting.
Troubleshooting Common Failures
Common failures in Cloud Deploy include: permission errors (the Cloud Deploy service account lacks permissions to deploy to the cluster), Skaffold rendering errors (e.g., invalid YAML), and verification timeouts. The first step is to check the rollout logs in Cloud Logging. For Skaffold errors, run skaffold render locally with the same profile. For permission issues, ensure the Cloud Deploy service account has the 'container.developer' role on the cluster. Another common issue is that the release source does not include the skaffold.yaml file—Cloud Deploy requires it at the root of the source directory.
| File | Command / Code | Purpose |
|---|---|---|
| delivery-pipeline.yaml | apiVersion: deploy.cloud.google.com/v1 | The Anatomy of a Delivery Pipeline |
| skaffold.yaml | apiVersion: skaffold/v4beta6 | Skaffold as the Deploy Engine |
| create-release.sh | gcloud deploy releases create my-release-001 \ | Creating a Release and Promoting |
| target-with-verify.yaml | apiVersion: deploy.cloud.google.com/v1 | Automated Rollbacks on Failure |
| manual-rollback.sh | gcloud deploy rollouts create rollback-001 \ | Manual Rollbacks and Rollforward |
| canary-pipeline.yaml | serialPipeline: | Canary Deployments with Cloud Deploy |
| cloudbuild.yaml | steps: | Integrating with Cloud Build for CI |
| kustomization.yaml | apiVersion: kustomize.config.k8s.io/v1beta1 | Handling Multi-Environment Configurations |
| list-rollouts.sh | gcloud deploy rollouts list \ | Monitoring and Auditing Deployments |
| skaffold-custom-deploy.yaml | deploy: | Advanced |
| canary-strategy.yaml | apiVersion: deploy.cloud.google.com/v1 | Canary Deployment Strategy |
| parallel-deploy.yaml | apiVersion: deploy.cloud.google.com/v1 | Parallel Deployment |
| skaffold-cloudrun.yaml | apiVersion: skaffold/v4beta6 | Cloud Run Deployer with Skaffold |
| debug-rollout.sh | gcloud deploy rollouts describe rollout-abc \ | Troubleshooting Common Failures |
Key takeaways
Common mistakes to avoid
3 patternsIgnoring gcp cloud deploy best practices
Over-provisioning without rightsizing analysis
Skipping IAM least-privilege principles
Interview Questions on This Topic
What is Cloud Deploy: Delivery Pipelines, Rollbacks, and Skaffold Integration and when would you use it in production?
Frequently Asked Questions
20+ years shipping production infrastructure and CI/CD at scale. Everything here is grounded in real deployments.
That's Google Cloud. Mark it forged?
6 min read · try the examples if you haven't