continuous delivery with containerskrumba.ch/presentations/2018/all_things_open_2018...jenkins-1...

44
Continuous Delivery with Containers Elizabeth K. Joseph @pleia2 All Things Open 2018

Upload: others

Post on 21-May-2020

10 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Continuous Delivery with Containerskrumba.ch/presentations/2018/All_Things_Open_2018...Jenkins-1 Jenkins-2 GitLab Tests Tests Legacy Infrastructure + Containers Continue running your

Continuous Delivery with Containers

Elizabeth K. Joseph@pleia2

All Things Open 2018

Page 2: Continuous Delivery with Containerskrumba.ch/presentations/2018/All_Things_Open_2018...Jenkins-1 Jenkins-2 GitLab Tests Tests Legacy Infrastructure + Containers Continue running your

Elizabeth K. Joseph@pleia2

[email protected]

Spent the past 2 years working containers with Apache Mesos and Kubernetes

4 years working on CI/CD for OpenStack

10+ years in Linux systems administration and engineering roles

Author of The Official Ubuntu Book and Common OpenStack Deployments

Page 3: Continuous Delivery with Containerskrumba.ch/presentations/2018/All_Things_Open_2018...Jenkins-1 Jenkins-2 GitLab Tests Tests Legacy Infrastructure + Containers Continue running your

Definition: Continuous Delivery

Continuous Delivery (CD) is a software engineering approach in which teams produce software in short cycles, ensuring that the software can be reliably released at any time.

Via https://en.wikipedia.org/wiki/Continuous_delivery

Page 4: Continuous Delivery with Containerskrumba.ch/presentations/2018/All_Things_Open_2018...Jenkins-1 Jenkins-2 GitLab Tests Tests Legacy Infrastructure + Containers Continue running your

Traditional Delivery

Months (or years!) between releases

Customers don’t see new features quickly

Developers lose track of features they worked on

Page 5: Continuous Delivery with Containerskrumba.ch/presentations/2018/All_Things_Open_2018...Jenkins-1 Jenkins-2 GitLab Tests Tests Legacy Infrastructure + Containers Continue running your

Goal: A Modern Release Process with CD

Week 1: Project planning and release

Develop > Test > Stage > Release

Week 2: Customer Feedback and release

Develop > Test > Stage > Release

Week 3: Customer Feedback and release

Develop > Test > Stage > Release

...

Page 6: Continuous Delivery with Containerskrumba.ch/presentations/2018/All_Things_Open_2018...Jenkins-1 Jenkins-2 GitLab Tests Tests Legacy Infrastructure + Containers Continue running your

The CI/CD Pipeline

git push

git repository CI/CD staging production

artifacts

image

test

Page 7: Continuous Delivery with Containerskrumba.ch/presentations/2018/All_Things_Open_2018...Jenkins-1 Jenkins-2 GitLab Tests Tests Legacy Infrastructure + Containers Continue running your

How?

Page 8: Continuous Delivery with Containerskrumba.ch/presentations/2018/All_Things_Open_2018...Jenkins-1 Jenkins-2 GitLab Tests Tests Legacy Infrastructure + Containers Continue running your

Run in containers!

CC BY 2.0: https://www.flickr.com/photos/rubbermaid/6909787969/

Page 9: Continuous Delivery with Containerskrumba.ch/presentations/2018/All_Things_Open_2018...Jenkins-1 Jenkins-2 GitLab Tests Tests Legacy Infrastructure + Containers Continue running your

Organize everything efficiently!

CC BY-ND 2.0: https://www.flickr.com/photos/96227967@N05/24954030641/

Page 10: Continuous Delivery with Containerskrumba.ch/presentations/2018/All_Things_Open_2018...Jenkins-1 Jenkins-2 GitLab Tests Tests Legacy Infrastructure + Containers Continue running your

Sidebar:Can’t I just use VMs for

testing?

Sure! But consider...

