Closed chris-sanders closed 4 years ago
The error comes from util/validate.go which uses the staging path it received from the request. The StagingTargetPath
is passed from the Kubernetes-CSI layer into the cephcsi NodeServer. Unfortunately cephcsi does not seem to log the staging path in error cases.
You might be able to increase the verbose/debug level of the side-car container on the node where the volume is to be mounted. Maybe that will log the full request and show the staging path. With that, you might be able to identify the problem.
{"secrets":"stripped","staging_target_path":"/var/snap/microk8s/common/var/lib/kubelet/plugins/kubernetes.io/csi/pv/pvc-14670fe3-b4c6-4924-8660-dcbcfdc05504/globalmount","volume_capability":{"AccessType":{"Mount":{"fs_type":"xfs","mount_flags":["discard"]}},"access_mode":{"mode":1}},"volume_context":{"clusterID":"28c76192-9586-11ea-9b35-00163e408a9d","imageFeatures":"layering","journalPool":"xfs-pool","pool":"xfs-pool","storage.kubernetes.io/csiProvisionerIdentity":"1589503606225-8081-rbd.csi.ceph.com"},"volume_id":"0001-0024-28c76192-9586-11ea-9b35-00163e408a9d-0000000000000003-9bb25594-9645-11ea-a90d-1ef02b6b9cff"} E0515 01:25:50.964644 498118 utils.go:163] ID: 28 Req-ID: 0001-0024-28c76192-9586-11ea-9b35-00163e408a9d-0000000000000003-9bb25594-9645-11ea-a90d-1ef02b6b9cff GRPC error: rpc error: code = InvalidArgument desc = staging path does not exists on node
the staging path is available in the request, let me give a try to deploy cephcsi in microk8s I tried last time with the rook. with few modifications, it was working
the staging path is available in the request
Ah, yeah, it gets logged already!
let me give a try to deploy cephcsi in microk8s I tried last time with the rook. with few modifications, it was working
Maybe we should try to run e2e tests on microk8s in addition to a minikube environment?
the staging path is available in the request
Ah, yeah, it gets logged already!
let me give a try to deploy cephcsi in microk8s I tried last time with the rook. with few modifications, it was working
Maybe we should try to run e2e tests on microk8s in addition to a minikube environment?
it will be a more work, we can do it.
volumeMounts:
- name: socket-dir mountPath: /csi
- mountPath: /dev name: host-dev
- mountPath: /sys name: host-sys
- mountPath: /run/mount name: host-mount
- mountPath: /lib/modules name: lib-modules readOnly: true
- name: ceph-csi-config mountPath: /etc/ceph-csi-config/
- name: ceph-csi-encryption-kms-config mountPath: /etc/ceph-csi-encryption-kms-config/
- name: plugin-dir mountPath: /var/lib/kubelet/plugins mountPropagation: "Bidirectional"
- name: mountpoint-dir mountPath: /var/lib/kubelet/pods mountPropagation: "Bidirectional"
- name: keys-tmp-dir mountPath: /tmp/csi/keys
@chris-sanders can you update the volume mount path of kubelet also and see it fixes the issue
host path /var/snap/microk8s/common/var/lib/kubelet/plugins
is mapped to container /var/lib/kubelet
as the /var/snap/microk8s/common/var/lib/kubelet/plugins/kubernetes.io/csi/pv/pvc-14670fe3-b4c6-4924-8660-dcbcfdc05504/globalmount
staging path directory is not present on the container it will throw the error, if you map the directories to the same path as host path it should work.
You're right that was it, pod started right up after that. I didn't even catch that the path was the full hostPath. I was thinking all of the modified host paths were mapped to their standard locations in the containers and the rest of the plugin wouldn't know the difference.
For future travelers these two edits fixed it:
- name: plugin-dir mountPath: /var/snap/microk8s/common/var/lib/kubelet/plugins # /var/lib/kubelet/plugins mountPropagation: "Bidirectional" - name: mountpoint-dir mountPath: /var/snap/microk8s/common/var/lib/kubelet/pods # /var/lib/kubelet/pods mountPropagation: "Bidirectional"
@chris-sanders i do run into the same issue, do use microk8s 1.19.3 where do i have to set those vars?
i just can find the Var here: https://github.com/rook/rook/tree/c953de538bef894f8cba1dc3dad132d2ab66c99e/cluster/examples/kubernetes/ceph/csi/template/cephfs
However, i followed the docs to setup a ceph cluster and cephFS: https://rook.io/docs/rook/v1.5/ceph-filesystem.html -> without HELM
I basicly did a symlink from /var/lib/kubelet to /var/snap/microk8s/common/var/lib/kubelet/ Everything looks fine, but not the mount...
Unable to attach or mount volumes: unmounted volumes=[image-store], unattached volumes=[image-store default-token-pjgnd]: timed out waiting for the condition
kubelet k8s01
MountVolume.MountDevice failed for volume "pvc-d8756fb2-452d-4455-ab9e-038e30c119c5" : rpc error: code = InvalidArgument desc = staging path /var/snap/microk8s/common/var/lib/kubelet/plugins/kubernetes.io/csi/pv/pvc-d8756fb2-452d-4455-ab9e-038e30c119c5/globalmount does not exists on node
kubelet k8s01
@Berndinox the valies I've been using were removed and the chart updated to allow you to set the kubelet directory here: https://github.com/ceph/ceph-csi/pull/1736
I haven't had a chance to test the update, but hopefully that exposes the values you need in the chart. Otherwise, there was no chart value you allow you to set them. I was using ytt to patch the final yaml manifests to make the changes.
For anyone that finds themself here after finding this error running Microk8s and using the 1.8 Rook/Ceph Operator, here's the fix I found. Clear the raw partitions. Uninstall everything related to Rook. Open up the operator.yaml.
cp rook/deploy/examples/operator.yaml rook/deploy/examples/microk8s-operator.yaml
# `vim rook/deploy/examples/microk8s-operator.yaml`
# Search ROOK_CSI_KUBELET_DIR_PATH
# It should originally be commented out and be ROOK_CSI_KUBELET_DIR_PATH: "/var/lib/kubelet"
# Uncomment and set line to ` ROOK_CSI_KUBELET_DIR_PATH: "/var/snap/microk8s/common/var/lib/kubelet"`
Apply your microk8s-operator.yaml instead of the original operator and use all other steps as before.
@NewMountain : Thank you so much man! You've made my day!
Small addition: if you are into GitOps and use the rook operator helm chart, what you want to change is called csi.kubeletDirPath
:
before (it was commented out):
csi:
# kubeletDirPath: /var/lib/kubelet
after:
csi:
kubeletDirPath: /var/snap/microk8s/common/var/lib/kubelet
For future travelers these two edits fixed it:
Thanks a million @chris-sanders
Describe the bug
Trying to setup ceph-csi with microk8s against a ceph cluster, just rbd for now. The plugin installs, a pvc/pv is created and be seen in ceph, but the pod stalls with the missing staging path error in the title. The path is indeed missing when I look on the worker, but I can't figure out where/how it was suppose to be created.
Environment details
fuse
orkernel
. for rbd itskrbd
orrbd-nbd
) : krbdSteps to reproduce
Steps to reproduce the behavior:
--allow-privileged
plugin-deploy.sh
in examples folderActual results
Pod never completes
Expected behavior
Pod is created with the rbd volume
Logs
If the issue is in PVC mounting please attach complete logs of below containers.
Additional context
I suspect this is related to microk8s path modifications, or permissions. All of the processes run as root, and the sockets are seen in the file paths as expected. The path /var/snap/microk8s/common/var/lib/kubelet/plugins/kubernetes.io/csi/pv is created by the PVC mount and global folder never appear.