An Introduction to Container Organization with Docker Swarm, Kubernetes, Mesos, and Neo4j
HA Kubernetes on Mesos / Marathon
-
Upload
cobus-bernard -
Category
Internet
-
view
275 -
download
0
Transcript of HA Kubernetes on Mesos / Marathon
![Page 1: HA Kubernetes on Mesos / Marathon](https://reader031.fdocuments.in/reader031/viewer/2022021816/58efa6551a28ab9a4f8b456f/html5/thumbnails/1.jpg)
Docker on Kubernetes
![Page 2: HA Kubernetes on Mesos / Marathon](https://reader031.fdocuments.in/reader031/viewer/2022021816/58efa6551a28ab9a4f8b456f/html5/thumbnails/2.jpg)
Thank you@planet for the snacks
22seven for the venue
Blue Battleship for the drinks
(^^^ shameless self promotion)
![Page 3: HA Kubernetes on Mesos / Marathon](https://reader031.fdocuments.in/reader031/viewer/2022021816/58efa6551a28ab9a4f8b456f/html5/thumbnails/3.jpg)
ActuallyDocker on Kubernetes
on Mesos via Marathon
in VirtualBox via Vagrant
Provisioned with Chef
![Page 4: HA Kubernetes on Mesos / Marathon](https://reader031.fdocuments.in/reader031/viewer/2022021816/58efa6551a28ab9a4f8b456f/html5/thumbnails/4.jpg)
Relax and listenAll the code and commands will
be available online after the talk
![Page 5: HA Kubernetes on Mesos / Marathon](https://reader031.fdocuments.in/reader031/viewer/2022021816/58efa6551a28ab9a4f8b456f/html5/thumbnails/5.jpg)
![Page 6: HA Kubernetes on Mesos / Marathon](https://reader031.fdocuments.in/reader031/viewer/2022021816/58efa6551a28ab9a4f8b456f/html5/thumbnails/6.jpg)
What is Docker?According to Google:
person employed in a port to load and unload ships.
![Page 7: HA Kubernetes on Mesos / Marathon](https://reader031.fdocuments.in/reader031/viewer/2022021816/58efa6551a28ab9a4f8b456f/html5/thumbnails/7.jpg)
Docker containers wrap up a piece of software in a
complete filesystem that contains everything it needs
to run: code, runtime, system tools, system libraries
– anything you can install on a server. This
guarantees that it will always run the same,
regardless of the environment it is running in.
![Page 8: HA Kubernetes on Mesos / Marathon](https://reader031.fdocuments.in/reader031/viewer/2022021816/58efa6551a28ab9a4f8b456f/html5/thumbnails/8.jpg)
![Page 9: HA Kubernetes on Mesos / Marathon](https://reader031.fdocuments.in/reader031/viewer/2022021816/58efa6551a28ab9a4f8b456f/html5/thumbnails/9.jpg)
Why is this important?Creates a standard way to ship build artifacts
Ships the exact binary the developer had
![Page 10: HA Kubernetes on Mesos / Marathon](https://reader031.fdocuments.in/reader031/viewer/2022021816/58efa6551a28ab9a4f8b456f/html5/thumbnails/10.jpg)
<Stock photo for docker presentation>
![Page 11: HA Kubernetes on Mesos / Marathon](https://reader031.fdocuments.in/reader031/viewer/2022021816/58efa6551a28ab9a4f8b456f/html5/thumbnails/11.jpg)
So you have containersNow what?
Let’s deploy!
![Page 12: HA Kubernetes on Mesos / Marathon](https://reader031.fdocuments.in/reader031/viewer/2022021816/58efa6551a28ab9a4f8b456f/html5/thumbnails/12.jpg)
Where do you host them?Docker Hub (public, security)
AWS ECR
Private Docker registry
![Page 13: HA Kubernetes on Mesos / Marathon](https://reader031.fdocuments.in/reader031/viewer/2022021816/58efa6551a28ab9a4f8b456f/html5/thumbnails/13.jpg)
How do you deploy?Command line
![Page 14: HA Kubernetes on Mesos / Marathon](https://reader031.fdocuments.in/reader031/viewer/2022021816/58efa6551a28ab9a4f8b456f/html5/thumbnails/14.jpg)
High hardware utilizationIdling systems wastes money
![Page 15: HA Kubernetes on Mesos / Marathon](https://reader031.fdocuments.in/reader031/viewer/2022021816/58efa6551a28ab9a4f8b456f/html5/thumbnails/15.jpg)
Ok, so let’s spin up moreUse each server for multiple services
Forward the ports to the same on host
Put a loadbalancer in front
Pat back, just scaled horizontally
![Page 16: HA Kubernetes on Mesos / Marathon](https://reader031.fdocuments.in/reader031/viewer/2022021816/58efa6551a28ab9a4f8b456f/html5/thumbnails/16.jpg)
IssuesHow do the nodes in a service discover other ones
to allow them to cluster?
![Page 17: HA Kubernetes on Mesos / Marathon](https://reader031.fdocuments.in/reader031/viewer/2022021816/58efa6551a28ab9a4f8b456f/html5/thumbnails/17.jpg)
Chef!(My new koolaid driven tool)
Ansible is also cool, ask Tom
![Page 18: HA Kubernetes on Mesos / Marathon](https://reader031.fdocuments.in/reader031/viewer/2022021816/58efa6551a28ab9a4f8b456f/html5/thumbnails/18.jpg)
![Page 19: HA Kubernetes on Mesos / Marathon](https://reader031.fdocuments.in/reader031/viewer/2022021816/58efa6551a28ab9a4f8b456f/html5/thumbnails/19.jpg)
![Page 20: HA Kubernetes on Mesos / Marathon](https://reader031.fdocuments.in/reader031/viewer/2022021816/58efa6551a28ab9a4f8b456f/html5/thumbnails/20.jpg)
Erm, riiiiiiightI’ve heard Mesos/Marathon can help with that
![Page 21: HA Kubernetes on Mesos / Marathon](https://reader031.fdocuments.in/reader031/viewer/2022021816/58efa6551a28ab9a4f8b456f/html5/thumbnails/21.jpg)
Are we there yet?I thought this talk was about Kubernetes
![Page 22: HA Kubernetes on Mesos / Marathon](https://reader031.fdocuments.in/reader031/viewer/2022021816/58efa6551a28ab9a4f8b456f/html5/thumbnails/22.jpg)
KubernetesGood for spinning up pods
Registering services
Etcd event -> Update DNS
![Page 23: HA Kubernetes on Mesos / Marathon](https://reader031.fdocuments.in/reader031/viewer/2022021816/58efa6551a28ab9a4f8b456f/html5/thumbnails/23.jpg)
PodsCollection of Docker images that work together
nginx + memcached
Independent, no shared state
Port inside container is mapped to host port
![Page 24: HA Kubernetes on Mesos / Marathon](https://reader031.fdocuments.in/reader031/viewer/2022021816/58efa6551a28ab9a4f8b456f/html5/thumbnails/24.jpg)
PodsMortal, when they die, they are gone
Sounds like something should watch them
![Page 25: HA Kubernetes on Mesos / Marathon](https://reader031.fdocuments.in/reader031/viewer/2022021816/58efa6551a28ab9a4f8b456f/html5/thumbnails/25.jpg)
![Page 26: HA Kubernetes on Mesos / Marathon](https://reader031.fdocuments.in/reader031/viewer/2022021816/58efa6551a28ab9a4f8b456f/html5/thumbnails/26.jpg)
Replication controllerMonitors the pods
Spins up or kills pods depending
on replication count required
Should be used for single pods
![Page 27: HA Kubernetes on Mesos / Marathon](https://reader031.fdocuments.in/reader031/viewer/2022021816/58efa6551a28ab9a4f8b456f/html5/thumbnails/27.jpg)
PodsIf the run on some host somewhere,
how do we find them?
![Page 28: HA Kubernetes on Mesos / Marathon](https://reader031.fdocuments.in/reader031/viewer/2022021816/58efa6551a28ab9a4f8b456f/html5/thumbnails/28.jpg)
ServicesHigher level abstraction
Website doesn’t care which instance,
just looking for image processing service
Has a port to pod port mapping
![Page 29: HA Kubernetes on Mesos / Marathon](https://reader031.fdocuments.in/reader031/viewer/2022021816/58efa6551a28ab9a4f8b456f/html5/thumbnails/29.jpg)
![Page 30: HA Kubernetes on Mesos / Marathon](https://reader031.fdocuments.in/reader031/viewer/2022021816/58efa6551a28ab9a4f8b456f/html5/thumbnails/30.jpg)
Port mappingService registers with Etcd -> DNS
Service port -> Pod port -> Container port
Starting to get complicated
myservice.etcd.local
![Page 31: HA Kubernetes on Mesos / Marathon](https://reader031.fdocuments.in/reader031/viewer/2022021816/58efa6551a28ab9a4f8b456f/html5/thumbnails/31.jpg)
Mesos / MarathonGood with scheduling tasks on nodes
Monitors and restarts processes
Assigns random ports to containers
Allows resource constraints
![Page 32: HA Kubernetes on Mesos / Marathon](https://reader031.fdocuments.in/reader031/viewer/2022021816/58efa6551a28ab9a4f8b456f/html5/thumbnails/32.jpg)
Consul + nginxConsul raises events when service is registerd
Consul-template -> generate nginx config
Load balance 2x nginx for *.mydomain.com
![Page 33: HA Kubernetes on Mesos / Marathon](https://reader031.fdocuments.in/reader031/viewer/2022021816/58efa6551a28ab9a4f8b456f/html5/thumbnails/33.jpg)
Mesos + KubernetesEasy, right?
![Page 34: HA Kubernetes on Mesos / Marathon](https://reader031.fdocuments.in/reader031/viewer/2022021816/58efa6551a28ab9a4f8b456f/html5/thumbnails/34.jpg)
![Page 35: HA Kubernetes on Mesos / Marathon](https://reader031.fdocuments.in/reader031/viewer/2022021816/58efa6551a28ab9a4f8b456f/html5/thumbnails/35.jpg)
![Page 36: HA Kubernetes on Mesos / Marathon](https://reader031.fdocuments.in/reader031/viewer/2022021816/58efa6551a28ab9a4f8b456f/html5/thumbnails/36.jpg)
![Page 37: HA Kubernetes on Mesos / Marathon](https://reader031.fdocuments.in/reader031/viewer/2022021816/58efa6551a28ab9a4f8b456f/html5/thumbnails/37.jpg)
What now?Vagrant + Virtualbox
Chef them
Sounds do-able
![Page 38: HA Kubernetes on Mesos / Marathon](https://reader031.fdocuments.in/reader031/viewer/2022021816/58efa6551a28ab9a4f8b456f/html5/thumbnails/38.jpg)
VagrantSpin up 3 Ubuntu machines
Provision with Chef
![Page 39: HA Kubernetes on Mesos / Marathon](https://reader031.fdocuments.in/reader031/viewer/2022021816/58efa6551a28ab9a4f8b456f/html5/thumbnails/39.jpg)
Eth0 vs Eth1Chef Ohai reads eth0
Needs to be eth1
Vagrant Ohai plugin!
Then it broke
![Page 40: HA Kubernetes on Mesos / Marathon](https://reader031.fdocuments.in/reader031/viewer/2022021816/58efa6551a28ab9a4f8b456f/html5/thumbnails/40.jpg)
Zookeeper
Mesos
MarathonNot too much pain
![Page 41: HA Kubernetes on Mesos / Marathon](https://reader031.fdocuments.in/reader031/viewer/2022021816/58efa6551a28ab9a4f8b456f/html5/thumbnails/41.jpg)
KubernetesLot’s of pain
Build from source
Build from source using Docker image
Download binary
![Page 42: HA Kubernetes on Mesos / Marathon](https://reader031.fdocuments.in/reader031/viewer/2022021816/58efa6551a28ab9a4f8b456f/html5/thumbnails/42.jpg)
KubernetesSpecifically didn’t choose to do single master
example, you wouldn’t run it like this in
production
![Page 43: HA Kubernetes on Mesos / Marathon](https://reader031.fdocuments.in/reader031/viewer/2022021816/58efa6551a28ab9a4f8b456f/html5/thumbnails/43.jpg)
KubernetesWatch Kelsey Hightower’s youtubes
![Page 44: HA Kubernetes on Mesos / Marathon](https://reader031.fdocuments.in/reader031/viewer/2022021816/58efa6551a28ab9a4f8b456f/html5/thumbnails/44.jpg)
KubernetesReally not so easy to set up as HA
![Page 45: HA Kubernetes on Mesos / Marathon](https://reader031.fdocuments.in/reader031/viewer/2022021816/58efa6551a28ab9a4f8b456f/html5/thumbnails/45.jpg)
Thank you@planet for the snacks
22seven for the venue
Blue Battleship for the drinks
(^^^ shameless self promotion)