Make sure the firewall allows port 179 as specified here.
sudo for Windows
In Windows, with the use of powershell, at some point in time you will feel the need to elevate the privileges while in the same terminal, akin to sudo in Linux. Two options are mentioned below.
Using runas verb as below. This launches a new window.
start-process PowerShell -verb runas
Using gsudo from here, which is my personal favorite. Install it using below command.
winget install gerardog.gsudo
Once installed it can be used like below:
gsudo notepad
Interesting Developer Topics
With the change of docker desktop licensing terms this article shows us how to run containers without docker desktop.
Kubectl installation on Windows
I found it easier to keep executable files that are not managed by Windows itself in a custom folders at “C:\Program Files (Folder)”. Executables are placed under their individual folder, path to which gets added to the Windows machine’s Path variable.
Find the latest version of kubectl from here. CD into the folder where you would like to store the kubectl executable. Keep in mind, this folder will be added to Windows machine’s path variable. In the current example this will be at “C:\Program Files (Folder)\Kubernetes”. Follow the commands below to create the folder and download kubectl.
c:\
c:\mkdir "Program Files (Folder)"
c:\cd "Program Files (Folder)"
c:\Program Files (Folder)\mkdir Kubernetes
c:\Program Files (Folder)\cd Kubernetes
c:\Program Files (Folder)\Kubernetes\
Once in the folder use the command below to download the desired version of kubectl. Replace {VERSION} with the desired version.
curl -LO "https://dl.k8s.io/release/{VERSION}/bin/windows/amd64/kubectl.exe"
Also download the checksum file using the command below.
curl -LO "https://dl.k8s.io/{VERSION}/bin/windows/amd64/kubectl.exe.sha256"
validate the executable against the checksum.
Manually:
c:\Program Files (Folder)\Kubernetes\CertUtil -hashfile kubectl.exe SHA256
c:\Program Files (Folder)\Kubernetes\type kubectl.exe.sha256
Using powershell:
$($(CertUtil -hashfile .\kubectl.exe SHA256)[1] -replace " ", "") -eq $(type .\kubectl.exe.sha256)
Once verified add the kubectl folder path to the machine’s Path variable using the command below. This requires elevated privileges.
[Environment]::SetEnvironmentVariable("Path", "$($env:path);c:\Program Files (Folder)\Kubernetes", [System.EnvironmentVariableTarget]::Machine)
Reload the Path environment variable.
$env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine")
At this point you should be able to use kubectl to manage your kubernetes cluster. Make sure your user profile folder has a .kube directory and a valid kubernetes cluster config file inside it.
WSL Issues
How to fix “Access is denied” error when starting WSL?
Shutdown WSL using the following command in any terminal. Don’t worry, this will NOT shutdown your windows PC.
wsl --shutdown
Once the above command returns, start bash as administrator. WSL should greet you with Linux prompt.
How to upgrade WSL – Ubuntu LTS Linux distribution?
Update and upgrade apt repositories using commands below.
sudo apt update
sudo apt upgrade
Check availability of upgrade using the command below.
sudo do-release-upgrade -c
If upgrade is available, upgrade using the command below.
sudo do-release-upgrade
If for some reason it does not work, try with -p option like below.
sudo do-release-upgrade -p
To see what options available using the upgrade tool, run the command below.
sudo do-release-upgrade --help
How to fix “Restoring original system state. Aborting” error when upgrading WSL – Ubuntu distribution?
Sometimes, when upgrading the Linux distribution, the upgrade fails silently with the below messages.
Restoring original system state
Aborting
Reading package lists... Done
Building dependency tree
Reading state information... Done
See why the upgrades are failing by running the following command.
cat /var/log/dist-upgrade/main.log
Most likely, snapd and screen are causing the upgrade to fail. Remove these programs by running the below commands.
sudo apt purge snapd
sudo apt purge screen
If this is not the reason upgrades are failing, check the log and resolve any other issue that is reported in the log. Once all the issues are resolve, the release upgrade should complete successfully.