For some Kubernetes cluster operations (e.g. deploying an update to a small microservice or app), I need a quick and dirty way to:
- Build and push a Docker image to a private registry.
- Update a Kubernetes Deployment to use this new image version.
- Wait for the Deployment rollout to complete.
- Run some post-rollout operations (e.g. clear caches, run an update, etc.).
There are a thousand and one ways to do all this, and many are a bit more formal than this, but sometimes you just need a shell script you can run from your CI server to do it all. And it's not too hard, nor complex, to do it this way: