The document discusses continuous integration and delivery (CI/CD) workflows using Kubernetes and Jenkins. It describes using Jenkins to automate the process of building, testing, and deploying code changes to Kubernetes clusters. The workflow includes steps for continuous integration testing, deploying to staging environments, and approving deployments to production with manual approval gates. It provides examples of implementing the workflow using a Jenkinsfile and Kubernetes resources like deployments.
2. 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
4. Continuous Integration
TestCode Commit Push TestBuild
The ideal development flow
Test
D’oh!
Code Commit Push
Test
Crap!
Build
Whoops!
The real development flow
23. 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.
24. Pods
Time
Microservices & Rolling Update Deployments
Replace Replication Controller Deployment A with Replication Controller
Deployment B by updating one Pod at a time.
A
B
A
B
A
B A
B
A
B
A
B
25. Rolling Update vs. Deployments
Imperative vs Declarative
Rollback
kubectl edit and kubectl apply
Server-side
...
28. 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
29. node('docker') {
checkout scm
// Kubernetes cluster info
def cluster = 'gtc'
def zone = 'us-central1-f'
def project = 'REPLACE_WITH_YOUR_PROJECT_NAME'
// Run tests
stage 'Go tests'
docker.image('golang:1.5.1').inside {
sh('go get -d -v')
sh('go test')
}
// Build image with Go binary
stage 'Build Docker image'
def img = docker.build("gcr.io/${project}/gceme:${env.BUILD_TAG}")
sh('gcloud docker -a')
img.push()
Jenkinsfile