I’m experimenting with kind for my kubernetes nodes and ran into some issues with volume mounts.
I was running some dev pods with the local source code mounted. When starting up the pods with kind nearly everything in the mounted folder was missing in the pod. Switching back to kubeadm resolved the issue.
Docker Desktop 4.42.1 (196648)
Engine: 28.2.2
Compose: v2.37.1-desktop.1
Credential Helper: v0.9.3
Kubernetes: v1.32.2
I’m using the default File Sharing config which includes /Users
.
Kustomize is used for config management and the startup script is using envsubst
to set the path to the source like this
kubectl kustomize "${ROOT_DIR}/kubernetes/${env}/" | APP_PATH="${ROOT_DIR}" envsubst | kubectl apply -f -
volume mount config
volumes:
- name: app
hostPath:
path: $APP_PATH
...
volumeMounts:
- name: app
mountPath: /app
from a pod using kind
[root@web-f5c9b464d-z4pm9 app]# ls -al /app
total 12
drwxr-xr-x 3 root root 4096 Jun 20 15:30 .
drwxr-xr-x 1 root root 4096 Jun 20 16:53 ..
drwxr-xr-x 3 root root 4096 Jun 20 15:30 config
from a pod using kubeadm
[root@web-586c588ff7-8jk2x app]# ls -al /app
total 100
drwxr-xr-x 43 root root 1376 Jun 20 16:19 .
drwxr-xr-x 1 root root 4096 Jun 20 17:35 ..
drwxr-xr-x 9 root root 288 May 20 12:36 app
drwxr-xr-x 4 root root 128 Jun 20 15:20 appconfig
-rw-r--r-- 1 root root 3440 May 20 12:36 app.json
drwxr-xr-x 42 root root 1344 Apr 29 11:40 bin
...