rubenhak
rubenhak

Reputation: 890

K8s Pod Lifecycle Hooks

I'd like to receive a notification whenever there are any changes to the kubernetes cluster. Pods are created/deleted, etc. This can be a in a form of a webhook, or a message in a pub/sub, etc anything that can be used in autonomous manner.

Running the kubernetes cluster in gcp.

Upvotes: 2

Views: 636

Answers (1)

rfum
rfum

Reputation: 368

You can get such events with creating hooks in linux compatible languages (such as go,python etc.) to relevant k8s object's watch endpoint. i.e./apis/apps/v1/watch/namespaces/{namespace}/deployments/{name} is the watch endpoint of Deployment object. You may find the watch endpoint of the object you desire from the API reference of k8s-api-server. https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.13/

Upvotes: 3

Related Questions