Continuous Delivery in Kubernetes

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 33

Continuous Delivery in Kubernetes

Sandeep Parikh
@crcsmnky
Solutions Architect
Google Cloud Platform
Why Is This Important
Bulletproof process to go from code to production

Centralized, repeatable building/tagging/pushing

Iterate quickly and reliably

Hands off my kubectl


Continuous Integration
The ideal development flow

Code Test Commit Push Build Test


Continuous Integration
The ideal development flow

Code Test Commit Push Build Test

The real development flow

Test Build Test


Code Commit Push
D’oh! Whoops! Crap!
Continuous Delivery

Testing

Build Test Deploy

Staging
Continuous Deployment

Deliver Approve Deploy Profit


Why Continuous?
Fail fast

I broke the build!

Blame fast

Who broke the build?

Deliver faster

Better software in customers hands!


Tools
Jenkins
Kubernetes Cluster

Node 1 Node 2 Node 3

Kubernetes Cluster (GKE)


Jenkins Leader

Jenkins
Leader

Node 1 Node 2 Node 3

Kubernetes Cluster (GKE)


Jenkins Service

Jenkins Jenkins
Service Leader

Node 1 Node 2 Node 3

Kubernetes Cluster (GKE)


Jenkins Builder

Jenkins Jenkins
Service Leader

Jenkins Jenkins Jenkins Jenkins Jenkins


Builder Builder Builder Builder Builder

Node 1 Node 2 Node 3

Kubernetes Cluster (GKE)


Jenkins Proxy

Jenkins Jenkins
nginx
Service Leader

Jenkins Jenkins Jenkins Jenkins Jenkins


Builder Builder Builder Builder Builder

Node 1 Node 2 Node 3

Kubernetes Cluster (GKE)


Jenkins Proxy Service

nginx Jenkins Jenkins


nginx
Service Service Leader

Jenkins Jenkins Jenkins Jenkins Jenkins


Builder Builder Builder Builder Builder

Node 1 Node 2 Node 3

Kubernetes Cluster (GKE)


Microservices
Microservices

Frontend Backend
Service Service

Backend Backend Backend

Frontend Frontend Frontend

Node 1 Node 2

Kubernetes Cluster (GKE)


Microservices & Namespaces
Virtual clusters backed by the same physical cluster

Divide cluster resources by different use cases

Supports quotas for managing resources

Test, Staging, Production, etc.


Microservices & Rolling Update
Replace Replication Controller A with Replication Controller B by updating one Pod
at a time.
Pods

A B
A B
A B
B A
B A
B A
Time
Workflow
Kubernetes Workflow

Package Push Create Expose


Mapping To Jenkins
Workflow plugin, Freestyle doesn’t fit

Define a flexible, extensible, script-based CD pipeline

Groovy for scripting actions

Supports human input/approval


Workflow
Github Kubernetes Cluster (GKE)

Default Staging

µservice

Repo Jenkins
Production

µservice
Workflow
Github Kubernetes Cluster (GKE)
1 Push
Default Staging

µservice

1 Repo Jenkins
Production

µservice
Workflow
Github Kubernetes Cluster (GKE)
1 Push
Default Staging

2 Build
µservice

1 Repo 2 Jenkins
Production

µservice
Workflow
Github Kubernetes Cluster (GKE)
1 Push
Default Staging

2 Build
µservice

3 Clone
1 Repo 2 Jenkins
Production

3 µservice
Workflow
Github Kubernetes Cluster (GKE)
1 Push
Default Staging

2 Build
4 µservice

3 Clone
1 Repo 2 Jenkins
Production
4 Stage

3 µservice
Workflow
Github Kubernetes Cluster (GKE)
1 Push
Default Staging

2 Build
4 µservice

3 Clone
1 Repo 2 Jenkins
Production
4 Stage

3 µservice
5 Approve

5
Workflow
Github Kubernetes Cluster (GKE)
1 Push
Default Staging

2 Build
4 µservice

3 Clone
1 Repo 2 Jenkins
Production
4 Stage

3 6 µservice
5 Approve

6 Deploy

5
Demo
Come find me after the talk and I
promise I’ll run it live :)
Shout Out

Give Evan Brown (@evanbrown) a high-five next time you see him. He’s
super smart and got this whole thing working.
Resources
Questions, Comments
@crcsmnky
Repo
https://github.com/GoogleCloudPlatform/continuous-deployment-on-kubernetes
Docs
Automated Image Builds with Jenkins, Packer, and Kubernetes
Distributed Load Testing using Kubernetes
Real-time data analysis with Kubernetes, Google Cloud Pub/Sub, and BigQuery
Real-time data analysis with Kubernetes, Redis, and BigQuery

You might also like