79366553

Date: 2025-01-18 04:17:24
Score: 0.5
Natty:
Report link

I was moving resources from a DigitalOcean cluster to a Microk8s cluster, I decided to check the logs of the velero node agent and I found this error; An error occurred: unexpected directory structure for host-pods volume, ensure that the host-pods volume corresponds to the pods subdirectory of the kubelet root directory then I remembered I added this line of code after my installation;

/snap/bin/microk8s kubectl --kubeconfig="$kube_config_path" -n velero patch daemonset.apps/node-agent --type='json' -p='[{"op": "replace", "path": "/spec/template/spec/volumes/0/hostPath/path", "value":"/var/snap/microk8s/common/var/lib/kubelet/pods"}]'

This was interfering with the original hostpath value var/lib/kubelet/pods needed for normal Kubernetes cluster. I added a condition as to when the patch is to be done and it started working properly.

Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: okechukwu achebe