kubectl: how does it discover the incluster config?
You will have to construct a KUBECONFIG
by hand, given those values, since that's more-or-less exactly what the python client does anyway. In short, either in python or via the following commands:
kubectl config set-cluster the-cluster --server="https://${KUBERNETES_SERVICE_HOST}:${KUBERNETES_SERVICE_PORT}" --certificate-authority=/var/run/secrets/kubernetes.io/serviceaccount/ca.crtkubectl config set-credentials pod-token --token="$(cat /var/run/secrets/kubernetes.io/serviceaccount/token)"kubectl config set-context pod-context --cluster=the-cluster --user=pod-tokenkubectl config use-context pod-context
and then you're off to the races