0

After install kubectl in WSL, if I connect with my Azure cluster using following command

az account set --subscription <subscription ID>
az aks get-credentials --resource-group <RG name> --name <Cluster name>
kubectl get ns

It is not able to connect & showing following error.

localhost:8080 was refused - did you specify the right host or port

1 Answer 1

4

I face huge problem to install WSL & install kubectl into WSL. Using this following steps I have install both the component successfully in my system. Please find the following.

Step 1:- Enable Windows subsystem for linux :- check this reference it will guide you to install WSL properly in your system.

https://www.windowscentral.com/install-windows-subsystem-linux-windows-10

Step 2:- Install kubectl into WSL. find the following reference link it will help you (https://rancher.com/learning-paths/how-to-manage-kubernetes-with-kubectl/)

I use the following command step by step. For my case kubectl already install in my windows PowerShell

Now your kubectl get install in your ubuntu terminal. we can execute the following command to test kubectl.

az account set --subscription <subscription ID>
az aks get-credentials --resource-group <RG name> --name <Cluster name>

Test your kubectl configuration to execute following command

kubectl config get-contexts

if it's not showing your cluster details or it's showing following error

The connection to the server localhost:8080 was refused - did you specify the right host or port

Don't worry.. I did a trick, I locate my c:\Users\<username>\.kube\config file and copy it into my WSL cp config ~/.kube/

After that it's start working.

Not the answer you're looking for? Browse other questions tagged or ask your own question.