assigning IP of node to proxy to make REST call to K8s master

1,207 views
Skip to first unread message

Priyadarshini Anand

unread,
Feb 7, 2016, 11:47:53 AM2/7/16
to kubernetes-dev
Hi

How to set IP for  proxy for api server, I am using kubectl proxy --port=8080 but It get assigned to localhost..not able to do with ip of master node tried with -s option but did not work

curl http://10.206.41.5:8080/api/
curl: (7) Failed to connect to 10.206.41.5 port 8080: Connection refused
curl http://localhost:8080/api/ working
10.206.41.5 has entry in /etc/hosts
whats causing issue to make curl http://10.206.41.5:8080/api/ work ?

few attempts to investigate:

nc -vz localhost 8080

nc: connect to localhost port 8080 (tcp) failed: Connection refused

Connection to localhost 8080 port [tcp/http-alt] succeeded!

~/kubernetes# nc -vz 10.206.41.5 8080

nc: connect to 10.206.41.5 port 8080 (tcp) failed: Connection refused


kubectl proxy -s 10.206.41.5:8080

error: couldn't read version from server: Get http://10.206.41.5:8080/api: dial tcp 10.206.41.5:8080: connection refused


netstat -tulnp|grep 8080

tcp        0      0 127.0.0.1:8080          0.0.0.0:*               LISTEN      1691/hyperkube


kubectl proxy -s 0.0.0.0:8080

Starting to serve on 127.0.0.1:8001


again, I am not able to see api server running on ip address of node


./cluster/ubuntu/master/init_scripts/kube-apiserver --insecure-bind-address=0.0.0.0

 * Kube-Apiserver is managed via upstart, try using service kube-apiserver --insecure-bind-address=0.0.0.0

 

 service kube-apiserver --insecure-bind-address=0.0.0.0

kube-apiserver: unrecognized service


I am able to log in machine with ssh from anywhere

Robert Bailey

unread,
Feb 7, 2016, 2:50:32 PM2/7/16
to Priyadarshini Anand, kubernetes-dev
If kubectl proxy is working, can you check was the server address is in your kubeconfig file (e.g. ~/.kube/config)? I'm guessing that your apiserver is listening on port 443 or 8443 instead of port 8080. 

--
You received this message because you are subscribed to the Google Groups "kubernetes-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kubernetes-de...@googlegroups.com.
To post to this group, send email to kuberne...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kubernetes-dev/61e11deb-e39e-4ef3-a9d3-e4e0e0d2a598%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Priyadarshini Anand

unread,
Feb 20, 2016, 11:19:14 PM2/20/16
to kubernetes-dev
I used scripts(https://github.com/ansibl8s/setup-kubernetes/blob/master/README.md) to install K8s master and minions.
do u know how to set master ip so that It is accessible to make REST api call? For example: curl -X POST -d @./rc.jsonhttp://localhost:8080/api/v1/namespaces/ - I want to replace localhost with ip of master so I can make calls from remote machines as well.

(There is no ( ~/.kube/config) file.)

Robert Bailey

unread,
Feb 24, 2016, 5:21:46 PM2/24/16
to Priyadarshini Anand, kubernetes-dev
The master IP should be the IP address of the machine on which ansible installed the master components (using the kube-master role). If you have more than one machine with that role, then the guide has you set up a load balancer to balance between the apiservers, and you should use the address of the load balancer. 

I don't know enough about ansible to figure out when/how it generates a kubeconfig file, but the guide near the bottom says to run 

kubectl run test --image=busybox --command -- tail -f /dev/null

which requires that kubectl can access the master endpoint. Does that command work for you after using these installation instructions?


--
You received this message because you are subscribed to the Google Groups "kubernetes-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kubernetes-de...@googlegroups.com.
To post to this group, send email to kuberne...@googlegroups.com.
Reply all
Reply to author
Forward
This conversation is locked
You cannot reply and perform actions on locked conversations.
0 new messages