We have discussed it in the other topic
Since you are preparing for an exam, I suggest you try to understand the components of Kubernetes. It is out of the scope of Docker Desktop, but since the issue is also related to how Docker Desktop works, here is a short summary:
Kubernetes has an API server which is the only component with which you can communicate directly. It doesn’t have to be installed locally. You could connect to a Kubernetes cluster running on AWS or any remote servers. The fact that you have kubectl command doesn’t mean you will find any configuration locally.
Docker Desktop runs Kubernetes and Docker containers in a virtual machine. And that virtual machine runs everything in containers. Including the Docker daemon. The following command shows you /etc/kubernetes/
(I shared it in the other topic too)
docker run --rm -it --privileged --pid host ubuntu:20.04 \
nsenter --all -t 1 \
-- ls -l /etc/kubernetes/
It runs a container and as a privileged container it can enter the kernel namespaces of the virtual machine so you can list files outside of the container but inside Docker Desktop’s virtual machine.
You can find the files, but only because it is stored on the filesystem of the virtual machine but kubectl is not installed there. The following command would not work
docker run --rm -it --privileged --pid host ubuntu:20.04 \
nsenter --all -t 1 \
-- kubectl version
You can also access the container that runs the Docker daemon and get the kubectl command (not the one that you have on your physical host, the Windows OS)
docker run --rm -it --privileged --pid host ubuntu:20.04 \
nsenter --all -t 1 \
-- ctr -n services.linuxkit task exec -t --exec-id test docker \
kubectl version
The kubectl command on your windows can communicate with the API server but it doesn’t need any server-side configuration file.
Even if you are using a WSL distribution that will only contain the command, not the server.