Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Proprietary + ConfidentialProprietary + Confidential
Continuous Deployment
With Jenkins
On Kubernetes
A Very
Special
Thank You,
@vicnastea
Source: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis non erat sem
Proprietary + Confidential
Evan Brown
●...
Proprietary + ConfidentialProprietary + Confidential
Proprietary + Confidential
Agenda
Deploying Jenkins to Kubernetes
Jen...
Proprietary + ConfidentialProprietary + Confidential
Proprietary + Confidential
Deploying Jenkins
Source: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis non erat sem
Proprietary + Confidential
Deploying Je...
Source: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis non erat sem
Proprietary + Confidential
Jenkins Mast...
Source: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis non erat sem
Proprietary + Confidential
Jenkins Mast...
Source: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis non erat sem
Proprietary + Confidential
Jenkins Mast...
Source: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis non erat sem
Proprietary + Confidential
Jenkins Ingr...
Source: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis non erat sem
Proprietary + Confidential
Jenkins Exec...
Source: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis non erat sem
Proprietary + Confidential
Kubernetes P...
Source: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis non erat sem
Proprietary + Confidential
Jenkins Pod
...
Source: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis non erat sem
Proprietary + Confidential
Kubernetes P...
Proprietary + ConfidentialProprietary + Confidential
Proprietary + Confidential
Jenkins Pipelines
Source: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis non erat sem
Proprietary + Confidential
Jenkins Pipe...
Source: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis non erat sem
Proprietary + Confidential
Jenkins Pipe...
Source: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis non erat sem
Proprietary + Confidential
Jenkins Pipe...
Proprietary + ConfidentialProprietary + Confidential
Proprietary + Confidential
Continuous
Deployment
Source: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis non erat sem
Proprietary + Confidential
Canary Deplo...
Source: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis non erat sem
Proprietary + Confidential
Kubernetes C...
Source: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis non erat sem
Proprietary + Confidential
Canary Deplo...
Source: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis non erat sem
Proprietary + Confidential
Canary Deplo...
Proprietary + ConfidentialProprietary + Confidential
Proprietary + Confidential
Developer Workflow
Example
Deploy canary t...
Source: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis non erat sem
Proprietary + Confidential
Sample App
K...
Tutorial and Sample App
github.com/GoogleCloudPlatform/continuous-deployment-on-kubernetes
THANK YOU
@evandbrown
Upcoming SlideShare
Loading in …5
×

Continuous Deployment with Jenkins on Kubernetes

3,320 views

Published on

Google Senior Software Engineer Evan Brown's presentation from the March 18, 2016 Seattle Kubernetes meetup hosted by StackPointCloud. Evan shows how you deploy Jenkins into Kubernetes, then takes us through CD and canary deployments. Join us in Seattle: http://www.meetup.com/Seattle-Kubernetes-Meetup/

Published in: Internet

