ok so i have all these containers what now
play

OK, so I have all these Containers What now? Image by Connie Zhou - PowerPoint PPT Presentation

OK, so I have all these Containers What now? Image by Connie Zhou Developer View job hello_world = { runtime = { cell = 'ic' } // Cell (cluster) to run in binary = '.../hello_world_webserver' // Program to run args = { port =


  1. OK, so I have all these Containers What now?

  2. Image by Connie Zhou

  3. Developer View job hello_world = { runtime = { cell = 'ic' } // Cell (cluster) to run in binary = '.../hello_world_webserver' // Program to run args = { port = '%port%' } // Command line parameters requirements = { // Resource requirements ram = 100M disk = 100M cpu = 0.1 } 10000 replicas = 5 // Number of tasks } #kubernetes @tekgrrl

  4. Developer View #kubernetes @tekgrrl

  5. Binary Config Developer View file web browsers borgcfg web browsers BorgMaster What just BorgMaster UI shard BorgMaster UI shard BorgMaster UI shard BorgMaster UI shard UI shard happened? persistent store Scheduler scheduler (Paxos) link shard link shard link shard link shard link shard Borglet Borglet Borglet Borglet #kubernetes @tekgrrl

  6. Hello world! Hello Hello Hello Hello world! world! Hello Hello Hello Hello Hello Hello world! world! Hello Hello world! world! Hello Hello Hello Hello world! world! world! world! Hello Hello Hello Hello Hello world! world! world! world! Hello Hello Hello world! Hello world! Hello Hello Hello Hello world! world! Hello Hello world! world! Hello world! Hello Hello world! world! world! world! Hello Hello world! Hello world! world! world! world! world! Hello Hello world! world! world! Hello world! world! Hello Hello world! Hello Hello world! Hello world! Hello world! Hello Hello world! world! Hello world! world! world! world! Hello world! world! world! world! Image by Connie Zhou

  7. Guestbook App MySQL php Client php php PHP memcached #kubernetes @tekgrrl

  8. Containers

  9. Old Way: Shared Machines No isolation No namespacing app app Common libs app app Highly coupled apps and OS libs kernel #kubernetes @tekgrrl

  10. Old Way: Virtual Machines Some isolation Inefficient app app libs libs Still highly coupled to the guest OS kernel kernel Hard to manage app app libs libs kernel kernel #kubernetes @tekgrrl

  11. New Way: Containers app app libs libs app app libs libs kernel #kubernetes @tekgrrl

  12. Container Images An image is a stack of Read-Only file ● system layers. App Usual process: ● PHP & Apache build ○ push to repository ○ Libs pull to execution host ○ Debian start container from image ○ #kubernetes @tekgrrl

  13. Image Layers Read / Write Read / Write Read / Write A container is a process ● started with kernel restrictions ○ a stack of shared Read-Only ○ App file system layers PHP & Apache plus a process specific Read- ○ Libs Write layer Debian Every new container gets a new ● Read-Write later. All containers from the same image start from exactly the same state! #kubernetes @tekgrrl

  14. Mounting Host Directories It's possible to mount host ● directories into a container's filesystem. host Read / dir Write These are mutable and do outlive ● App the container. PHP & Apache They're only available on that host. ● Libs Debian #kubernetes @tekgrrl

  15. Docker Example App Docker Memcached MySQL PHP & Apache Engine libs libs libs libs Debian Server #kubernetes @tekgrrl

  16. Why containers? • Performance • Repeatability • Quality of service • Accounting • Portability A fundamentally different way of managing applications Images by Connie Zhou

  17. containers are awesome let's use lots of them! #kubernetes @tekgrrl

  18. Demo

  19. Kubernetes

  20. Kubernetes Greek for “Helmsman” ; also the root of the word “Governor” • Orchestrator for Docker containers • Supports multi-cloud environments • Inspired and informed by Google’s experiences and internal systems • Open source , written in Go Manage applications, not machines

  21. Concepts Intro Container Pod Service Volume Replication Controller Label Node #kubernetes @tekgrrl

  22. Developer View (Kubernetes) web browsers web browsers Kube-UI Kubernetes Master kubectl Replication Scheduler Controller Proxy API Server <Your App> Container Registry Kubelet Kubelet Kubelet Kubelet y @tekgrrl #kubernetes #gotoldn

  23. Cluster Options From Laptop to high-availability multi-node cluster Hosted or self managed On-Premise or Cloud Bare Metal or Virtual Machines Many options, See Matrix for details Kubernetes Cluster Matrix: http://bit.ly/1MmhpMW

  24. So what do we run on the nodes? Containers?

  25. Demo

  26. Pods Consumers The atom of scheduling for containers Application specific “logical host” Ephemeral • can die and be replaced Web Server Single container pods can be created directly from a container image Volume Pod #kubernetes @tekgrrl

  27. Pods Github Consumers Can be used to group containers & shared volumes Containers are tightly coupled Git Node.js App Shared namespace Synchronizer Container • Shared network IP and port namespace Ephemeral • Containers in pods live and die together Volume Pod Think in terms of services that you usually run on the same machine

  28. Volume Bound to the Pod that encloses it Look like Directories to Containers What and where they are determined by Volume Type Many Volume options Pod EmptyDir ● Lives with the pod ○

  29. Volume Bound to the Pod that encloses it Look like Directories to Containers What and where they are determined by Volume Type Many Volume options Pod EmptyDir ● HostPath ● /<rootdir> Maps to directory on host ○ | |__/etc Use with caution ○ |--/usr |--/var | |--/log

  30. Volume Bound to the Pod that encloses it Look like Directories to Containers What and where they are determined by Volume Type Many Volume options Pod EmptyDir ● HostPath ● nfs (and similar services) ● NFS

  31. Volume Bound to the Pod that encloses it Look like Directories to Containers What and where they are determined by Volume Type Many Volume options Pod EmptyDir ● HostPath ● nfs (and similar services) ● Cloud Provider Block Storage ●

  32. Labels ← These are important Dashboard Dashboard Pod Pod Pod Pod Pod frontend frontend show: type = FE show: version = v2 type = FE type = FE version = v2 version = v2 Behavior Benefits Metadata with semantic meaning Allow for intent of many users (e.g. dashboards) ● ➔ Membership identifier Build higher level systems … ● ➔ The only Grouping Mechanism Queryable by Selectors ● ➔ #kubernetes @tekgrrl

  33. Developer View (Replication Controller) selector: name: frontend … spec: containers: - name: php-guestbook image: php-guestbook:europython resources: limits: memory: "128Mi" cpu: "500m" ports: - containerPort: 80 protocol: TCP 10000 replicas: 1 #kubernetes @tekgrrl

  34. Replication Controllers Replication Replication Replication Controller Controller Controller Pod Pod Pod Pod Pod #pods = 1 #pods = 2 frontend frontend version = v2 version = v1 version= v1 version = v1 version = v2 show: version = v2 show: version = v2 Behavior Benefits Keeps Pods running Recreates Pods, maintains desired state ● ➔ Gives direct control of Pod #s Fine-grained control for scaling ● ➔ Grouped by Label Selector Standard grouping semantics ● ➔ #kubernetes @tekgrrl

  35. Replication Controller Replication Controllers Canonical example of control loops Replication Controller Have one job: ensure N copies of a pod - Name = “nifty-rc” if too few, start new ones - Selector = {“App”: “Nifty”} ● - PodTemplate = { ... } if too many, kill some ● - NumReplicas = 4 group == selector ● Replicated pods are fungible How Start 1 How many? more many? No implied order or identity ● 4 3 OK API Server #kubernetes @tekgrrl

  36. Container Liveness Process Level: Kubelet checks with Docker that Container is running App Level: User defined health checks: HTTP Health checks (Kubelet calls ● a Web Hook) Container Exec (Kubelet runs ● command in container) TCP Socket (Kubelet attempts to ● open a socket to the container) #kubernetes @tekgrrl

  37. Services A logical grouping of pods that perform the same function Client • group == selector Choice of pod is random but supports session affinity (ClientIP) Portal (VIP) Gets a stable virtual IP and port • also a DNS name Hide complexity - ideal for non-native apps Pod Pod Pod Container Container Container Container #kubernetes @tekgrrl

  38. Canary Example Replication Replication Replication Replication Controller Controller Pod Pod Controller Controller Pod Pod Pod version = v1 frontend frontend version = v2 #pods = 2 #pods = 1 version= v1 version = v1 version = v2 type = FE type = FE type = FE show: version = v2 show: version = v2 Service Service VIP Label selector: Label selectors: type = FE version = 1.0 type = Frontend #kubernetes @tekgrrl

  39. Mapping to Kubernetes MySQL php php python php Client memcache d #kubernetes @tekgrrl

  40. I still have questions about state! Database In a cluster of ephemeral containers Application state must exist outside of the container #kubernetes @tekgrrl

Recommend


More recommend