How to run kube-proxy on master node?

4/30/2018

I use k8s engine on google cloud. I want to run kube-proxy on master node in order to acess my pods through services with NodePort type via master node. How to run kube-proxy on master node?

I use 1.8.10-gke.0 k8s version.

-- Viacheslav
google-cloud-platform
google-kubernetes-engine
kube-proxy
kubernetes

2 Answers

5/22/2018

I found out one solution but it still doesn't work for me. May be someone can do that.

You can run kube-proxy like DaemonSet in k8s. Link to yaml example

Then you have to add toleration to this yaml so that Pod from DaemonSet can be ran on master node.

 "tolerations": [
          {
            "key": "node-role.kubernetes.io/master",
            "value": "true",
            "effect": "NoSchedule"
          }

I hope it will be helpful for someone. If you manage to run kube-proxy on master with this example, please answer.

-- Viacheslav
Source: StackOverflow

5/1/2018

Moreover consider that the master node in the GKE is hosted in a managed infrastructure outside from your project and you have no control over it.

For example you cannot decide to run pod on the master and you cannot access or modify what is running there.


In order to reach directly the master you can run:

$ kubectl proxy -8080 

and then you reach the master directly on localhost.

For example you can try to run it from your you Google Shell and access to the Kubernetes Dashboard through the preview from your browser:

https://8080-dot-[numeber-of-cloud-shell]-dot-devshell.appspot.com/ui

or running from the shell itself:

wget localhost:8080
-- GalloCedrone
Source: StackOverflow