Continuous Deployment with Jenkins on Kubernetes

  1. 1. Proprietary + ConfidentialProprietary + Confidential Continuous Deployment With Jenkins On Kubernetes
  2. 2. A Very Special Thank You, @vicnastea
  3. 3. Source: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis non erat sem Proprietary + Confidential Evan Brown ● Software Engineer, Google ● @evandbrown
  4. 4. Proprietary + ConfidentialProprietary + Confidential Proprietary + Confidential Agenda Deploying Jenkins to Kubernetes Jenkins Pipelines Continuous Deployment on Kubernetes Canary Deployments
  5. 5. Proprietary + ConfidentialProprietary + Confidential Proprietary + Confidential Deploying Jenkins
  6. 6. Source: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis non erat sem Proprietary + Confidential Deploying Jenkins to Kubernetes
  7. 7. Source: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis non erat sem Proprietary + Confidential Jenkins Master
  8. 8. Source: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis non erat sem Proprietary + Confidential Jenkins Master Definition apiVersion: extensions/v1beta1 kind: Deployment metadata: name: jenkins namespace: jenkins spec: replicas: 1 template: metadata: labels: app: master spec: containers: - name: master image: jenkins:1.642.4 ports: - containerPort: 8080 - containerPort: 50000 env: volumeMounts: - mountPath: /var/jenkins_home name: jenkins-home volumes: - name: jenkins-home gcePersistentDisk: pdName: jenkins-home fsType: ext4 partition: 1
  9. 9. Source: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis non erat sem Proprietary + Confidential Jenkins Master
  10. 10. Source: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis non erat sem Proprietary + Confidential Jenkins Ingress Definition apiVersion: extensions/v1beta1 kind: Ingress metadata: name: jenkins namespace: jenkins spec: tls: - secretName: tls backend: serviceName: jenkins-ui servicePort: 8080
  11. 11. Source: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis non erat sem Proprietary + Confidential Jenkins Executors
  12. 12. Source: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis non erat sem Proprietary + Confidential Kubernetes Plugin ● Map pod templates to Jenkins labels ● Spins up/down pods on demand (per build) ● Bring your own Docker image ● Use k8s service account credentials for authentication
  13. 13. Source: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis non erat sem Proprietary + Confidential Jenkins Pod Definition
  14. 14. Source: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis non erat sem Proprietary + Confidential Kubernetes Plugin Thank you Carlos Sanchez @csanchez
  15. 15. Proprietary + ConfidentialProprietary + Confidential Proprietary + Confidential Jenkins Pipelines
  16. 16. Source: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis non erat sem Proprietary + Confidential Jenkins Pipelines Build Test DeployDevelop Observe Flexible Reproducible Auditable
  17. 17. Source: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis non erat sem Proprietary + Confidential Jenkins Pipelines node { def project = 'vic-goog' def appName = 'gceme' def feSvcName = "${appName}-frontend" def imageTag = "gcr.io/${project}/${appName}:${env.BUILD_NUMBER}" checkout scm stage 'Build image' sh("docker build -t ${imageTag} .") stage 'Run Go tests' sh("docker run ${imageTag} go test") stage 'Push image to registry' sh("gcloud docker push ${imageTag}") stage "Deploy Application" sh("sed -i.bak 's#IMAGE_NAME#${imageTag}#' ./k8s/*.yaml") sh("kubectl --namespace=production apply -f k8s/") }
  18. 18. Source: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis non erat sem Proprietary + Confidential Jenkins Pipelines
  19. 19. Proprietary + ConfidentialProprietary + Confidential Proprietary + Confidential Continuous Deployment
  20. 20. Source: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis non erat sem Proprietary + Confidential Canary Deployments in Kubernetes kind: Service apiVersion: v1 metadata: name: frontend spec: type: LoadBalancer ports: - name: http port: 80 targetPort: 80 protocol: TCP selector: app: awesome-stuff role: frontend kind: Deployment apiVersion: extensions/v1beta1 metadata: name: frontend-prod spec: replicas: 90 template: metadata: name: frontend labels: app: awesome-stuff role: frontend env: prod spec: containers: - name: frontend image: my-img:v1 ports: - name: ui containerPort: 80 kind: Deployment apiVersion: extensions/v1beta1 metadata: name: frontend-staging spec: replicas: 10 template: metadata: name: frontend labels: app: awesome-stuff role: frontend env: staging spec: containers: - name: frontend image:my-img:v2 ports: - name: ui containerPort: 80
  21. 21. Source: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis non erat sem Proprietary + Confidential Kubernetes CD Pipeline Overview
  22. 22. Source: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis non erat sem Proprietary + Confidential Canary Deployments in Kubernetes kind: Service apiVersion: v1 metadata: name: frontend spec: type: LoadBalancer ports: - name: http port: 80 targetPort: 80 protocol: TCP selector: app: awesome-stuff role: frontend kind: Deployment apiVersion: extensions/v1beta1 metadata: name: frontend-prod spec: replicas: 90 template: metadata: name: frontend labels: app: awesome-stuff role: frontend env: prod spec: containers: - name: frontend image: my-img:v1 ports: - name: ui containerPort: 80 kind: Deployment apiVersion: extensions/v1beta1 metadata: name: frontend-staging spec: replicas: 10 template: metadata: name: frontend labels: app: awesome-stuff role: frontend env: staging spec: containers: - name: frontend image:my-img:v2 ports: - name: ui containerPort: 80
  23. 23. Source: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis non erat sem Proprietary + Confidential Canary Deployments in Kubernetes kind: Service apiVersion: v1 metadata: name: frontend spec: type: LoadBalancer ports: - name: http port: 80 targetPort: 80 protocol: TCP selector: app: awesome-stuff role: frontend kind: Deployment apiVersion: extensions/v1beta1 metadata: name: frontend-prod spec: replicas: 90 template: metadata: name: frontend labels: app: awesome-stuff role: frontend env: prod spec: containers: - name: frontend image: my-img:v1 ports: - name: ui containerPort: 80 kind: Deployment apiVersion: extensions/v1beta1 metadata: name: frontend-staging spec: replicas: 10 template: metadata: name: frontend labels: app: awesome-stuff role: frontend env: staging spec: containers: - name: frontend image:my-img:v2 ports: - name: ui containerPort: 80
  24. 24. Proprietary + ConfidentialProprietary + Confidential Proprietary + Confidential Developer Workflow Example Deploy canary to staging Deploy new features Rollback
  25. 25. Source: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis non erat sem Proprietary + Confidential Sample App Kubernetes Cluster Node 2Node 1 Backend Frontend Frontend Backend Service Frontend Frontend Service Backend Backend
  26. 26. Tutorial and Sample App github.com/GoogleCloudPlatform/continuous-deployment-on-kubernetes
  27. 27. THANK YOU @evandbrown

×