How Kubernetes works:
For example you have 2 servers with Docker up and running – docker01, docker02. And you are looking for high availability cluster solution.
Kubernetes in a nutshell it is API server which monitors and manages your Docker servers. On each Docker server you should install Kubernetes client – kubelet. Kubelet is a trivial daemon with config in /etc/ directory. There is http path to Kubernetes API server in config file.
According to official documentation we have these requirements for API server:
etcd is the only place that Kubernetes keeps state. link
Apiserver and etcd together are fine on a machine with 1 core and 1GB RAM for clusters link
That means you should create at least 3 small VM for Kubernetes API server. And you can poweroff only 1 VM, otherwise you can lose you cluster state. With 5 VM you can poweroff 2 VM. You can install API server on OS with Docker server. Thus you should create only 1 VM for high availibility.
Services on Kubernetes Master – API server:
- kube-apiserver
- kube-controller-manager
- kube-scheduler
Services on Nodes – Client:
- kubelet
- kube-proxy
Components of Kubernetes:
- working nodes = minions
- master node is responsible for: sheduling, scale, state, rolling out and updates
- kubelet is an agent on working node which communicating with master
- pod – one or more container which act like single app (nginx container + mysql container)
- service – group of containers which act for specific perpose
- flannel – shared VLAN which connect all node in one network
- scheduler service – service which monitors working nodes resources utilisation and spread workload
- replication controllers – like supervisord, service which monitors containers and start container on another node if that container fails. Makes sure that necessary number of containers are up and running.
- ClusterIP – ip reachable inside cluster