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.

Kubernetes 101 Workshop

397 views

Published on

The Kubernetes 101 workshop at ContainerCamp AU 2017 (22 May 2017)

Published in: Technology
  • Login to see the comments

Kubernetes 101 Workshop

  1. 1. KUBERNETES 101 HANDS ON WORKSHOP CONTAINER CAMP 22 MAY 2017
  2. 2. VISHAL BIYANI CTO & Founder at infraCloud technologies (www.infracloud.io ) https://twitter.com/vishal_biyani https://www.vishalbiyani.com 1st Kubernetes partner India 2nd in APAC region Rancher partner - APAC
  3. 3. InfraCloud has published a FREE eBook on “Scaling and deploying Kubernetes” http://info.rancher.com/deploying-scaling-kubernetes-ebook
  4. 4. TIMELINES Time (Minutes - total 180) Agenda 00 - 15 Introduction & Setting up 15 - 45 Quick walkthrough of concepts 45 - 95 3 concepts, code & labs - 15 minute each 95 - 100 Break 100 - 150 3 concept, code & labs - 15 min each 150 - 180 Open House
  5. 5. HAVE YOU? • You have worked with either of Puppet/Chef/Ansible/Salt? • You have used Docker • You have experience of one of: Kubernetes/Mesos/Swarm/Openshift?
  6. 6. TABLE OF CONTAINERS.. .. • What is Kubernetes, exactly? • How to setup a Kubernetes Cluster? • Various ways to get started with a Kubernetes cluster • Kubernetes Architecture • Kubernetes Concepts • POD, Deployments, Services, Labels & Selectors etc. • Kubectl Usage • Deploying app with Helm
  7. 7. KUBERNETES - THE BOOKISH DEFINITION • Kubernetes is an open-source platform for automating deployment, scaling, and operations of application containers across clusters of hosts, providing container- centric infrastructure (From http://kubernetes.io/docs/whatisk8s/) Open source project by Google Primarily targeted at containerized workloads Platform - automates deployment, scaling etc. Abstracts hosts and underlying infrastructure from you Portable - Run on public/private cloud, data center, your laptop - doesn’t matter Self - healing: It restarts, replaces, scales, monitors Containers Extensible - replace certain components if you want to. Extend with pluggable architecture
  8. 8. KUBERNETES HAS COMMON PATTERNS/DESIGNS Need to run related processes together in a shared context Integrating with underlying storage (Block or Bucket based) Check health of applications and maintain certain number of instances. Scale instances based on triggers. Load balancing between multiple instances of a container Provide easy and scalable way to locate and reach services (Aka service discovery and naming) Monitoring and log management Tagging and searching instances dynamically to do certain operations (For example list all web servers across all applications) Rolling updates, Canary deployments Everything is API based- so can be integrated with external systems.
  9. 9. SETTING UP KUBERNETES On Cloud & managed Google Container Engine StackpointCloud Tectonic from CoreOS Openshift SaaS DIY - any cloud/data center Kubeadm (official utility) DIY On steroids KOPS (Targeted to AWS) Kismatic from Apperanda Rancher - provides enterprise features, multi cluster support Redhat OpenShift - comes with complete lifecycle features Many more: http://kubernetes.io/docs/getting-started-guides Platform9
  10. 10. KUBERNETES ARCHITECTURE Image Source: info.rancher.com/deploying-scaling-kubernetes-ebook
  11. 11. Lab - Setup Kubernetes in GKE & laptop setup • GKE Cluster creation • Kubectl on Google Cloud Console • Checkout https://github.com/infracloudio/kubernetes-101
  12. 12. POD • Related containers together • Share same IP, port space & storage etc. • It’s a single unit for all practical purposes Code & Demo: Pod - create and destroy Pod nginx monolith NFSiSCSIGCE 10.10.1.100
  13. 13. POD - LAB
  14. 14. HEALTHCHECK Hey, app v1... You alive? Kubelet Pod app v1
  15. 15. HEALTHCHECK - LAB
  16. 16. DEPLOYMENT • Drive desired state • Maintain desired POD instances • Enable deployment mechanisms such as rolling deploy, Canary, pause/resume etc. Deployment ReplicaSet Pod
  17. 17. DEPLOYMENT LAB
  18. 18. ROLLING UPGRADE - DEPLOYMENT LAB
  19. 19. SERVICES • Provide a fixed endpoint for PODs irrespective of deletion/movement/modification of POD • Expose services/endpoints to outside cluster or to world • Services utilize labels to target PODs to represent
  20. 20. SERVICE TYPES ExternalName (Kubenretes 1.5 onwards) • Maps to a external provided CNAME like service.orgname.com ClusterIP (Default) • Exposes service only within cluster NodePort • Creates a ClusterIP + exposes the same port on every node/host. This is typically used if you want to use an external loadBalancer LoadBalancer • NodePort+Creates a LB in cloud provider (Such as ELB) and points to respective ports
  21. 21. SERVICES- LAB
  22. 22. LABLES AND SELECTORS Lables: “relase”:”1.4” “environment”:”QA” “app”:”billing” Selectors: env = prod release in (1.3, 1.4) app != payment • Classification mechanism • Lables • Tag things • Think like “roles” • Selectors • Filters & conditions
  23. 23. EXAMPLE Pod hello Pod hello labels: version: v1 track: stable labels: version: v1 track: test selector: “version=v1” selector: “track=stable” Pod hello Pod hello labels: version: v1 track: stable labels: version: v1 track: test
  24. 24. SECRETS & CONFIG MAPS • Secrets • Deliver sensitive data to intended target • ConfigMap • Configuration properties
  25. 25. NAMESPACES & NODES • Namespaces • Logically separate cluster • Nodes • Info about nodes
  26. 26. MORE TYPES Volume types for handling persistent data. They interact with cloud provider's storage. StatefulSet - for maanging clusters with strong identity requirements (Kafka, Elastic, Zookeeper etc.) DaemonSet - things which need to run on a set or all nodes of cluster. For example logging agents or Job - ensures a certain number of PODs execute the process and upon completion terminates. (For batch jobs)
  27. 27. HELM - PACKAGE MANAGER FOR KUBERNETES • Helm is a package manager for Kubernetes • Tiller - Repo Server • Chart - a package • Helm is the client for Tiller • Charts are in a repo (Typically some Git repo) • A chart - is set of manifests • The values can be defaulted to or overridden as input from user • A chart is released as a release so that it can be tracked.
  28. 28. HELM ON MY MACHINE • Configure ~/.kube/config file - verify with kubectl • ‘helm init’ - initializes all directories and standard repo • helm search WordPress • helm install --name cc-release stable/wordpress
  29. 29. HELM - LAB
  30. 30. RESOURCES • The workshop material & codelabs at https://github.com/GoogleCloudPlatform/kubernetes- workshops • http://kubernetesbyexample.com • info.rancher.com/deploying-scaling-kubernetes-ebook
  31. 31. Scalable Microservices with Kubernetes https://www.udacity.com/course/scalable-microservices-with-kubernetes--ud615
  32. 32. ধন্যবাদ! Dank je! Kiitos! આભાર! धन्यवाद! Grazie! Je vous remercie! ありがとうございました! ਤੁਹਾਡਾ ਧੰਨਵਾਦ! நன்றி! ధన్యవాదాలు! നന്ദി! THANK YOU!

×