Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save gregjhogan/0e80e687f5cfbd68eef0537e87f7dd24 to your computer and use it in GitHub Desktop.

Select an option

Save gregjhogan/0e80e687f5cfbd68eef0537e87f7dd24 to your computer and use it in GitHub Desktop.
kubernetes sdk python get secret using client from cli credentials
from base64 import b64decode
from kubernetes import client, config
config.load_kube_config()
v1 = client.CoreV1Api()
secret = v1.read_namespaced_secret('<secret-name>', 'default')
value = b64decode(secret.data["<property-name>"])
print(value)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment