marp |
---|
true |
- Two weeks ago, we talked about containers in general and how they allow encapsulation of an application
- Last week, we did some samples of building a Docker web application on laptops
- Tonight we'll look at how Kubernetes allows us to automate cloud application deployments
- Kubernetes manages a cluster of servers
- It accepts requests to deploy containers
- It tracks resource consumption, and intelligently places containers
- It monitors container health, and restarts failed containers
- It load balances requests across replicas of a container
- It gradually upgrades containers when a new version is deployed
This demo was mostly stolen, but ruined modified to work with a group. The original is available here: https://cloud.google.com/kubernetes-engine/docs/tutorials/gitops-cloud-build
There are many Kubernetes examples available, but they require several accounts from different providers, or having admin credentials to a cluster.
- You should receive and accept an invitation to collaborate on the
k8sdemo
repository - Clone the repository to your computer. DO NOT FORK AND CLONE TONIGHT
git clone https://github.com/ripleymj/k8sdemo
cd k8sdemo
- Check out the demo branch
git checkout demo
- Create a personal branch with
uug-YOURNAME
git checkout -b uug-ripleymj
- Wait here for everyone to catch up
- Push your branch back to GitHub
git push origin uug-YOURNAME
- Let's watch the magic happen
- Google Cloud has a trigger watching the repository for any branch name
uug-*
- The trigger will attempt to run a
cloudbuild.yaml
file in the repository - Cloud Build will run
test_app.py
to verify yourapp.py
application - If the tests pass, the Dockerfile is used to build a container
- If the Dockerfile builds, a
kubernetes.yaml
file is generated from a template to describe your new deployment - Cloud Build commits the deployment file to a 2nd repository to start another trigger
- Edit your
kubernetes.yaml.tpl
and change replicas to 3 - Add, commit, and push your changes
- Watch the cluster adjust when it re-deploys
- Add, commit, push again
- Watch Kubernetes do a gradual deployment