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

Kubernetes: o maravilhoso mundo dos orquestrado...

Kubernetes: o maravilhoso mundo dos orquestradores de containers! (DevFest BH 2018)

Apresentada no DevFest BH 2018

Alexandre Cisneiros

November 09, 2018
Tweet

More Decks by Alexandre Cisneiros

Other Decks in Technology

Transcript

  1. Kubernetes: o maravilhoso mundo dos orquestradores de containers! DEVFEST BH

    2018 Alexandre Cisneiros Software Engineer @ Nubank
  2. Programa de recompensas totalmente diferente do existente no mercado nacional.

    100% digital, simples e com pontos que não expiram.
  3. Nossa versão de uma conta bancária: uma maneira simples e

    inteligente de guardar, gerenciar o seu dinheiro, com rendimentos diários.
  4. 13 Exemplo: fechando uma fatura Credit Card Accounts Billing Charging

    Surrender Notification CLOSE-BILL BILL-CLOSED NEW-BOLETO SEND-BOLETO Kafka message Service
  5. 15 Containers são unidades de software padronizadas que executam isoladas

    do resto do ambiente, compartilhando apenas o kernel do sistema operacional.
  6. 16 VM vs. Container Infraestrutura Infraestrutura Hypervisor Sistema operacional Sistema

    operacional Docker daemon SO da VM Binários/Bibliotecas Aplicação Binários/Bibliotecas Aplicação Binários/Bibliotecas Aplicação SO da VM Binários/Bibliotecas Aplicação
  7. 18 Imagens e Containers Imagem imutável Código Instruções Container em

    execução Processos Sistema de arquivos Container em execu Processos Sistema de arquiv Container em execução Processos Sistema de arquivos Container em execu Processos Sistema de arquiv Container em execução Processos Container em execu Processos
  8. 21 Kubernetes, do grego, Timoneiro. Projeto open source que provisiona

    containers em nós, com base em um estado desejado. Baseado no ambiente da Google.
  9. Master etcd API Scheduler Node Node Node Node kubelet Pod

    Pod Pod Node kubelet Pod Pod Pod Node kubelet Pod Pod Pod kube Master etcd API Scheduler Estrutura do Kubernetes Master etcd API Scheduler Node kubelet Pod 1 Pod 2 Pod 3 Master etcd API Scheduler Node kubelet Pod Pod Pod Node kubelet Pod Pod Pod kube Node kubelet Pod Pod Pod Node kubelet Pod Pod Pod Node kubelet Pod Pod Pod kube Node kubelet Pod Pod Pod Node kubelet Pod Pod Pod Node kubelet Pod Pod Pod kube
  10. Scheduler Node kubelet Pod Pod Pod Node kubelet Pod Pod

    Pod Node kubelet Pod Pod Pod Node kubelet Pod Pod Pod Node kubelet Pod Pod Pod Node kubelet Pod Pod Pod Node kubelet Pod Pod Pod Node kubelet Pod Pod Pod Scheduler Estrutura do Kubernetes Scheduler kubelet Pod 1 Pod 2 Pod 3 Scheduler kubelet Pod Pod Pod kubelet Pod Pod Pod kubelet Pod Pod Pod Node kubelet Pod Pod Pod Node kubelet Pod Pod Pod Node kubelet Pod Pod Pod Node kubelet Pod Pod Pod Node kubelet Pod Pod Pod Node kubelet Pod Pod Pod Node kubelet Pod Pod Pod Node kubelet Pod Pod Pod
  11. billing Pod 26 kind: Pod metadata: name: billing spec: containers:

    - name: billing image: nubank/billing:v1 resources: requests: cpu: 1 Pod billing
  12. 27 kind: Pod metadata: name: billing spec: containers: - name:

    billing image: nubank/billing:v1 resources: requests: cpu: 1 memory: 2G - name: log-collector image: nubank/logger:v1 Pod billing Pod billing log-collector
  13. 28 kind: Deployment metadata: name: billing spec: replicas: 2 template:

    containers: - name: billing image: nubank/billing:v1 resources: Deployment billing Pod billing log-collector billing Pod billing log-collector billing Deployment
  14. 30 Criando um deployment Master etcd API Scheduler Node 1

    kubelet Node 2 kubelet Node 3 kubelet Dev kind: Deployment metadata: name: billing spec: replicas: 2 template: containers: - name: billing image: nubank/billing:v1
  15. 31 Criando um deployment Master etcd API Scheduler Node 1

    kubelet Node 2 kubelet Node 3 kubelet Dev kind: Deployment metadata: name: billing spec: replicas: 2 template: containers: - name: billing image: nubank/billing:v1
  16. 32 Criando um deployment Master etcd API Scheduler Node 1

    kubelet Node 2 kubelet Node 3 kubelet Dev kind: Deployment metadata: name: billing spec: replicas: 2 template: containers: - name: billing image: nubank/billing:v1
  17. 33 Criando um deployment Master etcd API Scheduler Node 1

    kubelet Node 2 kubelet Node 3 kubelet Dev
  18. 33 Criando um deployment Master etcd API Scheduler Node 1

    kubelet Node 2 kubelet Node 3 kubelet Dev
  19. 33 Criando um deployment Master etcd API Scheduler Node 1

    kubelet Node 2 kubelet Node 3 kubelet Dev
  20. 33 Criando um deployment Master etcd API Scheduler Node 1

    kubelet Node 2 kubelet Node 3 kubelet Dev billing Pod 1 billing Pod 2
  21. 34 Criando outro deployment Master etcd API Scheduler Node 1

    kubelet Node 2 kubelet Node 3 kubelet Dev billing Pod 1 billing Pod 2 kind: Deployment metadata: name: cca spec: replicas: 4 template: containers: - name: cca image: nubank/cca:v1
  22. 35 Criando outro deployment Master etcd API Scheduler Node 1

    kubelet Node 2 kubelet Node 3 kubelet Dev billing Pod 1 billing Pod 2 kind: Deployment metadata: name: cca spec: replicas: 4 template: containers: - name: cca image: nubank/cca:v1
  23. 36 Criando outro deployment Master etcd API Scheduler Node 1

    kubelet Node 2 kubelet Node 3 kubelet Dev billing Pod 1 billing Pod 2 kind: Deployment metadata: name: cca spec: replicas: 4 template: containers: - name: cca image: nubank/cca:v1
  24. 37 Criando outro deployment Master etcd API Scheduler Node 1

    kubelet Node 2 kubelet Node 3 kubelet Dev billing Pod 1 billing Pod 2
  25. 37 Criando outro deployment Master etcd API Scheduler Node 1

    kubelet Node 2 kubelet Node 3 kubelet Dev billing Pod 1 billing Pod 2
  26. 37 Criando outro deployment Master etcd API Scheduler Node 1

    kubelet Node 2 kubelet Node 3 kubelet Dev billing Pod 1 billing Pod 2
  27. 37 Criando outro deployment Master etcd API Scheduler Node 1

    kubelet Node 2 kubelet Node 3 kubelet Dev billing Pod 1 billing Pod 2 cca Pod 1 cca Pod 2 cca Pod 3 cca Pod 4
  28. 38 Se perder um nó? Master etcd API Scheduler Node

    1 kubelet Node 3 kubelet Dev billing Pod 1 cca Pod 1 cca Pod 2 Node 2 kubelet billing Pod 2 cca Pod 3 cca Pod 4
  29. 38 Se perder um nó? Master etcd API Scheduler Node

    1 kubelet Node 3 kubelet Dev billing Pod 1 cca Pod 1 cca Pod 2 cca Pod 4
  30. 38 Se perder um nó? Master etcd API Scheduler Node

    1 kubelet Node 3 kubelet Dev billing Pod 1 cca Pod 1 cca Pod 2 cca Pod 4
  31. 38 Se perder um nó? Master etcd API Scheduler Node

    1 kubelet Node 3 kubelet Dev billing Pod 1 cca Pod 1 cca Pod 2 cca Pod 4 billing Pod 2 cca Pod 3
  32. 39 Voltando… Master etcd API Scheduler Node 1 kubelet Node

    3 kubelet Dev billing Pod 1 cca Pod 1 cca Pod 2 Node 2 kubelet billing Pod 2 cca Pod 3 cca Pod 4 cca Pod 3
  33. 40 Criando mais um deployment Master etcd API Scheduler Node

    1 kubelet Node 3 kubelet Dev billing Pod 1 cca Pod 1 cca Pod 2 Node 2 kubelet billing Pod 2 cca Pod 3 cca Pod 4 cca Pod 3 kind: Deployment metadata: name: notification spec: replicas: 4 template: containers: - name: notification image: nubank/notific:v1
  34. 41 Criando mais um deployment Master etcd API Scheduler Node

    1 kubelet Node 3 kubelet Dev billing Pod 1 cca Pod 1 cca Pod 2 Node 2 kubelet billing Pod 2 cca Pod 3 cca Pod 4 cca Pod 3 kind: Deployment metadata: name: notification spec: replicas: 4 template: containers: - name: notification image: nubank/notific:v1
  35. 42 Master etcd API Scheduler Node 1 kubelet Node 3

    kubelet Dev billing Pod 1 cca Pod 1 cca Pod 2 Node 2 kubelet billing Pod 2 cca Pod 3 cca Pod 4 cca Pod 3 kind: Deployment metadata: name: notification spec: replicas: 4 template: containers: - name: notification image: nubank/notific:v1 Criando mais um deployment
  36. 43 Master etcd API Scheduler Node 1 kubelet Node 3

    kubelet Dev billing Pod 1 cca Pod 1 cca Pod 2 Node 2 kubelet billing Pod 2 cca Pod 3 cca Pod 4 cca Pod 3 Criando mais um deployment
  37. 43 Master etcd API Scheduler Node 1 kubelet Node 3

    kubelet Dev billing Pod 1 cca Pod 1 cca Pod 2 Node 2 kubelet billing Pod 2 cca Pod 3 cca Pod 4 cca Pod 3 notification Pod 1 notification Pod 2 notification Pod 3 notification Pod 4 Criando mais um deployment
  38. 44 Aumentando o cluster Master etcd API Scheduler Node 1

    kubelet Node 3 kubelet Dev billing Pod 1 cca Pod 1 cca Pod 2 Node 2 kubelet billing Pod 2 cca Pod 3 cca Pod 4 cca Pod 3 notification Pod 1 notification Pod 2 notification Pod 3 notification Pod 4 Scaler
  39. 45 Aumentando o cluster Master etcd API Scheduler Node 1

    kubelet Node 3 kubelet Dev billing Pod 1 cca Pod 1 cca Pod 2 Node 2 kubelet billing Pod 2 cca Pod 3 cca Pod 4 cca Pod 3 notification Pod 1 notification Pod 2 notification Pod 3 notification Pod 4 Scaler Node 4 kubelet
  40. 45 Aumentando o cluster Master etcd API Scheduler Node 1

    kubelet Node 3 kubelet Dev billing Pod 1 cca Pod 1 cca Pod 2 Node 2 kubelet billing Pod 2 cca Pod 3 cca Pod 4 cca Pod 3 notification Pod 1 notification Pod 2 notification Pod 3 notification Pod 4 Scaler Node 4 kubelet
  41. Node 4 kubelet 46 Master etcd API Scheduler Node 1

    kubelet Node 3 kubelet Dev billing Pod 1 cca Pod 1 cca Pod 2 Node 2 kubelet billing Pod 2 cca Pod 3 cca Pod 4 cca Pod 3 notification Pod 1 notification Pod 2 notification Pod 3 notification Pod 4 Scaler Aumentando o cluster
  42. Node 4 kubelet 47 Modificando um deployment Master etcd API

    Scheduler Node 1 kubelet Node 3 kubelet Dev billing Pod 1 cca Pod 1 cca Pod 2 Node 2 kubelet billing Pod 2 cca Pod 3 cca Pod 4 cca Pod 3 notification Pod 1 notification Pod 2 notification Pod 3 notification Pod 4 Scaler PATCH deployment/billing image: billing:v2
  43. Node 4 kubelet 48 Master etcd API Scheduler Node 1

    kubelet Node 3 kubelet Dev billing Pod 1 cca Pod 1 cca Pod 2 Node 2 kubelet billing Pod 2 cca Pod 3 cca Pod 4 cca Pod 3 notification Pod 1 notification Pod 2 notification Pod 3 notification Pod 4 Scaler PATCH deployment/billing image: billing:v2 Modificando um deployment
  44. Node 4 kubelet 49 Master etcd API Scheduler Node 1

    kubelet Node 3 kubelet Dev billing Pod 1 cca Pod 1 cca Pod 2 Node 2 kubelet billing Pod 2 cca Pod 3 cca Pod 4 cca Pod 3 notification Pod 1 notification Pod 2 notification Pod 3 notification Pod 4 Scaler PATCH deployment/billing image: billing:v2 Modificando um deployment
  45. Node 4 kubelet 50 Master etcd API Scheduler Node 1

    kubelet Node 3 kubelet Dev billing Pod 1 cca Pod 1 cca Pod 2 Node 2 kubelet billing Pod 2 cca Pod 3 cca Pod 4 cca Pod 3 notification Pod 1 notification Pod 2 notification Pod 3 notification Pod 4 Scaler Modificando um deployment
  46. Node 4 kubelet 51 Master etcd API Scheduler Node 1

    kubelet Node 3 kubelet Dev billing Pod 1 cca Pod 1 cca Pod 2 Node 2 kubelet billing Pod 2 cca Pod 3 cca Pod 4 cca Pod 3 notification Pod 1 notification Pod 2 notification Pod 3 notification Pod 4 Scaler Modificando um deployment
  47. Definição de quantidade de Pods baseado em uso de recursos

    como CPU dinamicamente Pod Auto Scaling
  48. Monitoramento do uso de recursos e saúde dos pods e

    do cluster em tempo real. Monitoring