Where is /etc/kubernetes in WSL2/Docker Desktop for Windows 11?

I have WSL2/Docker Desktop for Windows 11.
I have enabled Kubernetes in the Settings.
However when I try to do this example on Encrypting Data At Rest in Kubernetes, I do not see /etc/kubernetes

$ ls /etc/
NetworkManager dpkg legal overlayroot.local.conf shells
PackageKit e2scrub.conf libaudit.conf pam.conf skel
X11 ec2_version libblockdev pam.d sos
adduser.conf environment locale.alias passwd sos.conf
alternatives ethertypes locale.gen passwd- ssh
apparmor fonts localtime perl ssl
apparmor.d fstab logcheck pki subgid
apport fuse.conf login.defs pm subgid-
apt fwupd logrotate.conf polkit-1 subuid
at.deny gai.conf logrotate.d pollinate subuid-
bash.bashrc groff lsb-release popularity-contest.conf sudoers
bash_completion group ltrace.conf profile sudoers.d
bash_completion.d group- lvm profile.d sysctl.conf
bindresvport.blacklist grub.d machine-id protocols sysctl.d
binfmt.d gshadow magic pulse systemd
byobu gshadow- magic.mime python3 terminfo
ca-certificates gss mailcap python3.8 timezone
ca-certificates.conf hdparm.conf mailcap.order rc0.d tmpfiles.d
ca-certificates.conf.dpkg-old host.conf manpath.config rc1.d ubuntu-advantage
calendar hostname maven rc2.d ucf.conf
cloud hosts mdadm rc3.d udev
console-setup hosts.allow mime.types rc4.d udisks2
cron.d hosts.deny mke2fs.conf rc5.d ufw
cron.daily init.d modprobe.d rc6.d update-manager
cron.hourly initramfs-tools modules rcS.d update-motd.d
cron.monthly inputrc modules-load.d resolv.conf update-notifier
cron.weekly iproute2 mtab rmt usb_modeswitch.conf
crontab iscsi multipath.conf rpc usb_modeswitch.d
cryptsetup-initramfs issue nanorc rsyslog.conf vim
crypttab issue.net netplan rsyslog.d vmware-tools
dbus-1 java-11-openjdk network screenrc vtrgb
dconf kernel networkd-dispatcher security vulkan
debconf.conf kernel-img.conf networks selinux wgetrc
debian_version landscape newt sensors.d xattr.conf
default ld.so.cache nsswitch.conf sensors3.conf xdg
deluser.conf ld.so.conf opt services zsh_command_not_found
depmod.d ld.so.conf.d os-release shadow
dhcp ldap overlayroot.conf shadow-

Docker Desktop is mainly for developing containerized applications. You can run Kubernetes, but it is not designed to reconfigure the server by changing configuration files. Everything is inside the virtual machine of Docker Desktop, but in Docker Desktop, the Docker daemon is running in a containerd container so there are multiple layers of containers here. It means the root folder of the container is not the same as the root folder of the WSL distribution:

If you want to see the files you can run the following command:

docker run --rm -it --privileged --pid host ubuntu:20.04 \
  nsenter --all -t 1 \
    -- ls -l /etc/kubernetes/

It will run nsenter in an ubuntu container, then nsenter will run “ls” in the virtual machine.

Update: I realized that I have just run the command in the virtual machine so it is in the system root, but I ran it on macOS. Docker Dekstop for Windows should work the same way. I guess you ran the command in an other WSL distribution.

If you want to change configuration files, I would use Multipass instead

multipass launch --name kubernetes minikube

Thank you. I did not understand before,

Everything is inside the virtual machine of Docker Desktop, but in Docker Desktop, the Docker daemon is running in a containerd container so there are multiple layers of containers here. It means the root folder of the container is not the same as the root folder of the WSL distribution:

I wish there was a simpler solution.

I updated my previous post, but I still recommend using multipass if you want to change the config.

Kubernetes is not simple and Docker Desktop is not simple either. It is a very complex tool with its limits so you can practice the basics. Encryption at rest is not basic :slight_smile:

1 Like

Encryption at rest is not basic

Just for the sake of passing the CKAD exam

There was a CNCF webinar on youtube two weeks ago. The speaker talked about encryption at rest and he used minikube too. Multipass can start a minikube VM, but you can install it directly on Windows if you want to

1 Like

@rimelek “It means the root folder of the container is not the same as the root folder of the WSL distribution:”

But I am able to run the kubectl commands in the wsl terminal.
Also I had problems running minikube and there is no support for it - no one replies in the minikube forums, so I was happy that I could just enable k8s in DD and run it.

I explained it in the other topic. Kubectl is just the client command. The server can be anywhere.