Upgrade to Pro — share decks privately, control downloads, hide ads and more …

The Container End-Game: An Introduction To Kubernetes And Minikube

The Container End-Game: An Introduction To Kubernetes And Minikube

More and more people either already have adopted Docker containers for their dev work, or are actively looking into it. Not many of them are using containers in production yet, and are unsure how to go about doing so. After years of uncertainty, the industry is moving towards a common platform for doing just that.

In this talk, Stuart will introduce you to Kubernetes - the de-facto standard approach to running containers in production. He’ll show you how to map the things you know from traditional infrastructure and Docker onto Kubernetes. He’ll also introduce you to minikube - a way to run (most of) Kubernetes on a local machine. He’ll finish by covering some of the areas where Kubernetes needs de-Googling in the future.

Presented at PHP Hampshire on 14th November, 2018.

Stuart Herbert

November 14, 2018
Tweet

More Decks by Stuart Herbert

Other Decks in Programming

Transcript

  1. Industry veteran: architect, engineer, leader, manager, mentor F/OSS contributor since

    1994 Talking and writing about PHP since 2004 Chief Software Archaeologist Building Quality @GanbaroDigital About Stuart
  2. @GanbaroDigital In This Talk 1. Introducing Kubernetes 2. Introducing Minikube

    3. Thinking In Kubernetes 4. De-Google-ing Kubernetes
  3. @GanbaroDigital In This Talk 1. Introducing Kubernetes 2. Introducing Minikube

    3. Thinking In Kubernetes 4. De-Google-ing Kubernetes
  4. @GanbaroDigital In This Talk 1. Introducing Kubernetes 2. Introducing Minikube

    3. Thinking In Kubernetes 4. De-Google-ing Kubernetes
  5. @GanbaroDigital In This Talk 1. Introducing Kubernetes 2. Introducing Minikube

    3. Thinking In Kubernetes 4. De-Google-ing Kubernetes
  6. @GanbaroDigital VM VM VM VM VM VM data API Scheduler

    internal controllers Masters Nodes
  7. @GanbaroDigital VM VM VM VM VM VM data API Scheduler

    internal controllers cloud controllers Masters Nodes
  8. @GanbaroDigital VM VM VM VM VM VM data API Scheduler

    internal controllers cloud controllers Masters Nodes
  9. @GanbaroDigital VM VM VM VM VM VM data API Scheduler

    internal controllers cloud controllers Masters Nodes Control plane
  10. @GanbaroDigital VM VM VM VM VM VM data API Scheduler

    containerd Masters Nodes Control plane internal controllers cloud controllers
  11. @GanbaroDigital VM VM VM VM VM VM data API Scheduler

    containerd sandbox Masters Nodes Control plane internal controllers cloud controllers
  12. @GanbaroDigital VM VM VM VM VM VM data API Scheduler

    containerd sandbox worker API Masters Nodes Control plane internal controllers cloud controllers
  13. @GanbaroDigital VM VM VM VM VM VM data API Scheduler

    containerd sandbox worker API emulated networking Masters Nodes Control plane internal controllers cloud controllers
  14. @GanbaroDigital VM VM VM VM VM VM data API Scheduler

    containerd sandbox worker API emulated networking proxy Masters Nodes Control plane internal controllers cloud controllers
  15. @GanbaroDigital VM VM VM VM VM VM data API Scheduler

    containerd sandbox worker API emulated networking proxy Masters Nodes Control plane Workload internal controllers cloud controllers
  16. @GanbaroDigital VM VM VM VM VM VM data API Scheduler

    containerd sandbox worker API emulated networking proxy Masters Nodes Control plane Workload internal controllers cloud controllers
  17. @GanbaroDigital VM VM VM VM VM VM data API Scheduler

    containerd sandbox worker API emulated networking proxy Masters Nodes Control plane Workload internal controllers
  18. @GanbaroDigital VM VM VM VM VM VM data API Scheduler

    containerd worker API emulated networking proxy Masters Nodes Control plane Workload internal controllers
  19. @GanbaroDigital VM VM VM data API Scheduler containerd worker API

    emulated networking proxy Nodes Control plane Workload internal controllers
  20. @GanbaroDigital VM data API Scheduler containerd worker API emulated networking

    proxy Control plane Workload Boot2Docker internal controllers
  21. @GanbaroDigital We lose any networking that relies on load balancers.

    This is mostly network access into containers on Kubernetes.
  22. @GanbaroDigital There is a project called MetalLB that can fill

    the gap. It isn't integrated into Minikube at this time.
  23. @GanbaroDigital Ingress Controller • Works on Minikube • Works on

    K8S in the cloud • Supports HTTP/HTTPS only • HTTPS is terminated at Ingress
  24. @GanbaroDigital HostPath Volumes • VM folders mounted into containers •

    When the VM is deleted, all data is lost • Create volumes under /data to keep data between VM reboots
  25. @GanbaroDigital This is a mix of VM overhead and K8S

    components that burn CPU even when idle.
  26. @GanbaroDigital I've had to upgrade my dev box to use

    Minikube. So has the customer I am working with.
  27. @GanbaroDigital Intel NUCs are my secret weapon! 32GB of RAM,

    NVMe storage, and you can reinstall everything when you screw up.
  28. @GanbaroDigital If you must host dev work on Kubernetes, spin

    up a K8S dev cluster on a cloud provider.
  29. @GanbaroDigital apiVersion: apps/v1 kind: Deployment metadata: name: nginx-deployment labels: app:

    nginx spec: replicas: 3 selector: matchLabels: app: nginx template: metadata: labels: app: nginx spec: containers: - name: nginx image: nginx:1.15.4 ports: - containerPort: 80 Kubernetes objects
  30. @GanbaroDigital VM VM VM data API Scheduler Masters Control plane

    apiVersion: apps/v1 kind: Deployment metadata: name: nginx-deployment labels: app: nginx spec: replicas: 3 selector: matchLabels: app: nginx template: metadata: labels: app: nginx spec: containers: - name: nginx image: nginx:1.15.4 ports: - containerPort: 80 internal controllers cloud controllers
  31. @GanbaroDigital VM VM VM data API Scheduler internal controllers cloud

    controllers Masters Control plane apiVersion: apps/v1 kind: Deployment metadata: name: nginx-deployment labels: app: nginx spec: replicas: 3 selector: matchLabels: app: nginx template: metadata: labels: app: nginx spec: containers: - name: nginx image: nginx:1.15.4 ports: - containerPort: 80
  32. @GanbaroDigital VM VM VM data API Scheduler internal controllers cloud

    controllers Masters Control plane apiVersion: apps/v1 kind: Deployment metadata: name: nginx-deployment labels: app: nginx spec: replicas: 3 selector: matchLabels: app: nginx template: metadata: labels: app: nginx spec: containers: - name: nginx image: nginx:1.15.4 ports: - containerPort: 80
  33. @GanbaroDigital VM VM VM data API Scheduler internal controllers cloud

    controllers Masters Control plane apiVersion: apps/v1 kind: Deployment metadata: name: nginx-deployment labels: app: nginx spec: replicas: 3 selector: matchLabels: app: nginx template: metadata: labels: app: nginx spec: containers: - name: nginx image: nginx:1.15.4 ports: - containerPort: 80
  34. @GanbaroDigital VM VM VM data API Scheduler internal controllers cloud

    controllers Masters Control plane apiVersion: apps/v1 kind: Deployment metadata: name: nginx-deployment labels: app: nginx spec: replicas: 3 selector: matchLabels: app: nginx template: metadata: labels: app: nginx spec: containers: - name: nginx image: nginx:1.15.4 ports: - containerPort: 80
  35. @GanbaroDigital VM VM VM data API Scheduler internal controllers cloud

    controllers Masters Control plane apiVersion: apps/v1 kind: ReplicaSet metadata: name: nginx-deployment-ykzjud ...
  36. @GanbaroDigital VM VM VM data API Scheduler internal controllers cloud

    controllers Masters Control plane apiVersion: apps/v1 kind: ReplicaSet metadata: name: nginx-deployment-ykzjud ...
  37. @GanbaroDigital VM VM VM VM VM VM data API Scheduler

    containerd sandbox worker API emulated networking proxy internal controllers cloud controllers Masters Nodes Control plane Workload
  38. @GanbaroDigital VM VM VM VM VM VM data API Scheduler

    containerd sandbox worker API emulated networking proxy internal controllers cloud controllers Masters Nodes Control plane Workload
  39. @GanbaroDigital VM VM VM VM VM VM data API Scheduler

    containerd sandbox worker API emulated networking proxy internal controllers cloud controllers Masters Nodes Control plane Workload
  40. @GanbaroDigital We don't tell K8S "start this container". We tell

    K8S "we want these containers running" and K8S makes it happen.
  41. @GanbaroDigital Deployments • Objects describe desired state • K8S updates

    active state to match • K8S restores active state when things go wrong
  42. @GanbaroDigital Deployments • Objects describe desired state • K8S updates

    active state to match • K8S restores active state when things go wrong
  43. @GanbaroDigital Deployments • Objects describe desired state • K8S updates

    active state to match • K8S restores active state when things go wrong
  44. @GanbaroDigital The (portable) solution? Use K8S rollouts to replace the

    app container with a specialist backup container.
  45. @GanbaroDigital Once you're used to the Kubernetes approach, going back

    to traditional infrastructure just feels wrong.
  46. Thank You How Can We Help You? A presentation by

    @stuherbert
 for @GanbaroDigital