Configure Kubernetes for an Azure cluster

4/28/2016

I followed the guide to getting Kubernetes running in Azure here:

http://kubernetes.io/docs/getting-started-guides/coreos/azure/

In order to create pods, etc., the guide has you ssh into the master node kube-00 in the cloud service and run kubectl commands there:

ssh -F ./output/kube_randomid_ssh_conf kube-00

Once in you can run the following:

kubectl get nodes
kubectl create -f ~/guestbook-example/

Is it possible to run these kubectl commands without logging to the master node, e.g., how can I set up kubectl to connect to the cluster hosted in Azure from my development machine instead of ssh'ing into the node this way?

I tried creating a context, user and cluster in the config but the values I tried using did not work.

Edit
For some more background the tutorial creates the azure cluster using a script using the Azure CLI. It ends up looking like this:

Resource Group: kube-randomid
    - Cloud Service: kube-randomid
      - VM: etcd-00
      - VM: etcd-01
      - VM: etcd-02
      - VM: kube-00
      - VM: kube-01
      - VM: kube-02

It creates a Virtual Network that all of these VM's live in. As far as I can tell all of the machines in the cloud service share a single virtual IP.

-- Dismissile
azure
kubernetes

1 Answer

5/2/2016

The kubectl command line tool is just a wrapper to execute remote HTTPS API REST calls on the kubernetes cluster. If you want to be able to do so from your own machine you need to open the correct port (443) on your master node and pass along some parameters to the kubectl tool as specified in this tutorial:

https://coreos.com/kubernetes/docs/latest/configure-kubectl.html

-- Mark van Straten
Source: StackOverflow