From e489bcb5d29855ea7ada00c14008611e730b269e Mon Sep 17 00:00:00 2001 From: Adrian Parks Date: Wed, 21 Nov 2018 12:12:37 +0000 Subject: [PATCH 1/2] Update instructions to ensure K8s services run on second NIC By default, K8s services run on the VM's first NIC; this has no connectivity to other VMs and in fact all VMs use the same IP on this NIC. This change adds --node-ip switch to the kubelet service to ensure it starts all services on the specified IP address (which is the second NIC of the VM). Only tested on VirtualBox provider but expected to be necessary regardless of provider. --- kubernetes/kubeadm-vagrant/README.md | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/kubernetes/kubeadm-vagrant/README.md b/kubernetes/kubeadm-vagrant/README.md index 2564453..7623b4b 100644 --- a/kubernetes/kubeadm-vagrant/README.md +++ b/kubernetes/kubeadm-vagrant/README.md @@ -38,12 +38,19 @@ These instructions assume you've already installed your virtualization provider 8. Copy the final output of the `kubeadm init` command, which includes a token, to the clipboard. You'll need it later. -9. Install a CNI plugin, such as Calico: +9. The three VMs all have two network cards, and we want to ensure that all Kubernetes services run on the second NIC (enp0s8 on Ubuntu 16.04). This is the one connected to the private network 192.168.100.0/24. To ensure this is the case, log into each node (e.g. `vagrant ssh master`). As root, edit the file `/etc/default/kubelet` and add `--node-ip=$ipaddr` to the `KUBELET_EXTRA_ARGS=` line, where `$ipaddr` is the IP address assigned to the second NIC. Then reload the daemons and restart the kubelet service. The following commands will do this (don't forget to run them as root, and also make sure you run them on all three nodes): + + eth1="enp0s8" + ipaddr=$(ip a show $eth1 | egrep -o '([0-9]*\.){3}[0-9]*' | head -n1) + sed -i "s/KUBELET_EXTRA_ARGS=/KUBELET_EXTRA_ARGS=--node-ip=$ipaddr/" /etc/default/kubelet + systemctl daemon-reload && systemctl restart kubelet + +10. Install a CNI plugin, such as Calico: kubectl apply -f https://docs.projectcalico.org/v3.0/getting-started/kubernetes/installation/hosted/kubeadm/1.7/calico.yaml -10. Log out and run `vagrant ssh node-01` to log into "node-01". Run the `kubeadm join` command you copied from the output on "master". +11. Log out and run `vagrant ssh node-01` to log into "node-01". Run the `kubeadm join` command you copied from the output on "master". -11. Repeat step 10, but on "node-02". +12. Repeat step 10, but on "node-02". Enjoy! From a88a360da851dd698d48a3945844e1bbbf15bbd4 Mon Sep 17 00:00:00 2001 From: Adrian Parks Date: Wed, 21 Nov 2018 13:54:32 +0000 Subject: [PATCH 2/2] Update instructions for latest version of Calico Instructions included a link to Calico v3; this doesnt (seem to) work any more. Updated the step to include link to Calico v3.3 (latest at time of writing), tested with VirtualBox provider and working fine. --- kubernetes/kubeadm-vagrant/README.md | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/kubernetes/kubeadm-vagrant/README.md b/kubernetes/kubeadm-vagrant/README.md index 7623b4b..e0c1c79 100644 --- a/kubernetes/kubeadm-vagrant/README.md +++ b/kubernetes/kubeadm-vagrant/README.md @@ -45,9 +45,14 @@ These instructions assume you've already installed your virtualization provider sed -i "s/KUBELET_EXTRA_ARGS=/KUBELET_EXTRA_ARGS=--node-ip=$ipaddr/" /etc/default/kubelet systemctl daemon-reload && systemctl restart kubelet -10. Install a CNI plugin, such as Calico: +10. Install a CNI plugin, such as Calico (see [https://docs.projectcalico.org/v3.3/getting-started/kubernetes/](https://docs.projectcalico.org/v3.3/getting-started/kubernetes/)) - kubectl apply -f https://docs.projectcalico.org/v3.0/getting-started/kubernetes/installation/hosted/kubeadm/1.7/calico.yaml + kubectl apply -f \ + https://docs.projectcalico.org/v3.3/getting-started/kubernetes/installation/hosted/etcd.yaml + kubectl apply -f \ + https://docs.projectcalico.org/v3.3/getting-started/kubernetes/installation/rbac.yaml + kubectl apply -f \ + https://docs.projectcalico.org/v3.3/getting-started/kubernetes/installation/hosted/calico.yaml 11. Log out and run `vagrant ssh node-01` to log into "node-01". Run the `kubeadm join` command you copied from the output on "master".