k3s on Ubuntu in Parallels Desktop on M1 Mac

In my previous post I described how to get a minikube cluster up and running using multipass. This approach has some downsides, the first being the need for port forwards, second minikube and multipass sometimes display some quirky behaviour. Both tend to hang sometimes on startup. I don’t know the cause of this. It’s not very often, but annoying enough to give this alternative a try.

In my search for the ideal k8s setup on a M1 mac I tried an alternative approach. This time I installed k3s on a Ubuntu virtual machine running in Parallels Desktop. As k3s doesn’t need docker it sounds like an attractive alternative. Here are the steps.

First of all download and install Parallels Desktop. After installing, launch the Ubuntu VM suggested in the dialog.

When the Ubuntu VM is up and running launch a terminal to install k3s. I’ve added an additional argument that allows services to expose themselves at any port (by default this is restricted to the 30000-32768 range).

curl -sfL https://get.k3s.io | sh -s - \
  --write-kubeconfig-mode 644 \
  --kube-apiserver-arg service-node-port-range=1-65535

Now the k3s cluster is ready to be used. Depending on your setup you might need to copy the kube config of k3s to the ~/.kube/config file.

sudo cp /etc/rancher/k3s/k3s.* $HOME/.kube/config

Now you can use kubectl to interact with the k3s cluster.

The beauty of this setup is that all services that are exposed using NodePort are available directly on the host (the Ubuntu VM). This means that I can connect directly to ports on my VM to interact with the services I deployed in the cluster, which I need for my local development workflow.

Local storage

If you want the data of your pods to survive a restart or reboot using a persistent volume is the way to go. k3s supports the local-path storage class out of the box. See the following PersistentVolumeClaim for an example how to use it. This is the volume PersistentVolumeClaim I’m using for my MongoDB instance.

apiVersion: v1
kind: PersistentVolumeClaim
  name: mongo-claim0
  namespace: informationgrid
    - ReadWriteOnce
  storageClassName: local-path
      storage: 1Gi

The local-path storage class, what’s in a name, stores the data of the volume on a directory of the host, our Ubuntu VM in this case. You can find it in the /var/lib/rancher/k3s/storage folder. Here a subfolder is created for every local-path PersistentVolumeClaim.


To uninstall your cluster use the following command


Leave a Reply