Skip to content

Instantly share code, notes, and snippets.

@langheran
Created September 2, 2024 17:14
Show Gist options
  • Save langheran/85258e8a44a73a297fc7f3b23ecbdabc to your computer and use it in GitHub Desktop.
Save langheran/85258e8a44a73a297fc7f3b23ecbdabc to your computer and use it in GitHub Desktop.
C:\Users\NisimHurst\NDS\scripts\monitor_kubectl.py
from kubernetes import client, config, watch
config.load_kube_config()
v1 = client.CoreV1Api()
w = watch.Watch()
for event in w.stream(v1.list_namespaced_pod, namespace='default'):
print(f"Event: {event['type']} - Pod: {event['object'].metadata.name}")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment