Prepare the Windows Subsystem for Linux environment
The Windows Subsystem for Linux is available from Windows version 1903. A quick look in the control panel confirms, the Windows at hand is even newer. Next, we go to the Microsoft Store to install Ubunto. The purchase is free and takes a little time. During installation, I enter my user name and the password.
Setting up Ubuntu distribution
Installing, this may take a few minutes... Please create a default UNIX user account. The username does not need to match your Windows username. For more information visit: https://aka.ms/wslusers Enter new UNIX username: markus New password: Retype new password: passwd: password updated successfully Installation successful! To run a command as administrator (user "root"), use "sudo <command>". See "man sudo_root" for details. Welcome to Ubuntu 20.04.2 LTS (GNU/Linux 4.4.0-19041-Microsoft x86_64) * Documentation: https://help.ubuntu.com * Management: https://landscape.canonical.com * Support: https://ubuntu.com/advantage System information as of Sat Mar 13 21:52:15 CET 2021 System load: 0.52 Usage of /home: unknown Memory usage: 53% Swap usage: 0% Processes: 7 Users logged in: 0 IPv4 address for eth1: 172.18.96.1 IPv4 address for wifi0: 192.168.178.86 IPv6 address for wifi0: 2001:16b8:141a:8300:a135:ef72:a79b:d6e6 IPv6 address for wifi0: 2001:16b8:141a:8300:ed76:2ea4:3a0b:205a 1 update can be installed immediately. 0 of these updates are security updates. To see these additional updates run: apt list --upgradable The list of available updates is more than a week old. To check for new updates run: sudo apt update This message is shown once a day. To disable it please create the /home/markus/.hushlogin file. markus@enousia:~$
The list option shows a list of available Linux environments. In consequence, I can see the ubuntu distribution. And two more distributions originated from Docker Desktop.
Verify the new distribution is applicable in WSL
PS C:UsersMarkus> wsl -l Windows-Subsystem für Linux-Distributionen: docker-desktop-data (Standard) docker-desktop Ubuntu-20.04
Set Ubuntu as new default and start distribution
PS C:UsersMarkus> wsl --set-default ubuntu-20.04 PS C:UsersMarkus> wsl Welcome to Ubuntu 20.04.2 LTS (GNU/Linux 5.4.72-microsoft-standard-WSL2 x86_64) * Documentation: https://help.ubuntu.com * Management: https://landscape.canonical.com * Support: https://ubuntu.com/advantage System information as of Sun Mar 14 00:23:25 CET 2021 System load: 0.01 Processes: 11 Usage of /: 0.4% of 250.98GB Users logged in: 0 Memory usage: 1% IPv4 address for eth0: 172.19.254.14 Swap usage: 0% 1 update can be installed immediately. 0 of these updates are security updates. To see these additional updates run: apt list --upgradable The list of available updates is more than a week old. To check for new updates run: sudo apt update This message is shown once a day. To disable it please create the /root/.hushlogin file.
In my case, the default user is the root user. I want WSL to use a non-privileged user. In this way, I configure the Linux distribution to use a different user.
Set non root user as default
PS C:UsersMarkus> ubuntu2004.exe config --default-user markus PS C:UsersMarkus> wsl markus@fuchur:/mnt/c/Users/Markus$
I use Minikube for local experiments. And Minikube was installed by Powershell. In this way, the location for .minikube and .kube configuration files is the Windows user’s home directory. Even so, these paths are not compatible with WSL. Given Linux, a drive letter, a colon, and backslashes are not part of a Unix path. Here I need a separate Linux configuration. Consequently, I copy the files to the Linux user’s home directory and fix the path expressions.
First, we must install the Kubernetes client. For installation, we add the repository to the package manager. Next, the package manager update operation discovers the packages. Finally, the kubectl is known and ready to install.
Install the Kubernetes client
sudo apt-get update && sudo apt-get install -y apt-transport-https curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add - echo "deb https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee -a /etc/apt/sources.list.d/kubernetes.list sudo apt-get update sudo apt-get install -y kubectl
Fix the Kubernetes client configuration
Up to here, the Kubernetes client does not work. The configuration is still missing. In that way, we copy it from the Windows home directory to ~.
Copy configuration from Windows side to Linux
cp -R /mnt/c/Users/Markus/.kube .kube
Unfortunately, this configuration requires some fixes. The Windows path is not compatible with Linux. In this way, we replace the drive letter and, of course, the backslashes. We edit .kube/config with the vi editor and apply substitutions:
VI substitution patterns
The seamless Linux integration is quite lovely. But in fact, using tools that store their configuration in the user’s home directory becomes confusing. Differences in Windows and Linux paths require much manual synchronization. Under those circumstances, synchronization becomes very challenging. As a result, I recommend working only on one of both sides. Therefore I chose the Linux side. So I use tools like minikube, kubectl, or any of the other tools only here. In this way, there is no need to synchronize configuration files between both worlds.
Interested in more postings?
Setting up the workstation with small auxiliary tools is done quickly for the individual. In a growing team, the setup quickly becomes a challenge. Containers can help and bring everything ready configured to each individual's workplace. Setting up the new laptop The...
Openshift and also OKD Docker image is stuck when loading. A severe bug in the CRI-O engine causes stuck the OKD Docker images in an invalid and unusable state. There are discussions about timeouts while loading the images from the docker registry or too long...
The POD fails to start, and referrers to the image layer not known. The "layer not known" issue may affect one or more cluster nodes. In effect, there is a corrupt docker image on the local disk cache. The layer not known problem still exists, even after a node or...
Where are the Docker daemon configuration files located? How to restart the Docker daemon after applying changes to the configuration? How to change and activate the Docker configuration? These are frequently asked questions. But changes to the Docker configuration...
Docker Content Trust feature enables your environment to run only with signed images. In this way, Docker Content Trust ensures that the docker pulls only signed containers from the docker registry. Once enabled, Docker Content Trust is active for all docker pull...
Docker uses default address pools to create subnets. For most use cases, the shipped defaults fit. But sometimes they cause conflicts with existing networks or subnets. Overlapping networks may conflict with existing systems. Or a large number of docker networks...
Docker uses default address pools to create subnets. For most use cases, the shipped docker subnet defaults fit. But sometimes the docker subnets cause conflicts with existing networks or subnets. Overlapping networks may conflict with existing systems. Or a large...
Docker software containerization reviewed Putting Software into containers seems to be state of the art. But what are the benefits? Are there any drawbacks? Most people have heard about docker technology. And not less have used docker. But we are looking towards more...
Docker is a lightweight framework for virtualizing application processes. Instead of emulating a computer hardware that still needs an operating system to run applications, Docker takes a different approach. Docker is able to pretend an operating system environment to...