Make example code using config.load_kube_config() more portable

This commit is contained in:
Jeff Schroeder 2016-11-30 19:43:34 -06:00
parent 9850b70283
commit 699d71cfac
3 changed files with 3 additions and 3 deletions

View File

@ -20,7 +20,7 @@ from kubernetes import client, config
def main():
# Configs can be set in Configuration class directly or using helper
# utility
config.load_kube_config(os.environ["HOME"] + '/.kube/config')
config.load_kube_config(os.path.join(os.path.expanduser('~'), '.kube', 'config')
v1 = client.CoreV1Api()
print("Listing pods with their IPs:")

View File

@ -20,7 +20,7 @@ from kubernetes import client, config, watch
def main():
# Configs can be set in Configuration class directly or using helper
# utility
config.load_kube_config(os.environ["HOME"] + '/.kube/config')
config.load_kube_config(os.path.join(os.path.expanduser('~'), '.kube', 'config')
v1 = client.CoreV1Api()
count = 10

View File

@ -20,7 +20,7 @@ from kubernetes import client, config
def main():
# Configs can be set in Configuration class directly or using helper
# utility
config.load_kube_config(os.environ["HOME"] + '/.kube/config')
config.load_kube_config(os.path.join(os.path.expanduser('~'), '.kube', 'config')
print("Supported APIs (* is preferred version):")
print("%-20s %s" %