Top Banner
DOCKER CONTAINER ORCHESTRATION Fernand Galiana
32

Docker Container Orchestration

Apr 16, 2017

Download

Technology

Fernand Galiana
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Docker Container Orchestration

DOCKER CONTAINER ORCHESTRATION

Fernand Galiana

Page 2: Docker Container Orchestration

My Requirements

• Micro Service support

• Multi node deploys + Docker

• Multi ports TCP/UDP/HTTP

• DNS like support across cluster

• Deploy target: AWS

• Rolling updates

• Easy to grasp

• Community support

• Tooling

Page 3: Docker Container Orchestration

Whoosh!

Page 4: Docker Container Orchestration

Been All Around The World…

• Apache Mesos

• Docker Swarm

• ECS

• Kubernetes

• Deis

• Fleet

• Helios

Page 5: Docker Container Orchestration

Why Kubernetes?

• Flexibility

• Rest API

• Cluster orchestration

• Tooling

• Self healing

• Open source

• Not Vendor centric

• DockerCompose like

• Contributors 560+

• Community

• Google

Page 6: Docker Container Orchestration

CONCEPTS

Page 7: Docker Container Orchestration

K8S

• Node

• Pod

• Replication Controller

• Service

• Volume

• Namespace

• Label

• Annotation

Page 8: Docker Container Orchestration

Nodes

Master

Minion1 Minion2 Minion…

Page 9: Docker Container Orchestration

Nodes

Minion-1 Minion-2 Minion-n

MasterREST API

Page 10: Docker Container Orchestration

Pod

• Collocated Containers

• Same host

• Coupling

• Shared volume

• Ephemeral

Page 11: Docker Container Orchestration

Pod Definition

kind: Pod apiVersion: v1 metadata: name: nginx spec: containers: - name: nginx image: nginx ports: - containerPort: 80

ngnix.yml

Page 12: Docker Container Orchestration

Deploy!

kubectl create -f ngnix.yml

Page 13: Docker Container Orchestration

Labels

• Key/Value Tagging

• May Change during lifetime

• 63 chars alpha(-/_/.)

Page 14: Docker Container Orchestration

Label It!

kind: Pod apiVersion: v1 metadata: name: nginx labels: app: nginx spec: containers: - name: nginx image: nginx ports: - containerPort: 80

Page 15: Docker Container Orchestration

Find it!

kubectl get pods -l app=nginx

Page 16: Docker Container Orchestration

Annotations

• Similar to labels

• !Selectors

• Track build#, versions

Page 17: Docker Container Orchestration

Replication Controller

• Pod Cloning

• Pod Supervisor

Page 18: Docker Container Orchestration

Selectors

• =,!=

• in, notin, exists, !exists

• , == AND

Page 19: Docker Container Orchestration

ReplicationControllerkind: ReplicationController apiVersion: v1 metadata: name: nginx-controller spec: replicas: 2 selector: app: nginx template: metadata: labels: app: nginx spec: containers: - name: nginx image: nginx ports: - containerPort: 80

Page 20: Docker Container Orchestration

ReplicationControllerkind: ReplicationController apiVersion: v1 metadata: name: nginx-controller spec: replicas: 2 selector: app: nginx template: metadata: labels: app: nginx spec: containers: - name: nginx image: nginx ports: - containerPort: 80

MUST MATCH!!

Page 21: Docker Container Orchestration

Deploy!

kubectl create -f nginx-rc

Page 22: Docker Container Orchestration

GREAT NOW WHAT?

Page 23: Docker Container Orchestration

Services

• Logical set of pods

• Decoupling between pods and pod’s clients

• Pod(s) endpoint

• HaProxy on steroids (TCP, UDP, HTTP)

• Can point to !k8s endpoint (subsets)

• Virtual IP

• Services must exits before pods

• {SVC}SERVICE_HOST/{SVC}_SERVICE_PORT

Page 24: Docker Container Orchestration

Services

App2

App3

App1

4567

4567

4567

app=fred

KubeProxy

IpTables

ApiServer

Client

app=fred

app=fred

Page 25: Docker Container Orchestration

Volumes

• Outlive container’s crash

• Medium: Dir|Memory

• Types: emptyDir|hostPath|NFS|EBS|gitRepo,…

• Specify mount point

Page 26: Docker Container Orchestration

Persistent Volumes

• Persistent volume (PV)

• Persistent volume claim (PVC)

Page 27: Docker Container Orchestration

Secrets

• OAUTH Tokens

• User/Pwd

Page 28: Docker Container Orchestration

DEMO

Demo

Page 29: Docker Container Orchestration

New Features

• Daemon Sets

• Deployments

• Ingress Ressources

• Horizontal Pods

• Jobs

Page 30: Docker Container Orchestration

Resources

• kubernetes.io

• github.com/kubernetes/kubernetes

Page 31: Docker Container Orchestration

SAY HELLO TO MY LITTLE FRIEND…

Page 32: Docker Container Orchestration

THOUGHTS?THANK YOU!!