ci/cd with kubernetes, helm & wercker (#madscalability)
TRANSCRIPT
![Page 1: CI/CD with Kubernetes, Helm & Wercker (#madScalability)](https://reader034.vdocuments.us/reader034/viewer/2022051709/5871adde1a28abda6a8b6017/html5/thumbnails/1.jpg)
CI/CD with Kubernetes, Helm & Wercker
#madScalabilityMadrid
30/11/2016
![Page 2: CI/CD with Kubernetes, Helm & Wercker (#madScalability)](https://reader034.vdocuments.us/reader034/viewer/2022051709/5871adde1a28abda6a8b6017/html5/thumbnails/2.jpg)
About me: Javier Cuevas @javier_dev
AIRBNB FOR DOGS “MAJESTIC” RAILS 3.2 MONOLITH
RUBY ON RAILS SHOP WHO EMBRACED ELIXIR
previously now full time!
![Page 3: CI/CD with Kubernetes, Helm & Wercker (#madScalability)](https://reader034.vdocuments.us/reader034/viewer/2022051709/5871adde1a28abda6a8b6017/html5/thumbnails/3.jpg)
First things first:My review of the new
MacBook Pro with Touch Bar:
Meh 😔
![Page 4: CI/CD with Kubernetes, Helm & Wercker (#madScalability)](https://reader034.vdocuments.us/reader034/viewer/2022051709/5871adde1a28abda6a8b6017/html5/thumbnails/4.jpg)
Disclaimers
1. I learned Docker while learning Kubernetes. I ain’t no expert.
2. Gudog is not at unicorn scale. We’re just at dog scale.
![Page 5: CI/CD with Kubernetes, Helm & Wercker (#madScalability)](https://reader034.vdocuments.us/reader034/viewer/2022051709/5871adde1a28abda6a8b6017/html5/thumbnails/5.jpg)
![Page 6: CI/CD with Kubernetes, Helm & Wercker (#madScalability)](https://reader034.vdocuments.us/reader034/viewer/2022051709/5871adde1a28abda6a8b6017/html5/thumbnails/6.jpg)
NOW LET’S GET STARTED
![Page 7: CI/CD with Kubernetes, Helm & Wercker (#madScalability)](https://reader034.vdocuments.us/reader034/viewer/2022051709/5871adde1a28abda6a8b6017/html5/thumbnails/7.jpg)
A LOOK BACK TO DEVOPS
@ Gudog
![Page 8: CI/CD with Kubernetes, Helm & Wercker (#madScalability)](https://reader034.vdocuments.us/reader034/viewer/2022051709/5871adde1a28abda6a8b6017/html5/thumbnails/8.jpg)
Hosting / Cloud ProvisioningContinuos
Integration Deployments
2013 DigitalOcean SSH all the things 🙀 Jenkins Capistrano
2014 AWS EC2 Rubber Shippable Capistrano
2015 AWS EC2 (OpsWorks) Chef (OpsWorks) Shippable Chef (OpsWorks)
2016Google Container Engine
(GKE)Kubernetes 💙 Wercker Kubernetes + Helm
![Page 9: CI/CD with Kubernetes, Helm & Wercker (#madScalability)](https://reader034.vdocuments.us/reader034/viewer/2022051709/5871adde1a28abda6a8b6017/html5/thumbnails/9.jpg)
Why we choseGoogle Cloud
😱 Because we ran out of AWS credits and we got new credits for Google Cloud.
💸 Because (now that we’re paying for it) is cheaper than AWS.
👌 Because it has the best integration available with Kubernetes.
![Page 10: CI/CD with Kubernetes, Helm & Wercker (#madScalability)](https://reader034.vdocuments.us/reader034/viewer/2022051709/5871adde1a28abda6a8b6017/html5/thumbnails/10.jpg)
Why we choseKubernetes
' Because the guy from Google Cloud told us it was super cool.
🤔 Because we had no idea what that Docker thing was about and we were wondering.
![Page 11: CI/CD with Kubernetes, Helm & Wercker (#madScalability)](https://reader034.vdocuments.us/reader034/viewer/2022051709/5871adde1a28abda6a8b6017/html5/thumbnails/11.jpg)
Why we choseWercker
🚀 Because it was way faster than Shippable running our Slow Rails Test Suite™ .
🤑 Because, as Shippable, it’s free.
✨ Because the UX/UI is so pretty.
![Page 12: CI/CD with Kubernetes, Helm & Wercker (#madScalability)](https://reader034.vdocuments.us/reader034/viewer/2022051709/5871adde1a28abda6a8b6017/html5/thumbnails/12.jpg)
KUBERNETES 101 (IN 3 MINS)
![Page 13: CI/CD with Kubernetes, Helm & Wercker (#madScalability)](https://reader034.vdocuments.us/reader034/viewer/2022051709/5871adde1a28abda6a8b6017/html5/thumbnails/13.jpg)
What is Kubernetes?
• Open-source system for container orchestration and more.
• Works with many cloud providers (Google Cloud, AWS, etc.) and bare metal.
![Page 14: CI/CD with Kubernetes, Helm & Wercker (#madScalability)](https://reader034.vdocuments.us/reader034/viewer/2022051709/5871adde1a28abda6a8b6017/html5/thumbnails/14.jpg)
Basic Kubernetes concepts• Node: a VM or bare metal machine running
Kubernetes.
• Cluster: a bunch of nodes.
• Pod: a group of one or more containers.
• Deployment: defines how many replicas of a Pod you want and how to perform updates (deploys).
• Service: exposes some pods in a given port.
![Page 15: CI/CD with Kubernetes, Helm & Wercker (#madScalability)](https://reader034.vdocuments.us/reader034/viewer/2022051709/5871adde1a28abda6a8b6017/html5/thumbnails/15.jpg)
More about Kubernetes
https://www.youtube.com/watch?v=K_Kh4LMiiqQ
![Page 16: CI/CD with Kubernetes, Helm & Wercker (#madScalability)](https://reader034.vdocuments.us/reader034/viewer/2022051709/5871adde1a28abda6a8b6017/html5/thumbnails/16.jpg)
HOW WE USE KUBERNETES
![Page 17: CI/CD with Kubernetes, Helm & Wercker (#madScalability)](https://reader034.vdocuments.us/reader034/viewer/2022051709/5871adde1a28abda6a8b6017/html5/thumbnails/17.jpg)
Worker Deployment
…
WebService
DB Service
Redis Service
Memcached Service
Memcached Deployment
Memcached Podmemcached
Worker Podresque
Worker Podresque
Web Deployment
…Web Podnginx + unicorn
Web Podnginx + unicorn
Cron Deployment
Cron Podcron -f
Redis Deployment
Redis Podredis
DB Deployment
DB Podpostgres
WebIngress ☁Internet
![Page 18: CI/CD with Kubernetes, Helm & Wercker (#madScalability)](https://reader034.vdocuments.us/reader034/viewer/2022051709/5871adde1a28abda6a8b6017/html5/thumbnails/18.jpg)
HELM 101 (IN 3 MINS)
![Page 19: CI/CD with Kubernetes, Helm & Wercker (#madScalability)](https://reader034.vdocuments.us/reader034/viewer/2022051709/5871adde1a28abda6a8b6017/html5/thumbnails/19.jpg)
What is Helm?• It’s a package manager for Kubernetes 🤔
• Charts are packages of pre-configured Kubernetes resources.
• You can use public Charts to easily install apps into your cluster (eg: postgresql, wordpress).
• … Or you can create a private Chart for your application.
![Page 20: CI/CD with Kubernetes, Helm & Wercker (#madScalability)](https://reader034.vdocuments.us/reader034/viewer/2022051709/5871adde1a28abda6a8b6017/html5/thumbnails/20.jpg)
What is Helm?• You can use templates to define your Charts 🙌
• Helm has two parts:
- helm: a CLI client
- tiller: A server (tiller) than runs in your Kubernetes cluster as another pod. You can install tiller in your cluster with: $ helm init
![Page 21: CI/CD with Kubernetes, Helm & Wercker (#madScalability)](https://reader034.vdocuments.us/reader034/viewer/2022051709/5871adde1a28abda6a8b6017/html5/thumbnails/21.jpg)
More about Helm
https://www.youtube.com/watch?v=zBc1goRfk3k
https://speakerdeck.com/michellen/delivering-kubernetes-applications-with-helm
![Page 22: CI/CD with Kubernetes, Helm & Wercker (#madScalability)](https://reader034.vdocuments.us/reader034/viewer/2022051709/5871adde1a28abda6a8b6017/html5/thumbnails/22.jpg)
HOW WE USE HELM
![Page 23: CI/CD with Kubernetes, Helm & Wercker (#madScalability)](https://reader034.vdocuments.us/reader034/viewer/2022051709/5871adde1a28abda6a8b6017/html5/thumbnails/23.jpg)
File structure & code!"" app!"" config!"" db!"" deploy!"" lib!"" log!"" public!"" script!"" spec!"" vendor!"" Gemfile!"" Gemfile.lock!"" Procfile!"" Rakefile!"" config.ru#"" wercker.yml
deploy!"" kubernetes-chart$ !"" templates$ $ !"" _helpers.tpl$ $ !"" cron.yaml$ $ !"" db.yaml$ $ !"" memcached.yaml$ $ !"" redis.yaml$ $ !"" secrets.yaml$ $ !"" web.yaml$ $ #"" worker.yaml$ !"" Chart.yaml$ !"" README.md$ !"" production-values.yaml$ !"" rails_env.yaml$ !"" staging-values.yaml$ #"" values.yaml!"" nginx.conf#"" unicorn.rb
https://gist.github.com/javiercr/fa4335e6bc67147b1e12523b0282a18a
![Page 24: CI/CD with Kubernetes, Helm & Wercker (#madScalability)](https://reader034.vdocuments.us/reader034/viewer/2022051709/5871adde1a28abda6a8b6017/html5/thumbnails/24.jpg)
WERCKER 101 (IN 3 MINS)
![Page 25: CI/CD with Kubernetes, Helm & Wercker (#madScalability)](https://reader034.vdocuments.us/reader034/viewer/2022051709/5871adde1a28abda6a8b6017/html5/thumbnails/25.jpg)
What is Wercker?• It’s a Docker-Native CI/CD Automation platform for
Kubernetes & Microservice Deployments.
• With Wercker you define your CI/CD process as Workflow composed by multiple Pipelines.
• Each Pipeline is defined by multiple Steps. Wercker offers a Registry of shared steps (eg: to install kubectl)
![Page 26: CI/CD with Kubernetes, Helm & Wercker (#madScalability)](https://reader034.vdocuments.us/reader034/viewer/2022051709/5871adde1a28abda6a8b6017/html5/thumbnails/26.jpg)
HOW WE USE WERCKER
![Page 27: CI/CD with Kubernetes, Helm & Wercker (#madScalability)](https://reader034.vdocuments.us/reader034/viewer/2022051709/5871adde1a28abda6a8b6017/html5/thumbnails/27.jpg)
![Page 28: CI/CD with Kubernetes, Helm & Wercker (#madScalability)](https://reader034.vdocuments.us/reader034/viewer/2022051709/5871adde1a28abda6a8b6017/html5/thumbnails/28.jpg)
![Page 29: CI/CD with Kubernetes, Helm & Wercker (#madScalability)](https://reader034.vdocuments.us/reader034/viewer/2022051709/5871adde1a28abda6a8b6017/html5/thumbnails/29.jpg)
install nodejs, phantomjs
bundle install
rake db:create
rspec
install nodejs, nginx, cron
copy nginx.conf
copy unicorn.rb
bundle install
rake assets:precompilehipchat notification
install kubectl
install helm
helm upgrade
hipchat notification
buildbuild-container
deploy-staging
Gudog’s Wercker Workflow
note that we decided to only automate deployments to staging. env. however deploying to production it’s just one click
(executing the deploy-production pipeline from wercker ui)
docker push to GCR
![Page 30: CI/CD with Kubernetes, Helm & Wercker (#madScalability)](https://reader034.vdocuments.us/reader034/viewer/2022051709/5871adde1a28abda6a8b6017/html5/thumbnails/30.jpg)
Gudog’s Wercker Workflow
Our wercker.yml: https://gist.github.com/javiercr/fa4335e6bc67147b1e12523b0282a18a#file-wercker-yml
![Page 31: CI/CD with Kubernetes, Helm & Wercker (#madScalability)](https://reader034.vdocuments.us/reader034/viewer/2022051709/5871adde1a28abda6a8b6017/html5/thumbnails/31.jpg)
http://blog.wercker.com/Dockerfiles-considered-harmful
![Page 32: CI/CD with Kubernetes, Helm & Wercker (#madScalability)](https://reader034.vdocuments.us/reader034/viewer/2022051709/5871adde1a28abda6a8b6017/html5/thumbnails/32.jpg)
THANK YOU Questions?
Special thanks to @LachlanEvenson from Deis for helping me get started with Helm and the k8s community.