How to invoke events on a pod using kubectl

9/24/2018

I would like to monitor the pods running on my cluster, using a python script. I wrote that script, which will check if there are new events happening on my pods (+extra logic and custom logging).

Now I would like to know if my script is correct. Is there a way to invoke events on the pods by hand, i.e. using kubectl?

Thanks!

-- A_test_user
events
kubernetes
monitoring
python

1 Answer

9/25/2018

To get events you can use kubectl get events, keep in mind that events are namespaced. This means you need to specify a namespace object, like this kubectl get events --namespace=my-namespace. Or you can list all namespaces by using kubectl get events --all-namespaces.

You can read the detailed explanation and other examples of debugging Kubernetes inside Application Introspection and Debugging

-- Crou
Source: StackOverflow