I did this small POC to learn how a pod access the k8s API. You can read more about it in the documentation. To run it, use local k8s deployment (minikube for example). Do not run this on a production cluster - the code will change labels on the nodes. After setting up the cluster, simply run:
kubectl apply -f .
And than use kubectl get nodes, to see the new label apply to the nodes.
The code here is based upon this example, from the official k8s python client repository.
Content type
Image
Digest
Size
36.7 MB
Last updated
over 8 years ago
docker pull omerl/pod_kube_api_demo