● VMs take longer to provision● You may not need all they

provide (kernel, system libraries…)

● An identical container image is simple to run in development, testing, staging and production

Page 11: Continuous Delivery with Containerskrumba.ch/presentations/2018/All_Things_Open_2018...Jenkins-1 Jenkins-2 GitLab Tests Tests Legacy Infrastructure + Containers Continue running your

Bare Metal/VMs vs. Containers

Traditional Datacenter

Siloed servers

Low utilization

12-15% for bare metal

30% for virtual machines

Containerization Platform

Integrated cluster (service discovery, authentication, etc)

Workload multiplexing on the same machines

Page 12: Continuous Delivery with Containerskrumba.ch/presentations/2018/All_Things_Open_2018...Jenkins-1 Jenkins-2 GitLab Tests Tests Legacy Infrastructure + Containers Continue running your

Does everything go in containers? Up to you.

Page 13: Continuous Delivery with Containerskrumba.ch/presentations/2018/All_Things_Open_2018...Jenkins-1 Jenkins-2 GitLab Tests Tests Legacy Infrastructure + Containers Continue running your

Everything Running in Containers

Security &Governance

Container Orchestration

Monitoring & Operations

User Interface & Command Line

GitLab Jenkins Microservice Microservice Microservice

Microservice Artifactory Microservice Prometheus Microservice

Kubernetes, Docker Swarm, Apache Mesos

Services & Containers

Linux ServerLinux Server Linux Server Linux Server

Bare Metal, OpenStack, AWS, Azure, GCP

Page 14: Continuous Delivery with Containerskrumba.ch/presentations/2018/All_Things_Open_2018...Jenkins-1 Jenkins-2 GitLab Tests Tests Legacy Infrastructure + Containers Continue running your

Everything Running in Containers

Traditional Datacenter Containerization Platform

Jenkins-1

Jenkins-2

GitLab

Tests

Tests

Page 15: Continuous Delivery with Containerskrumba.ch/presentations/2018/All_Things_Open_2018...Jenkins-1 Jenkins-2 GitLab Tests Tests Legacy Infrastructure + Containers Continue running your

Legacy Infrastructure + Containers

Continue running your legacy systems on Bare Metal or VMs

Send all tests to a new, independent containerization platform

Tests

Tests

Tests

GitLab

Page 16: Continuous Delivery with Containerskrumba.ch/presentations/2018/All_Things_Open_2018...Jenkins-1 Jenkins-2 GitLab Tests Tests Legacy Infrastructure + Containers Continue running your

Legacy Infrastructure + hosted + Containers

Continue running your legacy systems on Bare Metal or VMs

Send all tests to a new, independent containerization platform

Tests

Tests

Tests

Jenkins

Page 17: Continuous Delivery with Containerskrumba.ch/presentations/2018/All_Things_Open_2018...Jenkins-1 Jenkins-2 GitLab Tests Tests Legacy Infrastructure + Containers Continue running your

Fully hosted with GitHub

Hosted CI/CD system

CircleCI

Travis CI

TeamCity

...

Test on cloud-hosted Kubernetes service:

● Google Kubernetes Engine (GKE)

● Azure Kubernetes Service (AKS)

● Amazon Elastic Container Service for Kubernetes (Amazon EKS)

Page 18: Continuous Delivery with Containerskrumba.ch/presentations/2018/All_Things_Open_2018...Jenkins-1 Jenkins-2 GitLab Tests Tests Legacy Infrastructure + Containers Continue running your

Fully hosted with GitLab.com

Use GitLab.com (hosted GitLab) for repository, artifact store, test runner

And connect it to a cloud-hosted Kubernetes service:

● Google Kubernetes Engine (GKE)● Azure Kubernetes Service (AKS)● Amazon Elastic Container

Service for Kubernetes (Amazon EKS)

