Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
def test_to_list_all_namespaces(k8s_client):
ret = k8s_client.list_namespace()
nscount = len(ret.items)
print(nscount)
assert(nscount > 0)
# Iterate through all the namespaces in the K8s cluster and list it down
for item in ret.items:
print(item.metadata.name)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment