diff --git a/README.md b/README.md index 855b24f25..e477d73da 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ import os from kubernetes import client, config # 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:") @@ -48,7 +48,7 @@ import os from kubernetes import client, config, watch # 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 diff --git a/examples/example1.py b/examples/example1.py index 0aeed2016..e74be96cf 100644 --- a/examples/example1.py +++ b/examples/example1.py @@ -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:") diff --git a/examples/example2.py b/examples/example2.py index f594407d8..a02d56355 100644 --- a/examples/example2.py +++ b/examples/example2.py @@ -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 diff --git a/examples/example3.py b/examples/example3.py index deb1abcff..01f152bd3 100644 --- a/examples/example3.py +++ b/examples/example3.py @@ -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" %