Cloud-native is an approach to building and running applications
that fully exploits the advantages of the cloud computing model.
https://12factor.net - https://pivotal.io/cloud-native
● Handle of application dependencies
● Dev/prod environments parity
● Orchestrate services
● Make easy to deploy to cloud clustered environments
Continuous integration is a tough job...
Continuous delivery is a software engineering approach to ensure
that the software can be reliably released at any time.
CD Continuous delivery
Continuous deployment is a software engineering approach to ensure
that the every change is automatically deployed to production.
CD Continuous deployment
Kubernetes
● A system for container management in a clustered environment, open sourced by
Google and inspired by the Borg project.
● Multiple container engines (Docker, rkt, OCI), mainly based on Docker.
● Provides grouping, load balancing, scaling, monitoring and scheduling features
with an unified and declarative API.
● 100% open source and written in GO - https://github.com/kubernetes/kubernetes
Kubernetes the hard way: Custom installers
Kubernetes installation is fairly complex, pick up the right solution:
https://kubernetes.io/docs/setup/pick-right-solution
https://github.com/kubernetes/kubeadm - https://github.com/kubernetes/kops
Kubernetes the easier way: Google GKE
One-click Kubernetes clusters, managed by Google:
https://cloud.google.com/container-engine
Kubernetes the easy way: Google GKE
● Fully managed HA Kubernetes cluster (free up to 5 nodes)
● Logging and monitoring included (Stackdriver)
● Private container registry - https://cloud.google.com/container-registry/
● Automatic and configurable cluster scaling
Kubernetes the easy way: Google GKE
gcloud container clusters list
NAME ZONE MASTER_VERSION MASTER_IP MACHINE_TYPE NODE_VERSION NUM_NODES STATUS
My-testing-clust europe-west1-b 1.5.6 172.199.00.000 n1-standard-1 1.5.6 2 RUNNING
Gitlab
The platform for modern developers
GitLab unifies issues, code review, CI and CD into a single UI
https://about.gitlab.com
Gitlab Runner
The fully integrated solution to build test
and deploy your code.
https://about.gitlab.com/gitlab-ci/
Gitlab Runner
● It is the daemon that run the jobs and send the results back to Gitlab
● One single binary written in GO, very easy to deploy
● Allows to run multiple jobs concurrently
● Native supports for storing cache and artifacts
● It supports multiple build executors including Kubernetes
● Programmatic pipelines definition using a .gitlab-ci.yml file
Gitlab Kubernetes executor
The Kubernetes executor, connects to the Kubernetes API in the
cluster creating a Pod for each GitLab CI Job.
https://gitlab.com/gitlab-org/gitlab-ci-multi-runner/blob/master/docs/executors/kubernetes.md
Continuous deployment
With environments, you can control the Continuous Deployment of
your software all within GitLab.
https://about.gitlab.com/2016/08/05/continuous-integration-delivery-and-deployment-with-gitlab/
Running Gitlab on Kubernetes
Self hosting Gitlab on Kubernetes
https://gitlab.com/gitlab-org/kubernetes-gitlab-demo
Running Gitlab on Kubernetes tips&tricks
● Segment your cluster by labelling the nodes and use the nodeSelector
● Make a correct use of namespacing for deploying
● Adjust correctly the limits/requests resources of Gitlab executor to help the pod
scheduling
● Keep the k8s templates on version control together with the codebase
● Make a smart use of caches, remember than each job is a clean build env
● Gitlab is an open source project, submit issues and share the fixes
Troubleshooting and debugging
Show gitlab executor pod metrics
> kubectl top pod runner-329d5212-project-255-concurrent-07rxsl -ngitlab --containers
POD NAME CPU(cores) MEMORY(bytes)
runner-329d5212-project-255-concurrent-07rxsl build 1m 35Mi
runner-329d5212-project-255-concurrent-07rxsl helper 0m 13Mi
runner-329d5212-project-255-concurrent-07rxsl svc-0 604m 248Mi