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. 1.
  2. 2.
  3. 3.
  4. 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. 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. 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. 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. 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. 9.
  10. 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. 11.
  12. 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. 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. 14.
  15. 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. 16.
  17. 17.
  18. 18.
  19. 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."
  20. 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
  21. 26.
  22. 30.
  23. 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.
  24. 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) …
  25. 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
  26. 43.
  27. 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) …
  28. 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) …
  29. 48.

    Azure Container Instances Node With Azure Container Instances Master Cluster

    Node az enable-addons –g –name –addons –subnet-name
  30. 49.
  31. 53.
  32. 55.
  33. 56.

    PV vs PVC Volumes emptyDir hostPath Persistent Volume Claim (PVC)

    ConfigMap Security …. Persistent Volume (PV)
  34. 58.
  35. 62.
  36. 67.
  37. 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
  38. 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
  39. 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
  40. 71.
  41. 72.
  42. 74.

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

    the most complex Kubernetes application pods services Chart.yml db deployments ci …
  43. 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
  44. 77.

    A fully managed service of Red Hat OpenShift on Azure,

    jointly, engineered, operated and supported by Microsoft and Red Hat
  45. 79.
  46. 80.