Slide 1

Slide 1 text

Kubernetes: o maravilhoso mundo dos orquestradores de containers! DEVFEST BH 2018 Alexandre Cisneiros Software Engineer @ Nubank

Slide 2

Slide 2 text

No content

Slide 3

Slide 3 text

O maior banco digital do mundo fora da Ásia.

Slide 4

Slide 4 text

Cartão de crédito com experiência 100% digital, sem tarifas e agências.

Slide 5

Slide 5 text

Programa de recompensas totalmente diferente do existente no mercado nacional. 100% digital, simples e com pontos que não expiram.

Slide 6

Slide 6 text

Nossa versão de uma conta bancária: uma maneira simples e inteligente de guardar, gerenciar o seu dinheiro, com rendimentos diários.

Slide 7

Slide 7 text

Microsserviços

Slide 8

Slide 8 text

8 Microsserviços são serviços extremamente especializados que permitem desacoplamento entre equipes e processos.

Slide 9

Slide 9 text

9 Qual a diferença? Microsserviços Monolito

Slide 10

Slide 10 text

10 Mudar um pedaço por vez Microsserviços Monolito

Slide 11

Slide 11 text

11 Criar um pedaço por vez Microsserviços Monolito

Slide 12

Slide 12 text

12 Dividir serviços por time Microsserviços Monolito

Slide 13

Slide 13 text

13 Exemplo: fechando uma fatura Credit Card Accounts Billing Charging Surrender Notification CLOSE-BILL BILL-CLOSED NEW-BOLETO SEND-BOLETO Kafka message Service

Slide 14

Slide 14 text

Containers

Slide 15

Slide 15 text

15 Containers são unidades de software padronizadas que executam isoladas do resto do ambiente, compartilhando apenas o kernel do sistema operacional.

Slide 16

Slide 16 text

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

Slide 17

Slide 17 text

17 Imagens e Containers Imagem imutável Código Instruções

Slide 18

Slide 18 text

17 Imagens e Containers Imagem imutável Código Instruções Container em execução Processos Sistema de arquivos

Slide 19

Slide 19 text

18 Imagens e Containers Imagem imutável Código Instruções Container em execução Processos Sistema de arquivos

Slide 20

Slide 20 text

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

Slide 21

Slide 21 text

Kubernetes

Slide 22

Slide 22 text

No content

Slide 23

Slide 23 text

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.

Slide 24

Slide 24 text

www.yourdomain.com Escalabilidade automática 1 4 Recuperação em falhas 2 Abstração da infraestrutura 3 Por que Kubernetes?

Slide 25

Slide 25 text

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

Slide 26

Slide 26 text

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

Slide 27

Slide 27 text

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

Slide 28

Slide 28 text

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

Slide 29

Slide 29 text

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

Slide 30

Slide 30 text

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

Slide 31

Slide 31 text

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

Slide 32

Slide 32 text

29 Juntando tudo Master etcd API Scheduler Node 1 kubelet Node 2 kubelet Node 3 kubelet Dev

Slide 33

Slide 33 text

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

Slide 34

Slide 34 text

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

Slide 35

Slide 35 text

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

Slide 36

Slide 36 text

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

Slide 37

Slide 37 text

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

Slide 38

Slide 38 text

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

Slide 39

Slide 39 text

33 Criando um deployment Master etcd API Scheduler Node 1 kubelet Node 2 kubelet Node 3 kubelet Dev billing Pod 1 billing Pod 2

Slide 40

Slide 40 text

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

Slide 41

Slide 41 text

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

Slide 42

Slide 42 text

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

Slide 43

Slide 43 text

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

Slide 44

Slide 44 text

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

Slide 45

Slide 45 text

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

Slide 46

Slide 46 text

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

Slide 47

Slide 47 text

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

Slide 48

Slide 48 text

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

Slide 49

Slide 49 text

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

Slide 50

Slide 50 text

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

Slide 51

Slide 51 text

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

Slide 52

Slide 52 text

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

Slide 53

Slide 53 text

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

Slide 54

Slide 54 text

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

Slide 55

Slide 55 text

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

Slide 56

Slide 56 text

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

Slide 57

Slide 57 text

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

Slide 58

Slide 58 text

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

Slide 59

Slide 59 text

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

Slide 60

Slide 60 text

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

Slide 61

Slide 61 text

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

Slide 62

Slide 62 text

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

Slide 63

Slide 63 text

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

Slide 64

Slide 64 text

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

Slide 65

Slide 65 text

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

Slide 66

Slide 66 text

O que tem mais?

Slide 67

Slide 67 text

Comunicação e balanceamento de carga entre aplicações Service discovery

Slide 68

Slide 68 text

Definição de quantidade de Pods baseado em uso de recursos como CPU dinamicamente Pod Auto Scaling

Slide 69

Slide 69 text

Alocação e montagem de volumes dinamicamente. Storage provision

Slide 70

Slide 70 text

Monitoramento do uso de recursos e saúde dos pods e do cluster em tempo real. Monitoring

Slide 71

Slide 71 text

E muito mais!

Slide 72

Slide 72 text

Estamos contratando! sou.nu/vagasnu

Slide 73

Slide 73 text

DEVFEST BH 2018 Obrigado, DevFest! Alexandre Cisneiros [email protected] @Cisneiros

Slide 74

Slide 74 text

No content