expose kuberentes api to the rest of the network

4/19/2018
ss -tnulp|grep 8443
tcp    LISTEN     0      128    172.16.1.4:8443                  *:*                   users:(("kube-apiserver",pid=29513,fd=5))

i have my api server running and i want to expose it to the rest of the network, this is the network config on my cluster :

eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 172.16.1.4  netmask 255.255.255.0  broadcast 172.16.1.255
        inet6 fe80::f816:3eff:feb5:93a3  prefixlen 64  scopeid 0x20<link>
        ether fa:16:3e:b5:93:a3  txqueuelen 1000  (Ethernet)
        RX packets 218935  bytes 2518654013 (2.3 GiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 160281  bytes 33994810 (32.4 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

eth1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 139.54.130.39  netmask 255.255.254.0  broadcast 139.54.131.255
        inet6 3ffe:302:11:2:f816:3eff:fe46:ab28  prefixlen 64  scopeid 0x0<global>
        inet6 fd12:1f4b:e0bf:10:f816:3eff:fe46:ab28  prefixlen 64  scopeid 0x0<global>
        inet6 fd12:1f4b:e0bf:1:f816:3eff:fe46:ab28  prefixlen 64  scopeid 0x0<global>
        inet6 fe80::f816:3eff:fe46:ab28  prefixlen 64  scopeid 0x20<link>
        ether fa:16:3e:46:ab:28  txqueuelen 1000  (Ethernet)
        RX packets 3227129  bytes 845879874 (806.6 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 1072031  bytes 132806957 (126.6 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

the VM has an external ip 139.54.130.39 Any leads how to do that ?

-- MelDev
kubectl
kubernetes

1 Answer

4/19/2018

Did you try using this option
- --apiserver-advertise-address=139.54.130.39
Kubectl over this network will be able to handshake 139.54.130.39

you can apply this depends of your installation:
.......

In case .. you installed apiserver as pod just you can change apiserver-advertise-address parameter in

/etc/kubernetes/manifests/kube-apiserver.yaml

or check/list kube-system pods you have to get actual apiserver name and edit it (carefully )

kubectl get pod -n kube-system

kubectl edit pod -n kube-system kube-apiserver

........

In case .. you installed apiserver as service, edit systemd script

ex:

 vim /etc/systemd/system/kube-apiserver.service

Edit

ExecStart=/usr/local/bin/kube-apiserver --bind-address=0.0.0.0
--advertise_address=139.54.130.39

-- EngSabry
Source: StackOverflow