Archive

Archive for the ‘kubernetes’ Category

Kubernetes start local cluster with internal IP

November 9, 2016 Leave a comment

$ ./hack/local-up-cluster.sh

This starts-up the local cluster with 127.0.0.1

Requirements:

  • Access this cluster from outside environment
  • Run this cluster with an IP address instead of 127.0.0.1
  • UP local cluster with IP and make sure to have NO_PROXY configured in kubernetes.

Solution:

If you are behind a corporate firewall and wish to run cluster with an IP, you need to have NO_PROXY configured inside kubernetes appropriately. For this and above reqs, follow all or certain steps that meet your need.

  • Modify your local-up-cluster.sh script
API_CORS_ALLOWED_ORIGINS=${API_CORS_ALLOWED_ORIGINS:-
"/127.0.0.1(:[0-9]+)?$,/192.160.0.105(:[0-9]+)?$"

Here 192.160.0.105 is my internal IP address, you should replace it with your IP.

  • Go to ./hack/lib/init.sh (I tried KUBERNETES_NO_PROXY env variable, but this didn’t work, ’cause init.sh script no_proxy doesn’t have predefined $no_proxy prefix for export command! This I think is a bug!)

search for “no_proxy”

export no_proxy=127.0.0.1,localhost (default value)

Change this to below

export no_proxy=127.0.0.1,192.160.0.105,10.122.49.221,localhost

You can add list of IP addresses that you want for no_proxy.

  • After this you can make changes to local-up-cluster.sh start_apiserver method to have your internal ip 192.160.0.105 instead of 127.0.0.1 (etcd ip can be retained to 127.0.0.1) for insecure-bind-address, bind-address.

Finally, do UP your local cluster…


$./hack/local-up-cluster.sh

Categories: General, kubernetes Tags: ,