Kubernetes route

7/25/2017

I want to configure the interface of master node and slave node. After running the master node and joining slave node, master shows:

vagrant@kube4local:~$ sudo kubectl get nodes
NAME         STATUS    AGE       VERSION
kube4local   Ready     6m        v1.7.1

Why is my slave node is not added in cluster ? I tried to change the interface, but still it does not help.

ip route master:

vagrant@kube4local:~$ ip r
default via 192.168.56.104 dev enp0s8
10.0.2.0/24 dev enp0s3  proto kernel  scope link  src 10.0.2.15
10.32.0.0/12 dev weave  proto kernel  scope link  src 10.32.0.1
172.17.0.0/16 dev docker0  proto kernel  scope link  src 172.17.0.1 linkdown
192.168.56.0/24 dev enp0s8  proto kernel  scope link  src 192.168.56.104

ip route slave:

vagrant@kube5local:~$ ip r
default via 192.168.56.105 dev enp0s8
10.0.2.0/24 dev enp0s3  proto kernel  scope link  src 10.0.2.15
172.17.0.0/16 dev docker0  proto kernel  scope link  src 172.17.0.1 linkdown
192.168.56.0/24 dev enp0s8  proto kernel  scope link  src 192.168.56.105
-- nat
kubernetes

1 Answer

7/25/2017

I think your route is wrong. both servers default get should should be same IP. but your output shows different IP.

Not sure about your network setup, check and see 192.168.56.105 is your default gateway.

default via 192.168.56.105 dev enp0s8

I use this script to correct my default route. update correct getway address.

cat correct_default_route.sh
#!/bin/bash

export GW='192.168.56.1'

echo "Checking route : $(date)"

if $( ip route |grep  -q '^default via 10.0.2.2 dev' ); then
        echo "Removing vagrant defualt route : $(date)"
        ip route delete default via  10.0.2.2
fi

if ! $( ip r |egrep -q "^default .* ${GW}" ); then
        ip route add default via $GW
fi

ip r

echo "Done : $(date)"
exit 0

vagarnt network config.

VM_NETMASK = "255.255.255.0"
VM_BRIDGE = ENV["VAGRANT_BRIDGE"] || "Intel(R) Dual Band Wireless-AC 3165"
ip='192.168.1.20'
host.vm.network "public_network", bridge: VM_BRIDGE, ip: ip, :auto_config => "false", :netmask => VM_NETMASK        
-- sfgroups
Source: StackOverflow