Prerequisites
- Google Cloud SDK with
gcloudandkubectlinstalled - A Google Cloud project with billing enabled
- Enable the Kubernetes Engine API
1. Configure and Create the Cluster
First, set your Compute Engine zone and create a single-node GKE cluster namedgke-deep-dive.
Cluster provisioning can take a few minutes. You can monitor progress in the Google Cloud Console under Kubernetes Engine > Clusters.
2. Deploy a Simple Nginx Application
Create a Deployment manifestgke-deep-dive-app.yaml with two replicas of Nginx:
3. Perform Rolling Updates
GKE supports in-place rolling updates, ensuring that at least one replica remains available while others are replaced.3.1 Update to Nginx 1.9.1
3.2 Update to Nginx 1.21.0
Perform another image update to observe an in-progress rollout:4. Rollback a Deployment
If a rollout introduces an issue, you can revert to a previous revision.4.1 Rollback to the Previous Revision
4.2 Rollback to a Specific Revision
-
View rollout history:
-
Roll back to revision 1 (original version):
Rolling back to a previous revision may disrupt your application. Always test in a staging environment before rolling back in production.