MCPcopy Index your code
hub / github.com/kubernetes-client/python / main

Function main

examples_asyncio/in_cluster_config.py:59–80  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

57
58
59async def main():
60
61 while True:
62
63 try:
64
65 # it works only if this script is run by K8s as a POD
66 config.load_incluster_config()
67
68 v1 = client.CoreV1Api()
69 print("Listing pods with their IPs:")
70 ret = await v1.list_pod_for_all_namespaces()
71
72 for i in ret.items:
73 print(i.status.pod_ip, i.metadata.namespace, i.metadata.name)
74
75 except Exception:
76 traceback.print_exc(file=sys.stdout)
77
78 finally:
79 print("sleep 10s")
80 await asyncio.sleep(10)
81
82
83if __name__ == "__main__":

Callers 1

Calls 2

sleepMethod · 0.45

Tested by

no test coverage detected