Mais conteúdo relacionado



Similar a Understanding Kubernetes(20)



Understanding Kubernetes

  1. Understanding Kubernetes Next extended 2017 – Ha Noi
  2. CTO @ DynoMarketing Technologies: Java, Python, all kind of databases and Cloud platform from Google, Aws, Azure. Interests: Cloud computing / architecture, technology evolution, distributed systems. Husband, Father, GDE, Open source contributor. Tu Pham foto: Lars Kruse, Aarhus Universitet Pervasive Systems group, Section of Electrical and Computer Engineering, Department of Engineering, Aarhus University 2
  3. Let’s get started with a short introduction to Cloud Computing… 3
  4. What is CloudComputing? 4
  5. 5
  6. - “Cloud computing refers to applications and services that run on a distributed network using virtualized resources and accessed by common Internet protocols and networking standards.” - B. Sosinsky, The Cloud Computing Bible - Key enabling concepts - - Abstraction: Cloud computing abstracts the details of system implementation from users and developers Virtualization: Cloud computing virtualizes systems by pooling and sharing resources - Cloud types - - Deployment models: Public, Private, Hybrid,Community Service models: IaaS, PaaS, SaaS, (CaaS) What is CloudComputing? Source: “The Cloud Computing Bible”, B.Sosinsky, page10 6
  7. - - - - - - - - - On-demand self-service Broad network access Resource pooling Rapid elasticity Measured service Lower costs (Than one time buy all) Ease of utilization Quality of Service Reliability Outsourced IT Management Benefits of CloudComputing? Source: “The Cloud Computing Bible”, B.Sosinsky, page17 7
  8. - - - - More suitable for mid & largeorganizations (Poor understanding) Less customizable (For specific reasons) Network latency (Vietnam, ..) Privacy and security (Poor understanding) Disadvantages of CloudComputing? Source: “The Cloud Computing Bible”, B.Sosinsky, page17 8
  9. What about SoftwareArchitecture? 9
  10. Source: Monolithic architecture “A monolith application, in layman terms, is where entire functionality of the application is packaged together as a single unit or application” - Arun Gupta, 2015 10
  11. Microservice architecture “Small Autonomous services that work together, modelled around a business domain” - Sam Newman, 2015 Source: Stonehenge%20at%20dawn.jpg 11
  12. Monolithic vs Microservice architecture Source: 12
  13. Design forfailure - Resilience in a distributed system? 13
  14. resilience or resiliency [ri-zil-yuh ns, -zil-ee-uh ns] noun 2. 1. the power or ability to return to the original form, position, etc., after being bent, compressed, or stretched: elasticity. ability to recover readily from illness, depression, adversity, or the like; buoyancy Source: 14
  15. 15
  17. T h e f a l l a c i e s o f d i s t r i b u t e d c o m p u t i n g 1. T h e n e t w o r k is r e l i a b l e 2. L a t e n c y is ze r o 3. B a n d w i d t h is i n f i n i t e 4. T h e n e t w o r k is s e c u re 5. To p o l o g y doesn’t c h a n g e 6. T h e re is o n e a d m i n i s t r a t o r 7. Tra n s p o r t c o s t is ze r o 8. T h e n e t w o r k is h o m o g e n e o u s 17
  18. - Application level - - - - - Synchronous/Asynchronous architecture (request/response, message queues) Apply circuit breakers at integrationpoints Manage timeouts Bulkheads Health checks - Infrastructure level - - Fault tolerance Infrastructure that detectsfailures What can wedo? 18
  19. What is aContainer? 19
  20. 20
  21. The challenges Source: 21
  22. Intermodal shipping container Source: 22
  23. Docker is a container system for code Source: 23
  24. What is Continuous Delivery? 24
  25. Source: 25
  26. What is ServiceDiscovery? 26
  27. 27
  28. Alittle tour of the 28
  29. 29
  30. Who uses Google CloudPlatform? 30
  31. 31
  32. 32
  33. Google Cloud Compute 33
  34. Google Container Engine Fully Managed Container Engine is fully managed by Google reliability engineers, ensuring your cluster is available and up-to- date. Private ContainerRegistry Google Container Registry makes it easy to store and access your private Dockerimages. Scalable Easily adjust the cluster resources allocated to your containers, or the size of your container cluster, as your application's requirements change. Docker Support Container Engine supports the commonDocker container format. Logging Enable Google Cloud Logging with a singlecheckbox, making it easy to gain insight into how your application is running Hybrid Networking Reserve an IP address range for your container cluster, allowing your cluster IPs to coexist with private network IPs via Google CloudVPN. Source:
  35. Google Container Registry Container Engine Use container images with Container Engine with no authentication setup. Advanced Authentication Easily integrate with your favorite continuous integration, continuous delivery, and container orchestration systems withnative Docker Login support. Container Tags Add and remove image tags with a simple click in the web UI. Docker V2 Registry API Support Push and pull Docker images to your private Container Registry using the V2API. Docker CLIIntegration Pull container images from Container Registry using the standard Docker command lineinterface. Regional Repositories Get the fastest possible pull times by storing your images close to your Compute Engine instances in Europe,Asia, or USregional Cloud Storagebuckets. Search Images Quickly search for images by name and tag. Nearline StorageIntegration Archival storage of images in Cloud Storage Nearline buckets. Source:
  36. Kubernetes - Infrastructure For EveryoneElse Kubernetes is an open-source system for automating deployment, operations, and scaling of containerizedapplications. #GIFEE 36
  37. 37
  38. How tomanage all these containers? 38
  39. 39
  40. How to utilize the resources we have? 40
  41. Machine utilization - - - Machine shapes Workload shapes Bin packing problem Where should we deploy this workload? 2.5GB 1Core Source: 41
  42. Let’s play some tetris 42
  43. “Containerization transforms the datacenter from being machine-oriented to being application-oriented” Burns et al., Borg, Omega, and Kubernetes, 2016 Source:
  44. - - - - - - Greek for “pilot” or “helmsman of a ship” Runs and manages containers Builds on Googles experiences running a hyper-scale webplatform for more than 15 years. Inspired by Googles internal Cluster Management and scheduling platform, “Borg” Supports multiple cloud and bare-metalenvironments 100% Open source, written inGo What is Kubernetes? Source: 44
  45. Velocity Source: v 1.5.x - Release last week - 45431 commits - 1113 contributors - 26 branches 45
  46. Community Source: 46
  47. Everything at Google runs incontainers - - - - Gmail, Web search, … MapReduce, batch, … GFS,Colossus, … Even Google’s Cloud Platform: VMs run in containers In fact, launches over 2 billion containers perweek. Google and Containers 47
  48. How does it work? 48
  49. Let’s have a look a some of the concepts 49
  50. Pods 50
  51. Pods - Kubernetes uses nested containers - - The outer-most one provides a pool of resources, and is called a pod The inner ones provide deployment isolation - Kubernetes regularizes things and always run an application container inside a top-level pod, even if the pod contains a single container - - - “Apod is a collection of containers that are tightly bound”, Brian Dorsey The atom of scheduling for containers Runs on the same virtual/physicalhost 51
  52. Pods Pod Web server Container Pod Web server Consumers Container Git sync Container Git repoConsumers Inspiration: 52
  53. Pod networking 53
  54. Pod networking - - Pods have IPs which areroutable Pods can communicate directly with each other - Even across nodes - - No brokering of PortNumbers Many solutions - Contiv - Flannel - Google Compute Engine - L2 Networks and linux briding - Nuage network VCS - OpenVSwitch - … 54
  55. Pod networking P Pod Container Pod 10.1.3. 10. Container od 0/24 1.3.175 Container Node Node Node Inspiration: 55
  56. Services 56
  57. Services - - - Aservice has a static IP and aDNS entry Acts as a load-balancer and knows how to route traffic to pods Load balances incoming request across constituent pods 57
  58. Services Pod Web server Container Pod Web server Container Pod Web server Container type=FE type=FE type=FE Consumers Service VIP Label selector: type=FE Inspiration: 58
  59. Labels 59
  60. Labels - - - - Labels are simple key/valuepairs Kubernetes connects things together withlabels Only grouping mechanism in Kubernetes Reduces coupling Web server track=staging app=webserver tier=frontend Container Pod 60
  61. Replica Sets Hey! You alwayswear the same as Ido 61
  62. ReplicaSets - - A Replica Set ensures that a specified number of pods “replicas” are running at any given time. Replica Set is the next-generation ReplicationController - The only difference right now is the selector support (set-based support) - Use deployments tocontrol your Replica Sets 62
  63. Replica Sets Pod Container type=FE Pod Container type=FE Pod Container type=FE Current: 3 Desired: 3 Deployment 63
  64. Source: Deployments OH F*CK! Not again! Whyyyyyy… 64
  65. Deployments - - - Deployment is a higher-level concept that manages replica sets, pods and provides declarative updates to pods along with a lot of other useful features You only need to describe the desired state in a Deployment object, and the Deployment controller will change the actual state to the desired state at a controlled rate for you Deploying a new version will result in a rolling-update, where Kubernetes will replace one pod at a time until all are running the latest version. 65
  66. Deployments Pod Container type=FE Pod Container type=FE Pod Container type=FE Current: 3 Desired: 3 version=2 version=2 version=2 Pod Container type=FE version=3 New version Deployment 66
  67. Deployments Pod Container type=FE Pod Container type=FE Pod Container type=FE version=3 version=2 version=2 Deployment Current: 3 Desired: 3 67
  68. Deployments Pod Container type=FE Pod Container type=FE Pod Container type=FE version=3 version=3 version=2 Deployment Current: 3 Desired: 3 68
  69. Deployments Pod Container type=FE Pod Container type=FE Pod Container type=FE version=3 version=3 version=3 Deployment Current: 3 Desired: 3 69
  70. Canary WHAZZZAH! I’m the newkid on thestick! 70
  71. Canary - - Running different versions at the same time Testing new features with a subset of your users 71
  72. Canary Pod Container type=BE Pod Container Pod Container type=BE version=1 type=BE Current: 2 Desired: 2 Deployment version=2 version=1 type=BE version=1 version=2 type=BE Current: 1 Desired: 1 Deployment Consumers Service VIP name=backend Label selector: type=BE Inspiration: 72
  73. Scaling I feel inflated today! 73
  74. Scale (auto) - - - - Horizontal Pod Autoscaler allows you to automatically scale the number of pods in a deployment based on observed CPUutilization. The autoscaler is implemented as a Kubernetes API resource and controller. The resource describes behavior of thecontroller The controller periodically adjusts the number of replicas in a deployment to match the observed average CPU utilization to the target specified by the user. 74
  75. Scale (auto) Pod 1 Container type=FE Pod 2 Container type=FE Pod N Container type=FE version=3 version=3 version=3 Deployment Scale … Horizontal Pod Autoscaler kubectl autoscale deployment foo --max=5 --cpu-percent=80 75
  76. How can I get started with Kubernetes? 76
  77. - - Documentation, great samples, etc. - - - Slack: Github: Pricing: - 1 year free trial. You get $300 in credit. - Community. 77
  78. Demo on Google ContainerEngine 78
  79. Kubernetes Basic Demo config-service 79
  80. Kubernetes One Million Requests Per Second Demo config-service 80
  81. References - - Book: “The Cloud computing bible”, Sosinsky,B. Link: “Microservices - a definition of this new architectural term”, Fowler, M., Lewis, J. - - Link: “Borg, Omega, and Kubernetes”, Burns, B. et al. - - Link: “Introduction to Docker” - 81
  82. JOIN THE FLIGHT Next extended 2017 Twitter: @phamptu Email: