How to configure kubectl from another pc?Namespaces are empty

7/22/2019

I have successfully setup the kubectl cli on my laptop to connect to my azure cluster. If I make, for example:

kubectl config get-contexts

I get my namespaces and I can see my resources by navigating to the current namespace. Now I need to replicate this setup on another laptop of mine and I made the following:

az login <--login to azure
az aks install-cli <--install of kubectl
az aks get-credentials --resource-group myResourceGroup --name myCluster <--linking kubectl to my cluster

Problem is that, if I make get-contexts again I only get the default namespace. And, of course, that namespace is empty as I put my deployment in another one.

What am I missing?

-- Phate
azure
kubectl
kubernetes

1 Answer

7/22/2019

so I'm not sure what the actual question is. if your resources are in different namespace, you can query those namespaces like you normally would:

kubectl get pods -n othernamespace
kubectl edit deployment xxx -n othernamespace

you can set the default namespace for the context like so:

kubectl set-context xxx --namespace othernamespace
-- 4c74356b41
Source: StackOverflow