k8s python api library
install the official library with pip install kubernetes
the default api config path for k8s is at ~/.kube/config
k3s
is at /etc/rancher/k3s/k3s.yaml
microk8s
is at /var/snap/microk8s/current/credentials/kubelet.config
you can also set KUBECONFIG
environment variable to let kubernetes
python library know where the config is
to use it:
https://github.com/kubernetes-client/python/blob/master/kubernetes/README.md
1 | from kubernetes import client, config |