Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from kubernetes import client, config, watch
- def main():
- # Configs can be set in Configuration class directly or using helper
- # utility. If no argument provided, the config will be loaded from
- # default location.
- config.load_kube_config()
- v1 = client.CoreV1Api()
- count = 10
- w = watch.Watch()
- for event in w.stream(v1.list_namespace, timeout_seconds=10):
- print("Event: %s %s" % (event['type'], event['object'].metadata.name))
- count -= 1
- if not count:
- w.stop()
- print("Ended.")
- if __name__ == '__main__':
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement