Diese Präsentation wurde erfolgreich gemeldet.
Wir verwenden Ihre LinkedIn Profilangaben und Informationen zu Ihren Aktivitäten, um Anzeigen zu personalisieren und Ihnen relevantere Inhalte anzuzeigen. Sie können Ihre Anzeigeneinstellungen jederzeit ändern.

Kubernetes 101

2.538 Aufrufe

Veröffentlicht am

An intro to Kubernetes and a few hands-on examples. Docker orchestration explained.

Veröffentlicht in: Software
  • Als Erste(r) kommentieren

Kubernetes 101

  1. 1. Kubernetes 101
  2. 2. whoami DevOps Engineer @ Spreaker h"p://twi"er.com/jnardiello
  3. 3. What to expect
  4. 4. A Kubernetes primer
  5. 5. Tips, tricks, sweat and blood real life experience bringing k8s to produc5on
  6. 6. High-load system Distributed architecture Our whole infrastructure is on AWS
  7. 7. Our pain points
  8. 8. Underused machines
  9. 9. Autoscaling would take minutes
  10. 10. Non-athomic provisioning makes it difficult to roll-out upgrades or migrate services
  11. 11. The solu)on: Docker! Perfectly determinis/c, ephemeral, light- weight
  12. 12. Unfortunately containers are just half of the equa3on Real costs will emerge as you try to make containers work together
  13. 13. Kubernetes
  14. 14. def. (Opinionated) Orchestra1on framework to organise and deploy container-based applica1ons
  15. 15. Agnos&c sandbox where you provide the desired state of your services/apps. Kubernetes aims to take care of everything else
  16. 16. Disclaimer! From the outside Kubernetes is a black box
  17. 17. But inner mechanisms makes it a complex beast to master
  18. 18. We got the cookies! a.k.a. features
  19. 19. Self-healing services Health checks on your containers, rescheduling failing jobs
  20. 20. Dynamic scaling Ensure current state and scale your pods (but it's s4ll on you to scale the nodes)
  21. 21. Networking and rou/ng Route traffic to your containers
  22. 22. Efficient physical resources usage Scheduling containers on physical/vms nodes according to their effec7ve needs
  23. 23. Enough talking
  25. 25. h"ps://asciinema.org/a/ 4xnz9hc3lvs6zp3eakrf2qcjn
  26. 26. $ kubectl get nodes NAME STATUS AGE ip-172-20-0-209.eu-west-1.compute.internal Ready 47m ip-172-20-0-210.eu-west-1.compute.internal Ready 47m ip-172-20-0-211.eu-west-1.compute.internal Ready 47m ip-172-20-0-212.eu-west-1.compute.internal Ready 47m ip-172-20-0-213.eu-west-1.compute.internal Ready 47m
  27. 27. kubectl is your local CLI command center. You can issue commands to the cluster either by kubectl or directly calling REST APIs exposed by the master
  28. 28. We got the nodes, we are ready Our first container on kubernetes!
  29. 29. YAML all the things!
  30. 30. Pods A pod is a group of one or more containers. Pods are the smallest deployable units that can be created and managed in Kubernetes.
  31. 31. Replica(on Controllers A replica*on controller ensures that a specified number of pod “replicas” are running at any one *me
  32. 32. Deployments Pod + Replica-onController
  33. 33. apiVersion: extensions/v1beta1 kind: Deployment metadata: name: dummy-worker spec: replicas: 1 template: metadata: labels: app: dummy-worker spec: containers: - name: dummy-worker image: jnardiello/forever env: - name: SOME_ENV_VAR value: envvarvalue resources: limits: cpu: "256m" memory: "128Mi" requests: cpu: "5m" memory: "8Mi"
  34. 34. Services A Kubernetes Service is an abstrac0on which defines a logical set of Pods and a policy by which to access them.
  35. 35. kind: Service metadata: name: dummy-worker-service spec: ports: - port: 80· targetPort: 8000 protocol: TCP selector: app: dummy-worker externalIPs: []
  36. 36. There are different types of services NodePorts, proxied by the master LoadBalancer, crea'ng an actual ELB on AWS Ingress [beta] - WARNING, do not use
  37. 37. Deploy the container h"ps://asciinema.org/a/7c42c8itmyz3982p6fmo9ecvi
  38. 38. Resilient applica,ons h"ps://asciinema.org/a/2bxo51ond7ac4haaguneingmv
  39. 39. Kubernetes is truly amazing (for POCs)
  40. 40. Ba#le-tested cluster A long way before reaching produc4on ready There will be blood!
  41. 41. Opinionated Logging
  42. 42. Opinionated Monitoring
  43. 43. Master skynet, then implement your own solu4on
  44. 44. Custom metrics-based Autoscaling OpsFactory/Kappa
  45. 45. These topics are for another /me (We should probably do Kubernetes102)
  46. 46. Ques%ons? @jnardiello