diff --git a/changelogs/fragments/k8s_auth_kubeconfig.yml b/changelogs/fragments/k8s_auth_kubeconfig.yml new file mode 100644 index 00000000000..d4c55494889 --- /dev/null +++ b/changelogs/fragments/k8s_auth_kubeconfig.yml @@ -0,0 +1,2 @@ +bugfixes: + - k8s - allow kubeconfig or context to be set without the other diff --git a/lib/ansible/module_utils/k8s/common.py b/lib/ansible/module_utils/k8s/common.py index f60c232fe9a..a49497577ff 100644 --- a/lib/ansible/module_utils/k8s/common.py +++ b/lib/ansible/module_utils/k8s/common.py @@ -152,7 +152,7 @@ class K8sAnsibleMixin(object): if auth_set('username', 'password', 'host') or auth_set('api_key', 'host'): # We have enough in the parameters to authenticate, no need to load incluster or kubeconfig pass - elif auth_set('kubeconfig', 'context'): + elif auth_set('kubeconfig') or auth_set('context'): kubernetes.config.load_kube_config(auth.get('kubeconfig'), auth.get('context')) else: # First try to do incluster config, then kubeconfig