Docker Desktop on Windows11: Kubectl get pods gives error on my laptop: The connection to the server 127.0.0.1:49994 was refused

I want to run Kubernetes locally so I can try it out on a small Java program I have written.

I installed WSL2 on my Windows11 laptop, Docker Desktop, and enabled Kubernetes in Docker Settings.

I was following along with your “Pods” solution on my local.

I open a terminal, type “wsl” to open a linux terminal. Then I issue the same command as in your quiz solution.

$ kubectl get pods
The connection to the server 127.0.0.1:49994 was refused - did you specify the right host or port?

What is

and

?
Please share links to the tutorials that you followed. Kubernetes API server would use a different port, not 49994.

I apologize for the late reply. I did not receive notification of a reply to my post.
Please ignore that line.
The basic command: kubectl get pods was not working.
Someone gave me the solution:

kubectl config use-context docker-desktop

No problem. Thank you for sharing the solution.

by the way, where is /etc/kubernetes in WSL2/docker desktop? I opened a new question.

Let’s leave the link of the new question here for future visitors Where is /etc/kubernetes in WSL2/Docker Desktop for Windows 11?