I wanted latest kubernetes to try out new features. But then there are no latest packages of kubernetes available for fedora as of now. So alternative was to try out the released binaries. But I wanted a kubernetes that runs on docker and is multi-node setup. I also read the docs which tells how to setup multi-node kubernetes on docker. But then it was not working for me for some reason.
Also may be due to complexity of running bootstrap instance of docker daemon, then setting up flannel and etcd which run in its own containers, which somehow messed up with my default gateway interface, causing me to restart the VMs, very often.
The docs ask you to run
etcd 2.2.1 and
flannel 0.5.5 in container, so when I checked with the fedora repos those were available as packages. So I decided to install etcd and flannel as rpm package and run only kubernetes in containers. So this reduced complexity.
I have written some shell scripts that do following (link to scripts github repo):
- Bring up three VMs using vagrant one acts as master and other are nodes (you can add more nodes to Vagrantfile).
- Install required packages viz.
docker, flannel, etcd(only on master).
- Setup etcd and flannel.
- Make changes to systemd file of docker to use flannel as default network.
- Change SELINUX contexts of folders that are mounted on container running kubernetes.
- Finally pull kubernetes as container image. (More info k8s docs for master, k8s docs for node)
- Github repo: https://github.com/surajssd/latestkube
- Run a single node k8s on docker http://kubernetes.io/docs/getting-started-guides/docker/
- Run a multi-node k8s master on docker https://github.com/kubernetes/kubernetes.github.io/blob/master/docs/getting-started-guides/docker-multinode/master.md
- Run a multi-node k8s node on docker https://github.com/kubernetes/kubernetes.github.io/blob/master/docs/getting-started-guides/docker-multinode/worker.md
- Setting up flannel https://deshmukhsuraj.wordpress.com/2016/02/29/flannel-demo/
- SELINUX issue with k8s in docker https://deshmukhsuraj.wordpress.com/2016/06/01/running-kubernetes-in-container-on-fedoracentos/