I have multiple contexts and I want to be able to run commands against a context that I have access to but am not pointed to, while in another context.
How do I run a command, say $ kubectl get pods
against context B while I'm currently pointed to context A?
try this command
kubectl config set-context $(kubectl config current-context) --namespace=<namespace>
then run
kubectl get po
--context
is a global option for all kubectl commands. Simply run:
$ kubectl get pods --context <context_B>
For a list of all global kubectl options, run $ kubectl options