multipass set local.driver=hyperv
In an admin powershell console running Windows 11, I executed this command: restart-service Multipass
multipass launch multipass start
PS C:\Users\Tjen> multipass version
multipass 1.13.1+win
multipassd 1.13.1+win
PS C:\Users\Tjen> multipass launch -c 1 -m 1G -d 4G -n k3s-master lts
launch failed: Remote "" is unknown or unreachable.
PS C:\Users\Tjen> multipass launch -c 1 -m 1G -d 4G -n k3s-master lts
Launched: k3s-master
PS C:\Users\Tjen> multipass list
Name State IPv4 Image
k3s-master Running 172.19.238.76 Ubuntu 24.04 LTS
PS C:\Users\Tjen> multipass launch -c 1 -m 2G -d 200G -n k3s-worker-1 lts
Launched: k3s-worker-1
PS C:\Users\Tjen> multipass list
Name State IPv4 Image
k3s-master Running 172.19.238.76 Ubuntu 24.04 LTS
k3s-worker-1 Running 172.19.236.180 Ubuntu 24.04 LTS
PS C:\Users\Tjen> multipass exec k3s-master -- bash -c "curl -sfL
https://get.k3s.io
| sh -"
[INFO] Finding release for channel stable
[INFO] Using v1.29.4+k3s1 as release
[INFO] Downloading hash https://github.com/k3s-io/k3s/releases/download/v1.29.4+k3s1/sha256sum-amd64.txt
[INFO] Downloading binary https://github.com/k3s-io/k3s/releases/download/v1.29.4+k3s1/k3s
[INFO] Verifying binary download
[INFO] Installing k3s to /usr/local/bin/k3s
[INFO] Skipping installation of SELinux RPM
[INFO] Creating /usr/local/bin/kubectl symlink to k3s
[INFO] Creating /usr/local/bin/crictl symlink to k3s
[INFO] Creating /usr/local/bin/ctr symlink to k3s
[INFO] Creating killall script /usr/local/bin/k3s-killall.sh
[INFO] Creating uninstall script /usr/local/bin/k3s-uninstall.sh
[INFO] env: Creating environment file /etc/systemd/system/k3s.service.env
[INFO] systemd: Creating service file /etc/systemd/system/k3s.service
[INFO] systemd: Enabling k3s unit
Created symlink /etc/systemd/system/multi-user.target.wants/k3s.service → /etc/systemd/system/k3s.service.
[INFO] systemd: Starting k3s
PS C:\Users\Tjen> multipass exec k3s-master sudo cat /var/lib/rancher/k3s/server/node-token
K10867002ba75c162a27604d35810781bf2c8d7d2d54c412abb20b959b39beead37::server:371d1accaab38ca9d69c9f8423b08a65
PS C:\Users\Tjen> $TOKEN=“K10867002ba75c162a27604d35810781bf2c8d7d2d54c412abb20b959b39beead37::server:371d1accaab38ca9d69c9f8423b08a65”
PS C:\Users\Tjen> multipass info k3s-master | grep IPv4 | awk '{print $2}'
grep : The term ‘grep’ is not recognized as the name of a cmdlet, function, script file, or operable program. Check
the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:29
-
multipass info k3s-master | grep IPv4 | awk ‘{print $2}’
-
~~~~
-
CategoryInfo : ObjectNotFound: (grep:String) [], CommandNotFoundException
-
FullyQualifiedErrorId : CommandNotFoundException
-
PS C:\Users\Tjen> multipass info k3s-master
Name: k3s-master
State: Running
Snapshots: 0
IPv4: 172.19.238.76
10.42.0.0
10.42.0.1
Release: Ubuntu 24.04 LTS
Image hash: 32a9d30d1880 (Ubuntu 24.04 LTS)
CPU(s): 1
Load: 0.19 0.24 0.13
Disk usage: 2.4GiB out of 3.8GiB
Memory usage: 750.8MiB out of 896.3MiB
Mounts: –
PS C:\Users\Tjen> $IP=172.19.238.76
PS C:\Users\Tjen> echo $TOKEN
K10867002ba75c162a27604d35810781bf2c8d7d2d54c412abb20b959b39beead37::server:371d1accaab38ca9d69c9f8423b08a65
PS C:\Users\Tjen> echo “$TOKEN $IP”
K10867002ba75c162a27604d35810781bf2c8d7d2d54c412abb20b959b39beead37::server:371d1accaab38ca9d69c9f8423b08a65
PS C:\Users\Tjen> $IP=“172.19.238.76”
PS C:\Users\Tjen> echo “$TOKEN $IP”
K10867002ba75c162a27604d35810781bf2c8d7d2d54c412abb20b959b39beead37::server:371d1accaab38ca9d69c9f8423b08a65 172.19.238.76
PS C:\Users\Tjen> multipass exec k3s-worker-1 -- bash -c "curl -sfL
https://get.k3s.io
| K3S_URL=\"https://$IP:6443\" K3S_TOKEN=\"$TOKEN\" sh -"
K3S_TOKEN=\K10867002ba75c162a27604d35810781bf2c8d7d2d54c412abb20b959b39beead37::server:371d1accaab38ca9d69c9f8423b08a65: -c: line 1: unexpected EOF while looking for matching `"’
PS C:\Users\Tjen> multipass exec k3s-worker-1 -- bash -c "curl -sfL
https://get.k3s.io
| K3S_URL=
“https://$IP:6443" K3S_TOKEN=
"$TOKEN" sh -"
[INFO] Finding release for channel stable
[INFO] Using v1.29.4+k3s1 as release
[INFO] Downloading hash https://github.com/k3s-io/k3s/releases/download/v1.29.4+k3s1/sha256sum-amd64.txt
[INFO] Downloading binary https://github.com/k3s-io/k3s/releases/download/v1.29.4+k3s1/k3s
[INFO] Verifying binary download
[INFO] Installing k3s to /usr/local/bin/k3s
[INFO] Skipping installation of SELinux RPM
[INFO] Creating /usr/local/bin/kubectl symlink to k3s
[INFO] Creating /usr/local/bin/crictl symlink to k3s
[INFO] Creating /usr/local/bin/ctr symlink to k3s
[INFO] Creating killall script /usr/local/bin/k3s-killall.sh
[INFO] Creating uninstall script /usr/local/bin/k3s-agent-uninstall.sh
[INFO] env: Creating environment file /etc/systemd/system/k3s-agent.service.env
[INFO] systemd: Creating service file /etc/systemd/system/k3s-agent.service
[INFO] systemd: Enabling k3s-agent unit
Created symlink /etc/systemd/system/multi-user.target.wants/k3s-agent.service → /etc/systemd/system/k3s-agent.service.
[INFO] systemd: Starting k3s-agent
Job for k3s-agent.service failed because the control process exited with error code.
See “systemctl status k3s-agent.service” and “journalctl -xeu k3s-agent.service” for details.
PS C:\Users\Tjen> echo "curl -sfL
https://get.k3s.io
| K3S_URL=
“https://$IP:6443
” K3S_TOKEN="$TOKEN
” sh -"`
curl -sfL https://get.k3s.io | K3S_URL=“https://172.19.238.76:6443” K3S_TOKEN=“K10867002ba75c162a27604d35810781bf2c8d7d2d54c412abb20b959b39beead37::server:371d1accaab38ca9d69c9f8423b08a65” sh -
PS C:\Users\Tjen>
PS C:\Users\Tjen> multipass shell k3s-worker-1
ubuntu@k3s-worker-1:~$ `curl -sfL ` [`https://get.k3s.io`](https://get.k3s.io) ` | K3S_URL="https://172.19.238.76:6443" K3S_TOKEN="K10867002ba75c162a27604d35810781`
`bf2c8d7d2d54c412abb20b959b39beead37::server:371d1accaab38ca9d69c9f8423b08a65" sh -`
[INFO] Finding release for channel stable
[INFO] Using v1.29.4+k3s1 as release
[INFO] Downloading hash [https://github.com/k3s-io/k3s/releases/download/v1.29.4+k3s1/sha256sum-amd64.txt](https://github.com/k3s-io/k3s/releases/download/v1.29.4+k3s1/sha256sum-amd64.txt)
[INFO] Skipping binary downloaded, installed k3s matches hash
[INFO] Skipping installation of SELinux RPM
[INFO] Skipping /usr/local/bin/kubectl symlink to k3s, already exists
[INFO] Skipping /usr/local/bin/crictl symlink to k3s, already exists
[INFO] Skipping /usr/local/bin/ctr symlink to k3s, already exists
[INFO] Creating killall script /usr/local/bin/k3s-killall.sh
[INFO] Creating uninstall script /usr/local/bin/k3s-agent-uninstall.sh
[INFO] env: Creating environment file /etc/systemd/system/k3s-agent.service.env
[INFO] systemd: Creating service file /etc/systemd/system/k3s-agent.service
[INFO] systemd: Enabling k3s-agent unit
Created symlink /etc/systemd/system/multi-user.target.wants/k3s-agent.service → /etc/systemd/system/k3s-agent.service.
[INFO] systemd: Starting k3s-agent
PS C:\Windows\system32> multipass exec k3s-master -- bash -c "sudo k3s kubectl config view --raw"
apiVersion: v1
clusters:
- cluster:
certificate-authority-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUJlRENDQVIyZ0F3SUJBZ0lCQURBS0JnZ3Foa2pPUFFRREFqQWpNU0V3SHdZRFZRUUREQmhyTTNNdGMyVnkKZG1WeUxXTmhRREUzTVRZd05EazVPVGt3SGhjTk1qUXdOVEU0TVRZek16RTVXaGNOTXpRd05URTJNVFl6TXpFNQpXakFqTVNFd0h3WURWUVFEREJock0zTXRjMlZ5ZG1WeUxXTmhRREUzTVRZd05EazVPVGt3V1RBVEJnY3Foa2pPClBRSUJCZ2dxaGtqT1BRTUJCd05DQUFRQThJUFpyTDhHcW5Ec1FyZEtDUm16WkRjUVZhSVZkclQvYkFoOUhvaU0KWWtXSzJzWGxseW0za29ROVF5MEhDSjZYSDY3em9WTGk2N2ljc0h5SHMyOWVvMEl3UURBT0JnTlZIUThCQWY4RQpCQU1DQXFRd0R3WURWUjBUQVFIL0JBVXdBd0VCL3pBZEJnTlZIUTRFRmdRVS9KVnhGR2pxSER6SS8wT1c5MkdtCjBmT1dQNTR3Q2dZSUtvWkl6ajBFQXdJRFNRQXdSZ0loQU5QbC85SkVINk1kZWx2S2ZYUjRtSXNhUURyd1lEb1YKQVZiUG5HVStna2ViQWlFQXByOXAycTJjbkZlalhqZzVEMm9MMzk1TnlZanRNeHprdVhqMGF6cHJadlE9Ci0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0K
server: https://127.0.0.1:6443
name: default
contexts:
- context:
cluster: default
user: default
name: default
current-context: default
kind: Config
preferences: {}
users:
- name: default
user:
client-certificate-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUJrakNDQVRlZ0F3SUJBZ0lJVzcxWTl2MkpxbGd3Q2dZSUtvWkl6ajBFQXdJd0l6RWhNQjhHQTFVRUF3d1kKYXpOekxXTnNhV1Z1ZEMxallVQXhOekUyTURRNU9UazVNQjRYRFRJME1EVXhPREUyTXpNeE9Wb1hEVEkxTURVeApPREUyTXpNeE9Wb3dNREVYTUJVR0ExVUVDaE1PYzNsemRHVnRPbTFoYzNSbGNuTXhGVEFUQmdOVkJBTVRESE41CmMzUmxiVHBoWkcxcGJqQlpNQk1HQnlxR1NNNDlBZ0VHQ0NxR1NNNDlBd0VIQTBJQUJFYWhpbG9XbUdRVkFHc00KT2krYXBLVGd1ejJGUE1WL0IrSURBQjAxZmNPVlBEUkFIVlczam9XWFdtUldwUTdoR1pwOU1MS2xRSUNXM2RRaApyeUtMVlRhalNEQkdNQTRHQTFVZER3RUIvd1FFQXdJRm9EQVRCZ05WSFNVRUREQUtCZ2dyQmdFRkJRY0RBakFmC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HWnFIcWhnbHVmUENUZE11UkRvYXkxN2NWNDlRSkJEVTcwbGM4MGdvQW9HQ0NxR1NNNDkKQXdFSG9VUURRZ0FFUnFHS1doYVlaQlVBYXd3Nkw1cWtwT0M3UFlVOHhYOEg0Z01BSFRWOXc1VThORUFkVmJlTwpoWmRhWkZhbER1RVptbjB3c3FWQWdKYmQxQ0d2SW90Vk5nPT0KLS0tLS1FTkQgRUMgUFJJVkFURSBLRVktLS0tLQo=
windows pc ipv4 = 192.168.1.100
PS C:\Windows\system32> multipass info k3s-master
Name: k3s-master
State: Running
Snapshots: 0
IPv4: 172.17.222.29
10.42.0.0
10.42.0.1
Release: Ubuntu 24.04 LTS
Image hash: 32a9d30d1880 (Ubuntu 24.04 LTS)
CPU(s): 1
Load: 0.25 0.43 0.22
Disk usage: 2.4GiB out of 3.8GiB
Memory usage: 766.3MiB out of 896.3MiB
Mounts: –
port forward on windows
a) port forward
https://woshub.com/port-forwarding-in-windows/
PS C:\Windows\system32> netsh interface portproxy add v4tov4 listenaddress=192.168.1.100 listenport=6443 connectaddress=172.17.222.29 connectport=6443
PS C:\Windows\system32> netstat -na| find "
“6443""
TCP 192.168.1.100:6443 0.0.0.0:0 LISTENING
ubuntu@k3s-master:~$ sudo systemctl stop k3s
ubuntu@k3s-master:~$ sudo k3s server –tls-san 192.168.1.100
b) allow firewall
https://www.howtogeek.com/394735/how-do-i-open-a-port-on-windows-firewall/
Windows Defender Firewall -> advanced -> new rule
- port
- TCP
- specific local ports:
6443
- Allow the connection
- Domain + private + public
- name: kubectl tcp
reinstall everything to fix kubectl TLS/SHH errors
https://github.com/k3s-io/k3s/issues/1381#issuecomment-582291774
curl -sfL https://get.k3s.io | INSTALL_K3S_EXEC=”–tls-san x.x.x.x" sh -s -
1) launch instance
PS C:\Users\Tjen.kube> multipass launch -c 1 -m 1G -d 4G -n k3s-master lts
Launched: k3s-master
2) install k3s with san IP
multipass exec k3s-master -- bash -c "curl -sfL
https://get.k3s.io
| INSTALL_K3S_EXEC="--tls-san 192.168.1.100" sh -"
~~PS C:\Users\Tjen.kube> ~~multipass exec k3s-master -- bash -c "curl -sfL
https://get.k3s.io
| INSTALL_K3S_EXEC=
"–tls-san 192.168.1.100" sh -"
-> didn’t work, went in with shell and did the curl straight
improved with baeldung https://www.baeldung.com/ops/k3s-getting-started#1-installation
multipass exec k3s-master -- bash -c "curl -sfL
https://get.k3s.io
| sh -s - --tls-san 192.168.1.100"
3a) get IP
$IP=multipass info k3s-master | findstr "IPv4:" | Foreach {($_ -split '\s+',4)[1]}
3b) open firewall on port
PS C:\Windows\system32>netsh advfirewall firewall add rule name="kube Open Port 6443" dir=in action=allow protocol=TCP localport=6443
3c) setup port-forwarding (assuming firewall allows port already)
~~PS C:\Users\Tjen.kube> ~~multipass list
Name State IPv4 Image
esteemed-jaybird Stopped – Ubuntu 24.04 LTS
k3s-master Running **~~ Ubuntu 24.04 LTS~~**172.17.215.159
~~ 10.42.0.0~~
~~ 10.42.0.1~~
PS C:\Windows\system32> **netsh interface portproxy add v4tov4 listenaddress=192.168.1.100 listenport=6443 connectaddress=
**172.17.215.159
connectport=6443
PS C:\Windows\system32>netsh interface portproxy dump
~~#========================~~
~~# Port Proxy configuration~~
~~#========================~~
~~pushd interface portproxy~~
~~reset~~
~~add v4tov4 listenport=6443 connectaddress=172.17.189.218 connectport=6443~~
~~add v4tov4 listenport=6443 connectaddress=172.17.189.218 connectport=6443~~
~~popd~~
~~# End of Port Proxy configuration~~
PS C:\Windows\system32>netsh interface portproxy reset
~~#========================~~
~~# Port Proxy configuration~~
~~#========================~~
~~pushd interface portproxy~~
~~reset~~
~~popd~~
~~# End of Port Proxy configuration~~
PS C:\Windows\system32>netsh interface portproxy dump
PS C:\Windows\system32>$IP=multipass info k3s-master | findstr "IPv4:" | Foreach {($_ -split '\s+',4)[1]}
PS C:\Windows\system32>netsh interface portproxy add v4tov4 listenaddress=192.168.1.100 listenport=6443 connectport=6443 connectaddress=$IP
PS C:\Windows\system32> netsh interface portproxy dump
#========================
# Port Proxy configuration
#========================
pushd interface portproxy
reset
add v4tov4 listenport=6443 connectaddress=172.17.189.218 connectport=6443
popd
# End of Port Proxy configuration
3d) confirm if working
PS C:\Windows\system32> netstat -ano | findstr :6443
TCP 192.168.1.100:6443 0.0.0.0:0 LISTENING 5336
or browse to https://192.168.1.100:6443/api
4) setup kubectl
PS C:\Users\Tjen.kube> multipass exec k3s-master -- bash -c "sudo k3s kubectl config view --raw" > ~/.kube/config
notepad ~/.kube/config <tab>
and replace 127.0.0.1 -> 192.168.1.100
or with 192.168.1.100 to confirm port-forwarding works (and be more robust against reboot)
PS C:\Users\Tjen> kubectl get nodes
NAME STATUS ROLES AGE VERSION
k3s-master Ready control-plane,master 5m42s v1.29.4+k3s1
d1) install agent (small)
PS C:\Users\Tjen> multipass launch -c 1 -m 1G -d 4G -n k3s-worker-1 lts
Launched: k3s-worker-1
PS C:\Users\Tjen> $TOKEN = multipass exec k3s-master sudo cat /var/lib/rancher/k3s/server/node-token
PS C:\Users\Tjen> multipass exec k3s-worker-1 -- bash -c "curl -sfL
https://get.k3s.io
| K3S_URL=
“https://192.168.1.100:6443" K3S_TOKEN=
"$TOKEN" sh -"
[INFO] Finding release for channel stable
[INFO] Using v1.29.4+k3s1 as release
[INFO] Downloading hash [https://github.com/k3s-io/k3s/releases/download/v1.29.4+k3s1/sha256sum-amd64.txt](https://github.com/k3s-io/k3s/releases/download/v1.29.4+k3s1/sha256sum-amd64.txt)
[INFO] Downloading binary [https://github.com/k3s-io/k3s/releases/download/v1.29.4+k3s1/k3s](https://github.com/k3s-io/k3s/releases/download/v1.29.4+k3s1/k3s)
[INFO] Verifying binary download
[INFO] Installing k3s to /usr/local/bin/k3s
[INFO] Skipping installation of SELinux RPM
[INFO] Creating /usr/local/bin/kubectl symlink to k3s
[INFO] Creating /usr/local/bin/crictl symlink to k3s
[INFO] Creating /usr/local/bin/ctr symlink to k3s
[INFO] Creating killall script /usr/local/bin/k3s-killall.sh
[INFO] Creating uninstall script /usr/local/bin/k3s-agent-uninstall.sh
[INFO] env: Creating environment file /etc/systemd/system/k3s-agent.service.env
[INFO] systemd: Creating service file /etc/systemd/system/k3s-agent.service
[INFO] systemd: Enabling k3s-agent unit
Created symlink /etc/systemd/system/multi-user.target.wants/k3s-agent.service → /etc/systemd/system/k3s-agent.service.
[INFO] systemd: Starting k3s-agent
d2) install agent (with enormous resources)
PS C:\Users\Tjen> multipass launch -c 3 -m 7G -d 200G -n k3s-worker-1 lts
~~PS C:\Users\Tjen> ~~$IP=multipass info k3s-master | findstr "IPv4:" | Foreach {($_ -split '\s+',4)[1]}
PS C:\Users\Tjen> $TOKEN = multipass exec k3s-master sudo cat /var/lib/rancher/k3s/server/node-token
PS C:\Users\Tjen> multipass exec k3s-worker-1 -- bash -c "curl -sfL
https://get.k3s.io
| K3S_URL=
“https://192.168.1.100:6443" K3S_TOKEN=
"$TOKEN" sh -"