I'm seeking the answer regarding how to use the Kubernetes Python API to check health
I am using:
kubectl get --raw='/readyz?verbose'
kubectl get --raw='/readyz?verbose'
is probing the /readyz
endpoint of the Kubernetes apiserver.
If you want to check the current running and ready state of a Pod and its containers, you can look at the Pod's status.Conditions
and status.ContainerStatuses
field.
If you want to probe the health endpoints of a container directly, you can use kubectl proxy
or kubectl port-forward
to open a proxy connection into the Pod's network namespace, then probe the health endpoint through that proxy.