Setup kubernetes with flannel on OVH 16 May 2017
This is a the first article of a series about deploying a webapp on a Kubernetes cluster running on OVH infrastructure.
In the following article I will demonstrate how to :
- Deploy Kubernetes with 2 nodes (the master an a minion)
- Setup flannel as the network plugin
- 2x Cloud VPS-SSD running Ubuntu 16.10
Log as root
Some commands need to be run as root. To log as root simply type.
More info on : https://www.ovh.co.uk/g1786.become_root_and_select_a_password
We have followed the Get Docker for Ubuntu guide. Here is the summury of commands :
Remove previous version of docker
Install community edition
We are going to use the getting started kubeadm guide. We are going to sum-up the various command we have to run.
On all nodes
We followed the Ubuntu install part.
On the Master
Before starting you need to know that you will need to pass the –pod-network-cidr flag for the init command when using flannel (see https://kubernetes.io/docs/admin/kubeadm#kubeadm-init and https://github.com/kubernetes/kubernetes/issues/36575#issuecomment-264622923)
Save the kubeadm join command that kubeadm init will output at the end. You will need your token for your node.
kubeadm join --token <token> <master-ip>:<master-port>
Logout as a normal user and start the cluster
At this stage the master node should NOT be ready because it is missing a network plugin to start.
You can run
You should find in the
KubeletNotReady runtime network not ready: NetworkReady=false reason:NetworkPluginN
Installing a pod network
We are going to install flannel as a pod network.
Check installation worked
Oups ! Something is wrong and flannel did not start nor the dns pod. You can have a look at the logs of the flannel pod.
You need to setup some RBAC permissions !
Then wait for some time (time for pods to restart automatically) you should get everything runing !
Finding all this took me quite some time as I was a pure Kubernetes newbee. So I do hope it really saves you time.
Specific to minion
Run the join command as root (replace by your own specific values).
Login to master and check node as been added.
You should see something like this
You can check that you have a new flannel-ds pod running.
If you want to start again, here is how to reset a node