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.

Docker & Kubernetes

156 views

Published on

Launch a simple Python web service with Docker and Kubernetes on Google Container Engine.

Published in: Software
  • Be the first to comment

Docker & Kubernetes

  1. 1. DEPLOYING DOCKER TO GOOGLE CLOUD PLATFORM USING KUBERNETES Troy Harvey @troyharvey Generation Tux
  2. 2. https://www.docker.com/what-docker
  3. 3. http://www.eaiesb.com/blogs/?p=80
  4. 4. https://www.docker.com/survey-2016
  5. 5. 1.DOCKERINDEV 2.DEPLOYDOCKER
  6. 6. WAMP Vagrant Shared drive on Dev server php -S webpackssh + vim (on prod) Dev VM python -m SimpleHTTPServer virtualenvwrapper bin/rails server
  7. 7. https://flurdy.com/docs/docker/docker_osx_ubuntu.html
  8. 8. ☞ Dockerfile Container Image
  9. 9. $ docker build -t us.gcr.io/kubernetes-demo/docker-demo.base:latest -f ./docker/base.dockerfile . USEBASEIMAGE S
  10. 10. docker build -t us.gcr.io/kubernetes-demo/docker-demo:latest -f ./docker/app.dockerfile .
  11. 11. 12FACTORAPP RULE#3
  12. 12. DOCKERRUN
  13. 13. NATIVEFILESYNCING docker run -d -p 5000:5000 -v ~/Projects/docker-demo/:/app us.gcr.io/kubernetes-demo/docker-demo:latest …don’t be mad, Vagrant.
  14. 14. STORINGDOCKERIMAGES
  15. 15. gcloud docker push us.gcr.io/kubernetes-demo-1327/docker-demo:latest
  16. 16. DEPLOYINGDOCKER
  17. 17. https://www.youtube.com/watch?v=8694GGJlpZ8
  18. 18. $ kubectl create -f ./kubernetes/flask-controller.json replicationcontroller "flask-api" created $ kubectl create -f ./kubernetes/flask-service.json service "flask-service" created $ kubectl get services NAME CLUSTER-IP EXTERNAL-IP PORT(S) AGE flask-service 10.3.249.175 104.154.233.1 80/TCP 2m
  19. 19. VERSION1.2DROPS
  20. 20. gcloud docker push us.gcr.io/kubernetes-demo/docker-demo:1.2.0 ☝️
  21. 21. $ kubectl rolling-update flask-api --image=us.gcr.io/kubernetes-demo/docker-demo:1.2.0 Scaling up flask-api-8e516770df4cc01c122ca27915b6d3bc from 0 to 3, scaling down flask-api from 3 to 0 (keep 3 pods available, don't exceed 4 pods) Scaling flask-api-8e516770df4cc01c122ca27915b6d3bc up to 1 Scaling flask-api down to 2 Scaling flask-api-8e516770df4cc01c122ca27915b6d3bc up to 2 Scaling flask-api down to 1 Scaling flask-api-8e516770df4cc01c122ca27915b6d3bc up to 3 Scaling flask-api down to 0 Update succeeded. Deleting old controller: flask-api Renaming flask-api-8e516770df4cc01c122ca27915b6d3bc to flask-api replicationcontroller "flask-api" rolling updated 👇

×