When I use k3d create a Kubernetes cluster, I can mount local folder /Users/me/data
to the cluster /data
using volume
k3d cluster create west --config=k3d-config.yaml
k3d-config.yaml
apiVersion: k3d.io/v1alpha3
kind: Simple
kubeAPI:
host: "k8s-example.com"
hostIP: "127.0.0.1"
hostPort: "6440"
network: hm-network
volumes:
- volume: "/Users/me/data:/data" # <- this line helps mount
ports:
- port: 40000:80
nodeFilters:
- loadbalancer
options:
k3s:
extraArgs:
- arg: --cluster-domain=west.k8s-example.com
nodeFilters:
- server:*
Now I am using the Kubernetes cluster created by Rancher Desktop and hoping to do the same thing.
I am on macOS, and I found this document which seems right document (?):
On macOS and Linux, you can use lima override.yaml to write provisioning scripts.
~/Library/Application Support/rancher-desktop/lima/_config/override.yaml
You can also use override.yaml to override/modify a lima configuration setting, for example, to create additional mounts as shown below.
mounts: - location: /some/path writable: true
However, I am not entirely sure how to use this to mount my local folder /Users/me/data
to the cluster /data
.
Any guide would be appreciate!
You can mount it as a hostpath inside a Pod: