- Building Google Cloud Platform Solutions
- Ted Hunter Steven Porter Legorie Rajan PS
- 148字
- 2025-04-04 14:47:42
Rolling back updates
There will always be situations, for one reason or another, where deployments don't execute exactly as planned. In those scenarios, the need exists to revert quickly and easily to a previous working deployment. As with most things GCP, you have multiple options for how you execute rollbacks. The cloud console provides a dashboard that lists all of your deployed GKE workloads as well as the revision history for each workload.
The cloud console is great for R&D work or just playing around to learn about the features of GKE. For enterprise workloads, you will want to used scripted deployments and updates using a combination of the Kubernetes CLI and manifest files:
kubectl rollout undo deployment/$(DEPLOYMENT_NAME)
In addition to rolling back to the last good deployment, the Kubernetes CLI also gives us the ability to roll back to a specific deployment:
kubectl rollout undo deployment/$(DEPLOYMENT_NAME) --to-revision=2