Container Orchestration
For high availability you need to utilize a "Container Orchestration" like
- Docker Swarm (easy to setup and get started, limited: lacks autoscaling feature for complex applications)
- kubernetes (difficult to setup and get started, many advanced features, supported by multiple vendors, more so than the other two. Also supported on all cloud providers, also the kubernetes project is the top ranked project on Microsofts GitHub)
- MESOS (difficult to setup and get started, many advanced features,
Let's compare the difference between using docker and kubnernetes for an application
DOCKER deploy webserver you would run
docker run my-web-server
Very easy but you only have one my-web-server
KUBERNETES depoy webserver you would run the following to deploy 1000 instances
kubectl run --replicas=1000 my-web-server
Also very easy to deploy multiple instances at the same time
Let's say we want kubernetes to scale up or down based on user load. We would run the simple command
kubectl scale --replicas=2000 my-web-server
Now let's say you want to do an upgrade of your app but you can't afford to have them all down so let's do it one at a time with a rolling upgrade
kubectl rolling-update my-web-server --image=web-server:2
But wait, what if something goes wrong? You can easily rollback with the command
kubectl rolling-update my-web-server --rollback
Pretty easy huh?
Let's break it down
Node (worker machine no matter if its physical or virtual)
Cluster (set of nodes grouped together)
Cluster Management (master node with kubernetes control plane and responsible for configs)
When you install kubernetes on a system you are actually installing:
- API Server (frontend for kubernetes)
- etcd Server (stores all data to manage the cluster including all nodes and masters. It ensures no conflicts between them)
- kubelet service (agent that runs on each node in the cluster, ensures the container is running on nodes as expected)
- Container Runtime (engine) like Docker
- Controller (Brains behind the orchestration, watches when nodes
- Scheduler (distributing work
Let's briefly discuss kubectl (the command thats on every node in the cluster)
kubectl is kubernetes command line
run command is used to deploy an application in the cluster.
kubectl run hello-minikube
View information about the cluster you can run the following
kubectl cluster-info
Get a list of all the nodes that are part of the cluster
kubectl get nodes
To run hundreds of instances of your application across hundreds of nodes
kubectl run my-web-app --image=my-web-app --replicas=100
.
0 Comments
Recommended Comments
There are no comments to display.