Skip to content

Instantly share code, notes, and snippets.

@louwersj
Created November 3, 2021 09:49
Show Gist options
  • Save louwersj/b14a4205c68f5d272b708c9e7a830061 to your computer and use it in GitHub Desktop.
Save louwersj/b14a4205c68f5d272b708c9e7a830061 to your computer and use it in GitHub Desktop.
from kubernetes import client, config
# Load the connection config, default behaviour is to load ~/.kube/config
# For development this is fine, when moving into production another way
# of providing the config is required
config.load_kube_config()
v1 = client.CoreV1Api()
nameSpaceList = v1.list_namespace()
for nameSpace in nameSpaceList.items:
print(nameSpace.metadata.name)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment