@BastianHofmannCI/CD with KubernetesBastian Hofmann[email protected]
View Slide
Continuous Integration
Continuous Delivery
Container orchestration platform
Deploy, run and scale your servicesin isolated containers
No vendor lock in
Standardized APIs
Runs on
Your laptop
Bare metal
Cloud Providers
And if you don't want to install andmaintain Kubernetes yourself
Managed Kubernetes
So we have code, how do we get thisinto Kubernetes?
Lot's of tools
Example for this talk
Example application
https://gitlab.com/bashofmann/angular-test-app
https://gitlab.com/bashofmann/angular-test-app-finished
Pipeline with multiple stages, eachstage can have multiple jobs
Stage 1:Preparing
Stage 2:Linters and Tests
Stage 3:Building an image
Stage 4: On master:Deploying to Kubernetes into a stagenamespace
Stage 5: On master:Testing if stage works
Stage 6: On tag:Tag the docker image
Stage 7: On tag:Deploying to Kubernetes into a prodnamespace
Stage 8: On tag:Testing if prod works
In detail
Only do slow operations once andcache and re-use results
Add linters for everything
Unit tests
Integration tests
Browser tests
Make the build as fast as possible
Make the image as small as possible
Use a versioning scheme
Never deploy "latest"
Use Kubernetes namespaces
Use Helm or similar tools
Make use of Kubernetes "magic"
Sealed Secrets
Secrets are stored encrypted in Gitand encrypted inside of the cluster
LoadBalancers
Automatically creates a highlyavailable LoadBalancer with apublic IP address
Ingress controller
The ingress controller (nginx) listenson routing rules in Ingress Resourcesand configures itself to routeincoming traffic to the correctrunning and healthy pods
cert-manager
Cert-manager listens on IngressResources and if they need TLS,requests a certificate fromLetsEncrypt
external-dns
External-DNS listens on IngressResources and creates DNS entries
Prometheus
Kubernetes and Node metrics areautomatically included
Kubernetes and Node alerts areautomatically included
Kubernetes and Node dashboardsare automatically included
Scraping targets can beautomatically discovered
Service Meshes
Alternatives
Flux
Knative
Kubernetes-based platform todeploy and manage modernserverless workloads
Tekton CD
CI that runs completely withinKubernetes with Kubernetes CustomResources
[email protected]https://twitter.com/BastianHofmannhttp://speakerdeck.com/u/bastianhofmann