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.

DevOps Summit 2016 - The immutable Journey

雖然執行 Docker Container 只需要一行指令,但是要利用 Docker 構築出 Immutable Infrastructure,並且無痛地運行在各個不同的環境中,可還有許多的事情要準備,其中最重要的就是幫 Immutable Infrastructure 建置完善的 CI/CD Pipeline ,在此場議程中會跟大家分享我 Build, Deployment, Test Docker Image 遇到的各種問題和做法,期望大家能藉由 Immutable Infrastructure 獲得更高效率的開發及運行環境

DevOps Summit 2016 - The immutable Journey

  1. 1. The Immutable Journey Tom Tsai @ Startup
  2. 2. hello! I am Tom Tsai I am here because I want to give life to the servers Startup (DevOps) Trend Micro (QA, DevOps) DevOps Lecturer
  3. 3. “ Why Come To This Section ?
  4. 4. Outline What is Immutable Infrastructure? Configuration Management == Die Container Orchestration - Kubernetes Image CD Pipeline Build Up Q & A
  5. 5. 1. Immutable Infrastructure
  6. 6. Build A stack that you build once (be it a virtual machine image, container image, or something else), run one or many instances of, and never change again. Ref V0.0.1
  7. 7. Deploy The deployment model is to terminate the instance/container and start over from a new one Ref V0.0.2 V0.0.1
  8. 8. What is the Benefit Simplifying operations Continuous deployments, fewer failures Reduces errors and threats Ref
  9. 9. Yes ! Docker is Immutable Infrastructure Docker containers wrap a piece of software in a complete filesystem that contains everything needed to run: code, runtime, system tools, system libraries
  10. 10. Golden Image Is there a image to execute all kind of application ? Ruby Python C# PHP Javascript Perl R Java Groovy Clojure GoF# Pig
  11. 11. Image Layer How to prepare the image for all kind of application in alpha, beta, production phase using? OS Environment Application Change Seldomly Change Frequently
  12. 12. Dockerfile Is Dockerfile the only solution?
  13. 13. 2. Configuration Management
  14. 14. “Which Configuration Management Do You Use?
  15. 15. If the server is Immutable, Can We Throw away CM?
  16. 16. Dockerfile Easy to use, hard to maintain, extend configuration management should Be Die !? Configuration Management Steep Learning Curve, easy to maintain, extend
  17. 17. Using Cm to provision Image Packer is a tool for creating machine and container images for multiple platforms from a single source configuration.
  18. 18. Packer Template Builders: Base image Provisioners: Select prepare tool (e.g. Chef) Post-Processors: store image (e.g. dockerhub, aws ecr)
  19. 19. Image Layer Separate Image to two part, OS+Environment & Application OS Environment Application Change Seldomly Change Frequently
  20. 20. Chef X Docker X Packer 1. Push tag to trigger webhook 2. Execute Packer to provision image 3. Get Provision script from Chef 4. Push Image to dockerhub, image tag equal to git tag Ref
  21. 21. “ Different phase Images ? V0.0.1 alpha V0.0.1 beta V0.0.1 prod
  22. 22. All PhaSe Image Get $PHASE from environment variable. Get different phase configuration in one image. app/start.sh /binary /conf/alpha.yml /beta.yml /prod.yml Build Structure ln -s /app/conf/$PHASE.yml /app/conf/current.yml binary -conf /app/conf/current.yml start.sh
  23. 23. 3. Kubernetes
  24. 24. Without K8S ...
  25. 25. With K8S ...
  26. 26. K8S Infra
  27. 27. K8S Terminology Pod A group of one or more containers Replica Set Ensures that a specified number of pod “replicas” are running Deployment Provides declarative updates for Pods and Replica Sets Service a logical set of Pods and a policy by which to access them
  28. 28. K8S Deployment Create a Deployment to bring up a Replica Set and Pods. Update Deployment (e.g. rolling update Pods) Rollback to an earlier Deployment revision Pause and resume a Deployment.
  29. 29. COntainer Deployment K8S API 1. Create Deployment 2. Update Image ver. 3. Create Service 4. Of course, Testing
  30. 30. Setup K8S is so Hard Use it in google cloud engine will be easy
  31. 31. But I still Try in AWS By AWS CloudFormation Chef Don’t forgot to add tag KubernetesCluster in all aws resource AWS
  32. 32. 4. Image CD Pipeline
  33. 33. “Have you ever heard Jenkins? How dare you ...
  34. 34. Not to mention DeployBuild Test CM X Docker X Packer Kubernetes Depends ...
  35. 35. Place your screenshot here Jenkins 2.0 Pipeline is Good Leverage Groovy DSL to achieve pipeline as code Loading Script Text from Version Control Retaining Global Libraries Everything is done, take a break ?!
  36. 36. More and More Job Using Jenkins Pipeline Plugin after one month, I feel there is still room for improvement...
  37. 37. insufficient Pipeline Job: Still need to maintain Manually Develop: Inside Jenkins website Groovy: Cannot include third-party library
  38. 38. Jenkins Job DSL Trigger Seed Job just like compile your General Jenkins job Seed Job Job A DSL Job B DSL Job A Pipeline Job B Pipeline
  39. 39. After Using ... Pipeline Job: Generate automatically Develop: everywhere Groovy: embed other language
  40. 40. demo
  41. 41. Jenkins Deployable Now ! /CM Script/ # do anything you want /dsl-repo/dsl/ # job dsl for generate jenkins job /pipeline/ # pipeline script for job dsl including /jobs/ # Jenkins Job generating by job dsl /workflow-libs/ #Pipeline Global Library Jenkins Build Structure (/var/lib/jenkins/...)
  42. 42. Script Security Script security plugin block groovy script, after enabling global security… (workaround)
  43. 43. Test Your Jenkins Job?
  44. 44. thanks! Any questions? smalltown20110306 smalltown0110 smalltown0110

×