Page 19: Continuous Delivery with Containerskrumba.ch/presentations/2018/All_Things_Open_2018...Jenkins-1 Jenkins-2 GitLab Tests Tests Legacy Infrastructure + Containers Continue running your

Or a combination of these!

Page 20: Continuous Delivery with Containerskrumba.ch/presentations/2018/All_Things_Open_2018...Jenkins-1 Jenkins-2 GitLab Tests Tests Legacy Infrastructure + Containers Continue running your

Walkthrough:

Setting up a pipeline on with Auto DevOps

and KubernetesVisit https://docs.gitlab.com/ee/topics/autodevops/quick_start_guide.html

Page 21: Continuous Delivery with Containerskrumba.ch/presentations/2018/All_Things_Open_2018...Jenkins-1 Jenkins-2 GitLab Tests Tests Legacy Infrastructure + Containers Continue running your

Select a project template

Page 22: Continuous Delivery with Containerskrumba.ch/presentations/2018/All_Things_Open_2018...Jenkins-1 Jenkins-2 GitLab Tests Tests Legacy Infrastructure + Containers Continue running your

Set up project with template

Page 23: Continuous Delivery with Containerskrumba.ch/presentations/2018/All_Things_Open_2018...Jenkins-1 Jenkins-2 GitLab Tests Tests Legacy Infrastructure + Containers Continue running your

Enable Kubernetes in Google Cloud

Page 24: Continuous Delivery with Containerskrumba.ch/presentations/2018/All_Things_Open_2018...Jenkins-1 Jenkins-2 GitLab Tests Tests Legacy Infrastructure + Containers Continue running your

“Add Kubernetes Cluster”

Page 25: Continuous Delivery with Containerskrumba.ch/presentations/2018/All_Things_Open_2018...Jenkins-1 Jenkins-2 GitLab Tests Tests Legacy Infrastructure + Containers Continue running your

Create new Cluster on GKE

Page 26: Continuous Delivery with Containerskrumba.ch/presentations/2018/All_Things_Open_2018...Jenkins-1 Jenkins-2 GitLab Tests Tests Legacy Infrastructure + Containers Continue running your

Enter the details for your Kubernetes cluster

Page 27: Continuous Delivery with Containerskrumba.ch/presentations/2018/All_Things_Open_2018...Jenkins-1 Jenkins-2 GitLab Tests Tests Legacy Infrastructure + Containers Continue running your

The cluster exists!

Page 28: Continuous Delivery with Containerskrumba.ch/presentations/2018/All_Things_Open_2018...Jenkins-1 Jenkins-2 GitLab Tests Tests Legacy Infrastructure + Containers Continue running your

Enable Applications

Page 29: Continuous Delivery with Containerskrumba.ch/presentations/2018/All_Things_Open_2018...Jenkins-1 Jenkins-2 GitLab Tests Tests Legacy Infrastructure + Containers Continue running your

Enable GitLab Auto DevOps

Page 30: Continuous Delivery with Containerskrumba.ch/presentations/2018/All_Things_Open_2018...Jenkins-1 Jenkins-2 GitLab Tests Tests Legacy Infrastructure + Containers Continue running your

View pipelines

Page 31: Continuous Delivery with Containerskrumba.ch/presentations/2018/All_Things_Open_2018...Jenkins-1 Jenkins-2 GitLab Tests Tests Legacy Infrastructure + Containers Continue running your

A pipeline!

Page 32: Continuous Delivery with Containerskrumba.ch/presentations/2018/All_Things_Open_2018...Jenkins-1 Jenkins-2 GitLab Tests Tests Legacy Infrastructure + Containers Continue running your

What do these all mean?

Via: https://docs.gitlab.com/ee/topics/autodevops/quick_start_guide.html#deploying-the-application

Page 33: Continuous Delivery with Containerskrumba.ch/presentations/2018/All_Things_Open_2018...Jenkins-1 Jenkins-2 GitLab Tests Tests Legacy Infrastructure + Containers Continue running your

