docker container orchestration
TRANSCRIPT
DOCKER CONTAINER ORCHESTRATION
Fernand Galiana
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
Whoosh!
Been All Around The World…
• Apache Mesos
• Docker Swarm
• ECS
• Kubernetes
• Deis
• Fleet
• Helios
Why Kubernetes?
• Flexibility
• Rest API
• Cluster orchestration
• Tooling
• Self healing
• Open source
• Not Vendor centric
• DockerCompose like
• Contributors 560+
• Community
CONCEPTS
K8S
• Node
• Pod
• Replication Controller
• Service
• Volume
• Namespace
• Label
• Annotation
Nodes
Master
Minion1 Minion2 Minion…
Nodes
Minion-1 Minion-2 Minion-n
MasterREST API
Pod
• Collocated Containers
• Same host
• Coupling
• Shared volume
• Ephemeral
Pod Definition
kind: Pod apiVersion: v1 metadata: name: nginx spec: containers: - name: nginx image: nginx ports: - containerPort: 80
ngnix.yml
Deploy!
kubectl create -f ngnix.yml
Labels
• Key/Value Tagging
• May Change during lifetime
• 63 chars alpha(-/_/.)
Label It!
kind: Pod apiVersion: v1 metadata: name: nginx labels: app: nginx spec: containers: - name: nginx image: nginx ports: - containerPort: 80
Find it!
kubectl get pods -l app=nginx
Annotations
• Similar to labels
• !Selectors
• Track build#, versions
Replication Controller
• Pod Cloning
• Pod Supervisor
Selectors
• =,!=
• in, notin, exists, !exists
• , == AND
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
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!!
Deploy!
kubectl create -f nginx-rc
GREAT NOW WHAT?
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
Services
App2
App3
App1
4567
4567
4567
app=fred
KubeProxy
IpTables
ApiServer
Client
app=fred
app=fred
Volumes
• Outlive container’s crash
• Medium: Dir|Memory
• Types: emptyDir|hostPath|NFS|EBS|gitRepo,…
• Specify mount point
Persistent Volumes
• Persistent volume (PV)
• Persistent volume claim (PVC)
Secrets
• OAUTH Tokens
• User/Pwd
DEMO
Demo
New Features
• Daemon Sets
• Deployments
• Ingress Ressources
• Horizontal Pods
• Jobs
Resources
• kubernetes.io
• github.com/kubernetes/kubernetes
SAY HELLO TO MY LITTLE FRIEND…
THOUGHTS?THANK YOU!!