How to configure kubectl command to access remote kubernetes cluster on azure?

0 votes

I have a kubernetes cluster running on azure. What is the way to access the cluster from local kubectl command. I referred to here but on the kubernetes master node there is no kube config file. Also, kubectl config view results in

apiVersion: v1
clusters: []
contexts: []
current-context: ""
kind: Config
preferences: {}
users: []

Any help here is appreciated.

Aug 10, 2018 in Azure by null_void
• 3,220 points
2,176 views

1 answer to this question.

0 votes

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 :

apiVersion: v1 
clusters:    
- cluster:
    server: http://<master-ip>:<port>
  name: test 
contexts:
- context:
    cluster: test
    user: test
  name: test

Then set context by executing:

kubectl config use-context test

After this you should be able to interact with the cluster.

Note : To add certification and key use following link : http://kubernetes.io/docs/user-guide/kubeconfig-file/

Alternately, you can also try following command:

kubectl config set-cluster test-cluster --server=http://<master-ip>:<port> --api-version=v1
kubectl config use-context test-cluster

answered Aug 10, 2018 by club_seesharp
• 3,450 points

Related Questions In Azure

0 votes
1 answer

How to deploy a simple static micro site on Microsoft Azure?

Try steps told in this tutorial: https://www.microsoft.com/middleeast/azureboxes/cloud-hosting-for-a-static-website.aspx This is not ...READ MORE

answered Sep 3, 2018 in Azure by null_void
• 3,220 points
33 views
0 votes
1 answer

How to perform Full Text Search on SQL Azure?

Azure Search is a search-as-a-service solution that ...READ MORE

answered Sep 25, 2018 in Azure by null_void
• 3,220 points
180 views
0 votes
1 answer

How to set default Web page for a website on Microsoft Windows Azure?

This blog post should resolve your issue: http://blogs.msdn.com/b/cesardelatorre/archive/2010/07/22/how-to-set-a-default-page-to-a-windows-azure-web-role-app-silverlight-asp-net-etc.aspx Look ...READ MORE

answered Mar 27 in Azure by Prerna
• 1,940 points
30 views
0 votes
1 answer

How to do Blue/Green Deployments on Azure ServiceFabric?

The thing is Service Fabric is all about ...READ MORE

answered Apr 5 in Azure by Prerna
• 1,940 points
19 views
0 votes
1 answer

How do disconnect to Azure SQL database if I can't access it?

Based on info  from Microsoft, I think ...READ MORE

answered Apr 26 in Azure by Prerna
• 1,940 points
52 views
0 votes
1 answer

How to register new users for MVC4 website on Azure AD?

The application holds the permissions to read/write ...READ MORE

answered Jul 3 in Azure by Perry
• 17,010 points
573 views
+1 vote
4 answers

How do Connect to Azure website via FTP?

First set up your FTP credentials are ...READ MORE

answered Oct 23, 2018 in Azure by abc
197 views
+1 vote
2 answers

How do I establish an connection to Azure IoT Hub? Say a connection like MQTT/AMQP using Python.

Azure IoT Hub comes with 3 SDK's: Service SDK Device ...READ MORE

answered Apr 13, 2018 in Azure by null_void
• 3,220 points
485 views
0 votes
1 answer

How to upload a file on to Azure Blob storage without writing a code?

You can find the below tools useful ...READ MORE

answered Apr 13, 2018 in Azure by club_seesharp
• 3,450 points
89 views
0 votes
1 answer

How can i upload to Azure Blob storage with Shared Access key?

For GetBlobReferenceFromServer to work, the blob must be present ...READ MORE

answered Jun 12, 2018 in Azure by club_seesharp
• 3,450 points
600 views