Pro Yearly is on sale from $80 to $50! »

Kubernetes Fundamentals

Kubernetes Fundamentals

Kubernetes. It's so hot right now. But what is it?

This session is designed to show the fundamentals of Kubernetes. It assumes you know what a container is, that Kubernetes does something called "orchestration" with it, but that's it.

We'll cover the following: Container Registry, Pods, Services, Ingress, Scaling, Networking, mounting volumes, package management (Helm) and what's next.

E41f2132a57510b5d3aae6649eca3deb?s=128

Tommy Falgout

June 01, 2019
Tweet

Transcript

  1. None
  2. None
  3. None
  4. VM VM VM VM Server Host OS Hypervisor Guest OS

    Guest OS Guest OS App C App B App A Server Host OS Hypervisor
  5. VM VM VM VM Server Host OS Hypervisor Guest OS

    Guest OS Guest OS App C App B App A Server Host OS Hypervisor
  6. VM Container VM VM VM Server Host OS Hypervisor Guest

    OS Guest OS Guest OS App C App B App A Server Host OS Hypervisor Bins/Libs App A
  7. VM Container Container Container VM VM VM Server Host OS

    Hypervisor Guest OS Guest OS Guest OS App C App B App A Server Host OS Hypervisor Bins/Libs App B App C Bins/Libs App A Bins/Libs
  8. VM Container Container Container VM VM VM Server Host OS

    Hypervisor Guest OS Guest OS Guest OS App C App B App A Server Host OS Hypervisor Bins/Libs App B App C Bins/Libs App A Bins/Libs
  9. None
  10. Image Name Process started in an executing container Initializes a

    new build stage and sets the base image Execute commands in a new layer on top of the current image and commit results Provide defaults for an executing container Captures the steps to build a container image Version-able asset in your DevOps flows Configuration-as-Code
  11. None
  12. VM Container Container Container Server Host OS Hypervisor Bins/Libs App

    B App C Bins/Libs App A Bins/Libs Container Image Container Image Container Image Container Image Container Image Container Image
  13. VM Container Container Container Server Host OS Hypervisor Bins/Libs App

    B App C Bins/Libs App A Bins/Libs Container Image Container Image Container Image Container Image Container Image Container Image
  14. None
  15. VM Container Container Container Server Host OS Hypervisor Bins/Libs App

    B App C Bins/Libs App A Bins/Libs VM Container Container Container Server Host OS Hypervisor Bins/Libs App B App C Bins/Libs App A Bins/Libs
  16. None
  17. None
  18. None
  19. Container Orchestrator

  20. Container Orchestrator Cluster

  21. VM Server Host OS Hypervisor Guest OS Container Orchestrator Cluster

  22. VM Server Host OS Hypervisor Guest OS Cluster

  23. Kubernetes comes from the Greek word κυβερνήτης:, which means helmsman

    or ship pilot, ie: the captainer of a container ship. "Kubernetes is an open-source system for automating deployment, scaling, and management of containerized applications."
  24. VM Server Host OS Hypervisor Guest OS Kubernetes Master Cluster

    Node Node Node Node Node Node
  25. AKS reduces the complexity and operational overhead of managing Kubernetes

    by offloading much of that responsibility to Azure. You only pay for the worker nodes within your clusters, not for the master nodes
  26. None
  27. Kubernetes Cluster Node Node Node Node Node Node

  28. Master Cluster Node api-server etcd controller- manager scheduler

  29. Master Cluster Node api-server etcd controller- manager scheduler

  30. Container Container Container Bins/Libs App B App C Bins/Libs App

    A Bins/Libs Where do the Containers go?
  31. Container Container Container Bins/Libs App B App C Bins/Libs App

    A Bins/Libs Introducing…. Pods!
  32. Pods Master Cluster Node api-server etcd controller- manager scheduler

  33. Pods Master Cluster Node api-server etcd controller- manager scheduler

  34. ratings-api Label(s) app=ratings-api Container-image my.azurecr.io/ratings-api Port 3001 (VolumeMount) /mnt/share (Resources)

    <cpu/memory> ratings-web Label(s) app=ratings-web Container-image my.azurecr.io/ratings-web Port 3000 (VolumeMount) /mnt/share (Resources) <cpu/memory> Pods – What are they? otherApp Label(s) app=otherApp Container-image other.azurecr.io/other App Port 4045 (VolumeMount) /mnt/share Metadata that describes how the containers are configured.
  35. Deployments Metadata that describes how to deploy a pod More

    Metadata ratings-web replicas 2 ratings-web Label(s) app=ratings-web Container- image my.azurecr.io/ ratings-web Port 3000 (Volume) … (Resources) …
  36. Cluster Node Node Master

  37. Cluster Node Node Master

  38. Cluster Node Node Master

  39. ratings-web2 Label(s) app=ratings-web Container- image my.azurecr.io/ ratings-web Port 3000 Services

    Metadata that describes how to reach the pods Yet More Metadata! ratings-web Selector app=ratings-web Port Mapping 8080:3000 Type (Internal or External) LoadBalancer ratings-web1 Label(s) app=ratings-web Container- image my.azurecr.io/ ratings-web Port 3000
  40. Services Cluster Node Node Service ratings-web IP Address Master

  41. Services Cluster Node Node Service ratings-web IP Address Master

  42. Manual via Kubernetes Portal Infra-as-Code a YAML file

  43. None
  44. Scaling Pods ratings-web replicas 3 ratings-web Label(s) app=ratings-web Container- image

    my.azurecr.io/ ratings-web Port 3000 (Volume) … (Resources) …
  45. Scaling Pods ratings-web replicas 6 ratings-web Label(s) app=ratings-web Container- image

    my.azurecr.io/ ratings-web Port 3000 (Volume) … (Resources) …
  46. Node Master Cluster Node Node

  47. Node Node Node Master Cluster Node az scale –name –g

    –node-count
  48. Azure Container Instances Node With Azure Container Instances Master Cluster

    Node az enable-addons –g –name –addons –subnet-name
  49. None
  50. Master Cluster Service ratings-web IP Address Updated App Updated App

    Updated App
  51. Node Node Node Master Cluster Service ratings-web IP Address

  52. Node Node Node Master Cluster Service ratings-web IP Address

  53. None
  54. Why do we need volumes ? Volume (state)

  55. None
  56. PV vs PVC Volumes emptyDir hostPath Persistent Volume Claim (PVC)

    ConfigMap Security …. Persistent Volume (PV)
  57. Dynamic Storage in AKS – Azure Disk

  58. None
  59. Inter-Pod Communication

  60. Why Services?

  61. Why Services?

  62. None
  63. How does ClusterIP Work

  64. How does LoadBalancer Work

  65. How does NodePort Work

  66. How does Ingress Controller Work

  67. None
  68. 1. Kubernetes users communicate with API server and apply desired

    state 2. Master nodes actively enforce desired state on worker nodes 3. Worker nodes support communication between containers Kubernetes control API server replication, namespace, serviceaccounts, etc. -controller- manager -scheduler etcd Master node Worker node kubelet Service Docker Pods Pods Worker node kubelet Service Docker Pods Pods Internet 4. Worker nodes support communication from the Internet
  69. API server Controller Manager Scheduler etcd Store Cloud Controller Self-managed

    master node(s) • Automated upgrades, patches • High reliability, availability • Easy, secure cluster scaling • Self-healing • API server monitoring • At no charge Customer VMs App/ workload definition User Docker Pods Docker Pods Docker Pods Docker Pods Docker Pods Schedule pods over private tunnel Kubernetes API endpoint Azure managed control plane
  70. Task The old way With Azure Create a cluster Provision

    network and VMs Install dozens of system components including etcd Create and install certificates Register agent nodes with control plane az aks create Upgrade a cluster Upgrade your master nodes Cordon/drain and upgrade worker nodes individually az aks upgrade Scale a cluster Provision new VMs Install system components Register nodes with API server az aks scale
  71. None
  72. None
  73. Operationalizing Kubernetes

  74. Helm Helm Charts helps you define, install, and upgrade even

    the most complex Kubernetes application pods services Chart.yml db deployments ci …
  75. Helm The best way to find, share, and use software

    built for Kubernetes Manage complexity Charts can describe complex apps; provide repeatable app installs, and serve as a single point of authority Easy updates Take the pain out of updates with in-place upgrades and custom hooks Simple sharing Charts are easy to version, share, and host on public or private servers Rollbacks Use helm rollout to roll back to an older version of a release with ease
  76. Many Choices

  77. A fully managed service of Red Hat OpenShift on Azure,

    jointly, engineered, operated and supported by Microsoft and Red Hat
  78. https://kubernetes.io/docs/home/ https://aka.ms/learnkubernetes https://aksworkshop.io/ https://helm.sh/blog/helm-3-preview-pt7/ https://docs.microsoft.com/en-us/azure/aks/best-practices

  79. None
  80. None