<p>I have a kubernetes cluster running on azure. What is the way to access the cluster from local kubectl command. I referred to <a href="http://kubernetes.io/docs/user-guide/sharing-clusters/" rel="noreferrer">here</a> but on the kubernetes master node there is no kube config file. Also, kubectl config view results in </p>

<pre><code>apiVersion: v1
clusters: []
contexts: []
current-context: ""
kind: Config
preferences: {}
users: []
</code></pre>

<p>Found a way to access remote kubernetes cluster without ssh'ing to one of the nodes in cluster. You need to edit ~/.kube/config file as below :</p>

<pre><code>apiVersion: v1 
clusters:    
- cluster:
    server: http://&lt;master-ip&gt;:&lt;port&gt;
  name: test 
contexts:
- context:
    cluster: test
    user: test
  name: test
</code></pre>

<p>Then set context by executing:</p>

<pre><code>kubectl config use-context test
</code></pre>

<p>After this you should be able to interact with the cluster.</p>

<p>Note : To add certification and key use following link : <a href="http://kubernetes.io/docs/user-guide/kubeconfig-file/" rel="noreferrer">http://kubernetes.io/docs/user-guide/kubeconfig-file/</a></p>

<p>Alternately, you can also try following command</p>

<pre><code>kubectl config set-cluster test-cluster --server=http://&lt;master-ip&gt;:&lt;port&gt; --api-version=v1
kubectl config use-context test-cluster
</code></pre>