Navigate to deployed application

Page 34: Continuous Delivery with Containerskrumba.ch/presentations/2018/All_Things_Open_2018...Jenkins-1 Jenkins-2 GitLab Tests Tests Legacy Infrastructure + Containers Continue running your

Simple site in production!

Page 35: Continuous Delivery with Containerskrumba.ch/presentations/2018/All_Things_Open_2018...Jenkins-1 Jenkins-2 GitLab Tests Tests Legacy Infrastructure + Containers Continue running your

Metrics! Via Prometheus in the GitLab UI

Page 36: Continuous Delivery with Containerskrumba.ch/presentations/2018/All_Things_Open_2018...Jenkins-1 Jenkins-2 GitLab Tests Tests Legacy Infrastructure + Containers Continue running your

Make a change

Page 37: Continuous Delivery with Containerskrumba.ch/presentations/2018/All_Things_Open_2018...Jenkins-1 Jenkins-2 GitLab Tests Tests Legacy Infrastructure + Containers Continue running your

Tests run again!

Page 38: Continuous Delivery with Containerskrumba.ch/presentations/2018/All_Things_Open_2018...Jenkins-1 Jenkins-2 GitLab Tests Tests Legacy Infrastructure + Containers Continue running your

View console details of jobs running

Page 39: Continuous Delivery with Containerskrumba.ch/presentations/2018/All_Things_Open_2018...Jenkins-1 Jenkins-2 GitLab Tests Tests Legacy Infrastructure + Containers Continue running your

Successfully deployed!

Page 40: Continuous Delivery with Containerskrumba.ch/presentations/2018/All_Things_Open_2018...Jenkins-1 Jenkins-2 GitLab Tests Tests Legacy Infrastructure + Containers Continue running your

Advanced CD Strategies

Page 41: Continuous Delivery with Containerskrumba.ch/presentations/2018/All_Things_Open_2018...Jenkins-1 Jenkins-2 GitLab Tests Tests Legacy Infrastructure + Containers Continue running your

Advanced Strategies: Canary Deployments

“Canary release is a technique to reduce the risk of introducing a new software version in production by slowly rolling out the change to a small subset of users before rolling it out to the entire infrastructure and making it available to everybody.”

https://martinfowler.com/bliki/CanaryRelease.html

Page 42: Continuous Delivery with Containerskrumba.ch/presentations/2018/All_Things_Open_2018...Jenkins-1 Jenkins-2 GitLab Tests Tests Legacy Infrastructure + Containers Continue running your

Advanced Strategies: Blue/Green Deployments

“One of the challenges with automating deployment is the cut-over itself, taking software from the final stage of testing to live production. You usually need to do this quickly in order to minimize downtime. The blue-green deployment approach does this by ensuring you have two production environments, as identical as possible. At any time one of them, let's say blue for the example, is live. As you prepare a new release of your software you do your final stage of testing in the green environment. Once the software is working in the green environment, you switch the router so that all incoming requests go to the green environment - the blue one is now idle.”

https://martinfowler.com/bliki/BlueGreenDeployment.html

Page 43: Continuous Delivery with Containerskrumba.ch/presentations/2018/All_Things_Open_2018...Jenkins-1 Jenkins-2 GitLab Tests Tests Legacy Infrastructure + Containers Continue running your

Advanced tooling exists!

Many containerization platforms allow for enough deployment strategies to define a canary or blue/green strategy yourself.

Tooling like Vamp can also help.

https://vamp.io/documentation/installation/v1.0.0/kubernetes/

https://vamp.io/documentation/installation/v1.0.0/dcos/

Page 44: Continuous Delivery with Containerskrumba.ch/presentations/2018/All_Things_Open_2018...Jenkins-1 Jenkins-2 GitLab Tests Tests Legacy Infrastructure + Containers Continue running your

Questions?Elizabeth K. Joseph

@pleia2

[email protected]

https://princessleia.com/