Accessing remote kubernetes cluster on azure using kubectl

0 votes

I am running one of my kubernetes clusters on azure. How can I access it from a local kubectl command. I referred the docs but I do not have any kube config file. And if I view do a kube config view I get:

apiVersion: v1
clusters: []
contexts: []
current-context: ""
kind: Config
preferences: {}
users: []
Sep 11, 2018 in Kubernetes by Atul
• 5,530 points
59 views

1 answer to this question.

0 votes

So, try this. Edit your kube config file inside the ~/.kube/config like:

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

Set the context by running:

kubectl config use-context test

Now you can interact with the cluster. Also, to add the certification follow: http://kubernetes.io/docs/user-guide/kubeconfig-file/

Or run this command:

kubectl config set-cluster test-cluster --server=http://<master-ip>:<port> --api-version=v1
kubectl config use-context test-cluster
answered Sep 11, 2018 by ajs3033
• 7,280 points

Related Questions In Kubernetes

0 votes
1 answer

“403 Insufficient Permission” while creating a Kubernetes Cluster on Google Cloud instance

To run ./cluster/kube-up.sh, you most likely need compute scope ...READ MORE

answered Aug 28, 2018 in Kubernetes by Kalgi
• 41,460 points
145 views
0 votes
1 answer

Unable to run Kubernetes on rancher cluster

switch Docker to 1.12.x; Kubernetes doesn't support ...READ MORE

answered Aug 28, 2018 in Kubernetes by Kalgi
• 41,460 points
151 views
0 votes
1 answer

Deepstream.io on Kubernetes cluster

Kompose doesn’t support host volume mounting. Instead ...READ MORE

answered Sep 3, 2018 in Kubernetes by Kalgi
• 41,460 points
137 views
0 votes
1 answer
0 votes
1 answer

permissions related to AWS ECR

if you add allowContainerRegistry: true, kops will add those permissions ...READ MORE

answered Oct 9, 2018 in Kubernetes by Kalgi
• 41,460 points
68 views
0 votes
1 answer
0 votes
3 answers

Error while joining cluster with node

Hi Kalgi after following above steps it ...READ MORE

answered Jan 17 in Others by anonymous
2,523 views
0 votes
1 answer

automating cluster setup and app deplument on kubernetes

Go through Google Cloud Deployment Manager. it automates ...READ MORE

answered Jul 5, 2018 in Kubernetes by ajs3033
• 7,280 points
45 views
0 votes
1 answer

Using kubernetes API on GKE

When you create a cluster using GKE, ...READ MORE

answered Dec 6, 2018 in Kubernetes by ajs3033
• 7,280 points
136 views