callback-method like Options in kubernetes API

3/28/2018

I have been working on kubernetes REST API calls to create deployments and services using python client. Now the scenario is that i have to create deployment and when the pods get ready i have to tell users that their deployment is ready using some callback method. I can achieve this using cli like

watch kubectl describe pod <pod-name>

and looking into pod status. But how can i implement a call-back function which is called when pod status is changed e.g from container creating -> ready. Any help would be appreciated.

-- captainchhala
kubernetes
minikube

1 Answer

3/28/2018

I guess you could watch the events on the namespace where you are deploying the application, and react to that

Events such as the ones you saw at the end of kubectl describe pod are persisted in etcd and provide high-level information on what is happening in the cluster. To list all events you can use kubectl get events

-- Jose Armesto
Source: StackOverflow