With the kubectl command line, I can run commands in a given context using the --context flag, such as:
kubectl --context <MyContext> get deploy messenger
However, when I am trying to list pods using the following API, there does not appear to be a way to pass in the context.
from kubernetes import client
v1 = client.CoreV1Api()
pods = v1.list_namespaced_pod("messenger")
The command above seems to give me the pods in the current context.
Is there a way to list the pods under a different context using the Python API?
I've looked at the following docs and looked for the string context but haven't found anything illuminating.
https://kubernetes.io/docs/tasks/administer-cluster/access-cluster-api/ https://github.com/kubernetes-client/python/blob/master/kubernetes/README.md