What Linux distribution are you using in WSL? Another pertinent question is from @Philippe
The kubectl you use, is it WSL or Windows version ?
Are you running the kubectl client provided by az aks install-cli in the WSL Linux distribution? C: is going to be only available from the WSL Linux shell as /mnt/c/ so you are not supposed to get any message with a path like C:\Users\my-windows-user\.kube\config
. Please ensure you are using the linux kubectl executable from a WSL shell.
In my case, I use Ubuntu 20.04 LTS [How-to install] with WSL. Following is a sample:
Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.
Install the latest PowerShell for new features and improvements! https://aka.ms/PSWindows
Loading personal and system profiles took 1725ms.
❯ srbose@xxxxxxx ❯ ~ ❯
❯ bash
srbose@xxxxxxx:/mnt/c/Users/srbose$ cat /etc/os-release
NAME="Ubuntu"
VERSION="20.04.2 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.2 LTS"
VERSION_ID="20.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal
srbose@xxxxxxx:/mnt/c/Users/srbose$ az aks get-credentials -g $RG -n akstest
The behavior of this command has been altered by the following extension: aks-preview
/home/srbose/.kube/config has permissions "644".
It should be readable and writable only by its owner.
Merged "akstest" as current context in /home/srbose/.kube/config
srbose@xxxxxxx:/mnt/c/Users/srbose$
The default behaviour is as follows:
If the --kubeconfig
flag is set, use only the specified file. Do not merge. Only one instance of this flag is allowed.
Otherwise, if the KUBECONFIG
environment variable is set, use it as a list of files that should be merged. Merge the files listed in the KUBECONFIG
environment variable according to these rules:
- Ignore empty filenames.
- Produce errors for files with content that cannot be deserialized.
- The first file to set a particular value or map key wins.
- Never change the value or map key. Example: Preserve the context of the first file to set
current-context
. Example: If two files specify a red-user
, use only values from the first file's red-user
. Even if the second file has non-conflicting entries under red-user
, discard them.
For an example of setting the KUBECONFIG
environment variable, see Setting the KUBECONFIG environment variable.
Otherwise, use the default kubeconfig file, $HOME/.kube/config
, with no merging. For more information please check this article.
You can check if the KUBECONFIG environment variable is set using
echo $KUBECONFIG