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 11, 2018 in Azure by null_void
• 3,220 points
10,018 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 11, 2018 by club_seesharp
• 3,450 points

Related Questions In Azure

0 votes
1 answer

How to get access credentials for a managed Kubernetes cluster in Azure?

Hi@akhtar, After creating the Kubernetes Cluster, you need ...READ MORE

answered Nov 17, 2020 in Azure by MD
• 95,460 points
800 views
0 votes
1 answer

How to manage access to my shared dashboard on Azure portal?

After the dashboard is published, manage who ...READ MORE

answered Dec 26, 2019 in Azure by Sirajul
• 59,230 points
2,372 views
0 votes
1 answer

How to scale the node pool in a managed Kubernetes cluster in Azure?

Hi@akhtar, A node pool is a group of nodes within a ...READ MORE

answered Nov 17, 2020 in Azure by MD
• 95,460 points
784 views
0 votes
1 answer

How to update an existing Kubernetes cluster with new service principal in Azure?

Hi@akhtar, Sometimes it is required to update the ...READ MORE

answered Nov 17, 2020 in Azure by MD
• 95,460 points

edited Oct 7, 2021 by Sarfaraz 1,165 views
0 votes
1 answer

How to add a node pool to the managed Kubernetes cluster in Azure?

Hi@akhtar, You can add an extra node pool ...READ MORE

answered Nov 17, 2020 in Azure by MD
• 95,460 points
932 views
0 votes
2 answers

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

Create an Azure Storage account ("hot file" ...READ MORE

answered Jun 4, 2020 in Azure by René
1,393 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
1,732 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, 2019 in Azure by Prerna
• 1,960 points
3,003 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
1,606 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
3,603 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP