Created
September 21, 2018 16:38
-
-
Save chiradeep/80a76a661309b193a458351814bf398f to your computer and use it in GitHub Desktop.
Watch for changes in Endpoints using K8s native Python client
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from kubernetes import client, config, watch | |
config.load_kube_config() | |
api_v1 = client.CoreV1Api() | |
def watch_endpoints(): | |
w = watch.Watch() | |
for event in w.stream(api_v1.list_namespaced_endpoints, "default"): | |
print(event) | |
if __name__ == '__main__': | |
watch_endpoints() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment