I'm creating a custom monitoring script for my self hosted kubernetes cluster on AWS. Among all other tools, Python client was of much interest for me. I have got a dictionary of pod and their status. Now I want to iterate the dict.keys (the pods in them basically) to check their Events from kubelet. I'm looking for the below data:
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Warning FailedMount 20m (x25188 over 44d) kubelet, ip-10-222-145-32.us-west-2.compute.internal MountVolume.SetUp failed for volume "sag-license-volume" : configmap "my-licence" not found
Warning FailedMount 35s (x72078 over 44d) kubelet, ip-10-222-155-32.us-west-2.compute.internal (combined from similar events): MountVolume.SetUp failed for volume "my-license-volume" : configmap "my-license" not found
I looked over the web and could only find examples related to namespace but not for individual pods.
Kindly help me to get this data over Python client. Thanks in Advance !