I needed a playground to quickly spin various data engineering platforms, including Apache Airflow and most of them had official helm charts to get up and running. It turned out, my personal laptop is running Windows 11 and has WSL on it, which, at the time of writing started to support systemd. I went through several resources and did some small additions on my own, which led to this quick guide. This guide was composed using the following resources:
- https://learn.microsoft.com/en-us/windows/wsl/install
- https://devblogs.microsoft.com/commandline/systemd-support-is-now-available-in-wsl/
- https://github.com/microsoft/WSL/releases
- https://microk8s.io/docs/getting-started
- https://airflow.apache.org/docs/helm-chart/stable/index.html
- Windows 11 which is at release 22H2 at the time of writing. Older releases of Windows 10/11 may or may not be supported
- WSL version 2 with "Preview" release of 0.7.0 or higher. This installed automatically with wsl --install, but if you have previous versions of WSL, please uninstall them or make sure you are using "Preview release" from the store or WSL releases URL below.
- Sufficient RAM and fast CPU. 16Gb / Ryzen 7 4000 series on my ThinkBook G14ARE2 work fine.
wsl --install
wsl --version
Version should be higher than 0.67
You can otherwise download preview version of WSL from https://github.com/microsoft/WSL/releases
You can install it using add-appxpackage <package.msix>
cmdlet in privileged Powershell
sudo tee -a /etc/wsl.conf << EOF
[boot]
systemd=true
EOF
wsl --shutdown
wsl
sudo snap install microk8s --classic
sudo usermod -a -G microk8s $USER
sudo chown -f -R $USER ~/.kube
newgrp microk8s
tee -a ~/.bashrc << EOF
alias kubectl=microk8s.kubectl
source <(microk8s.kubectl completion bash)
alias helm=microk8s.helm
source <(microk8s.helm completion bash)
EOF
source ~/.bashrc
microk8s status
microk8s enanble dashboard dns ha-cluster helm helm3 host-access hostpath-storage metrics-server storage
microk8s helm repo add apache-airflow https://airflow.apache.org
microk8s helm upgrade --install airflow apache-airflow/airflow --namespace airflow --create-namespace
kubectl --namespace airflow expose deployment airflow-webserver --type=NodePort --name airflow-webserver-nodeport
Check the node port service:
kubectl --namespace airflow get service | grep NodePort
# airflow-webserver-nodeport NodePort 10.152.183.103 <none> 8080:32700/TCP 3h43m
Note the port mapping 8080: and use WSL IP address and port number to access Airflow web UI. You can obtain IP address of your WSL bridge:
ip addr | grep 172
# this assumes your IP address of WSL bridge on Windows is 172.x.y.z