Managing Docker Containers In A Cluster - Introducing Kubernetes

  • View
    1.009

  • Download
    2

  • Category

    Software

Preview:

Citation preview

@slintes#Devoxx #Kubernetes

Managing Docker ContainersIn A Cluster

-Introducing Kubernetes

Marc SluiterLuminis Technologies

@slintes#Devoxx #Kubernetes

Who am I?• Marc Sluiter• Software Engineer @

Luminis Technologies• Java developer for 14

years• Working on Amdatu

and INAETICS

@slintes#Devoxx #Kubernetes

Motivation• Microservices• decoupled, modular

application components

• Containers• host os independent

packaging• Cloud• virtual or bare metal

pool of resources for running the containers

@slintes#Devoxx #Kubernetes

Docker• easy to use on dev

machine• how to handle

container lifecycle in a cluster?

@slintes#Devoxx #Kubernetes

Kubernetes• Greek for "helmsman"

or “pilot"• schedules, runs and

manages containers in a cluster of virtual or physical machines

• declarative approach:• try permanently to

reach the declared

cluster state

@slintes#Devoxx #Kubernetes

Kubernetes• started by Google in

2014• based on over 10

years experience (“Borg”)

• first release in Juli 2015

• donated to Cloud Native Computing

Foundation• 100% Open Source• Go

@slintes#Devoxx #Kubernetes

Concepts: Pods?!• smallest deployable

unit• small group of tightly

coupled containers• shared network and

data volumes• routable IP address• multiple pods per

node

@slintes#Devoxx #Kubernetes

multiple container usecases• sidecar containers• ambassador

containers• adapter containers

• but often just one container

@slintes#Devoxx #Kubernetes

Pod declarationapiVersion: v1kind: Podmetadata:

name: myAppPod labels: name: myAppPod version: v1.2 spec: containers: - name: master image: myCompany/myImage:v1.2 ports: - containerPort: 1234

@slintes#Devoxx #Kubernetes

Concepts: Replication Controllers• runs x copies of a

pods• starts or kill pods if

necessary• handle pod failures• health checks

• Up- and downscaling

@slintes#Devoxx #Kubernetes

Replication Controller cont.• rolling updates

• blue / green or canary deployments

@slintes#Devoxx #Kubernetes

Replication Controller declarationapiVersion: v1kind: ReplicationControllermetadata: name: myAppReplicationController labels: name: myAppspec: replicas: 1 selector: name: myAppPod

version: v1.2 template: <embedded pod declaration>

@slintes#Devoxx #Kubernetes

Concepts: Services• pods are mortal!• services provide a

permanent virtual IP• proxy traffic to

selected pods• simple load balancing

@slintes#Devoxx #Kubernetes

Service declarationapiVersion: v1kind: Servicemetadata: name: myAppServicespec: ports: - port: 8888 targetPort: 1234 selector: name: myApp

@slintes#Devoxx #Kubernetes

kubectl$ kubectl create -f myAppController.yaml

$ kubectl get rcCONTROLLER CONTAINER(S) IMAGE(S) SELECTOR REPLICASmyAppRC master myImage name=myAppPod,… 1

$ kubectl get podsNAME READY STATUS RESTARTS AGEmyAppRC-dz33o 1/1 Running 0 42s

$ kubectl create -f myAppService.yaml

$ kubectl get servicesNAME CLUSTER_IP EXTERNAL_IP PORT(S) SELECTOR AGEmyAppService 10.0.136.3 <none> 1234/TCP name=myApp 32s

@slintes#Devoxx #Kubernetes

Kubernetes architecture• Master• API server• Controller• Scheduler

• Workers• Kubelet• Proxy

• State only in etcd!

@slintes#Devoxx #Kubernetes

More features• Resource limits• Secrets• Monitoring (cAdvisor)• Logging / Debugging• kubectl logs…• kubectl exec…

• Authentication

• new in V1.1, released this week:• Jobs• DaemonSets• Autoscaling based on

CPU Usage• Ingress (HTTP Load

Balancing)• Deployments

(declarative rolling updates)

@slintes#Devoxx #Kubernetes

K8s in production?• Apache Stratos• Red Hat Openshift &

Fabric8• CoreOS Tectonic• Deis

@slintes#Devoxx #Kubernetes

Kubernetes @ Luminis

Amdatu Kubernetes Java Clienthttp://bit.ly/KubeJavaClient

@slintes#Devoxx #Kubernetes

Questions?

@slintes#Devoxx #Kubernetes

Thank you!

@slintes#Devoxx #Kubernetes

Links...

http://kubernetes.io@kubernetesio

https://github.com/kubernetes

http://www.luminis.euhttp://luminis-technologies.com

http://www.amdatu.orghttp://www.inaetics.org

Recommended