Installing a Kubernetes pod network for cluster nodes hosted on VirtualBox VMs

11/17/2016

On OS X 10.11.6, I created 4 CentOS 7 VMs each with two interfaces ( One NAT, and one Host-only network.) in VirtualBox. Each VM's host-only interface receives an IP via DCHCP and DNS via dnsmasq.

OS X is running dnsmasq configure via a /usr/local/etc/dnsmasq.conf file that contains:

interface=vboxnet0

bind-interfaces

dhcp-range=vboxnet0,192.168.56.100,192.168.56.200,255.255.255.0,infinite
dhcp-leasefile=/usr/local/etc/dnsmasq.leases

local=/dev/
expand-hosts
domain=dev

address=/kube-master.dev/192.168.56.100
address=/kube-minion1.dev/192.168.56.101
address=/kube-minion2.dev/192.168.56.102
address=/kube-minion3.dev/192.168.56.103
address=/vbox-host.dev/192.168.56.1

dhcp-host=08:00:27:09:48:16,192.168.56.100
dhcp-host=0a:00:27:00:00:00,192.168.56.1
dhcp-host=08:00:27:95:AE:39,192.168.56.101
dhcp-host=08:00:27:97:C9:D4,192.168.56.102
dhcp-host=08:00:27:9B:AD:B5,192.168.56.103

I can ssh into each VM through their respective host-only adapter's associated address (e.g., kube-master.dev, kube-minion1.dev, kube-minion2.dev, kube-minion3.dev), and then

yum update 

skipping a few steps, get to the point of installing kubeadm as per http://kubernetes.io/docs/getting-started-guides/kubeadm/, that is:

cat <<EOF > /etc/yum.repos.d/kubernetes.repo
[kubernetes]
name=Kubernetes
baseurl=http://yum.kubernetes.io/repos/kubernetes-el7-x86_64
enabled=1
gpgcheck=1
repo_gpgcheck=1
gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg
   https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg
EOF
setenforce 0
yum install -y docker kubelet kubeadm kubectl kubernetes-cni ebtables
systemctl enable docker && systemctl start docker
systemctl enable kubelet && systemctl start kubelet

Then it is unclear to me if the following is correct but on kube-master.dev I execute

kubeadm init --api-advertise-addresses=192.168.56.100 --api-external-dns-names=kube-master.dev

And then on each minion execute:

rm -Rf /etc/kubernetes/manifests/
kubeadm join --token=e7cd12.68011e93d5db7670 192.168.56.100

On kube-master.dev, I then run

kubectl get nodes

to verify the each node has joined the cluster.

The command returns:

NAME               STATUS    AGE
kube-master.dev    Ready     44m
kube-minion1.dev   Ready     40m
kube-minion2.dev   Ready     39m
kube-minion3.dev   Ready     39m

indicating things are groovy.

Afterward, things go entirely off the rail when I attempt to install a pod network.

On kube-master.dev, I run:

kubectl apply -f https://git.io/weave-kube

to install Weave Net, and once the POD network is installed I start monitoring that network is working via executing:

watch kubectl get pods --all-namespaces

And

kube-dns-654381707-05i1t                  0/3

never moves off of zero.

So please what am I doing wrong? I've hammered at this for days. The kubeadm documentation is a bit thin in a few place, so I'm not sure I init'ed the master correctly, and installing the pod network is bit conjecture on my part. Also, I haven't found a tutorial other than the Kubernetes kubeadm and the associated youtube video documenting the use of kubeadm to set up a kubernetes cluster.

-- nemonik
kubernetes

0 Answers