Today I was doing the services recovering from a cluster rebuild. I was trying to bring back the Jenkins master. The Jenkins_home has been defined as a volume within a PVC. For some reason, my jenkins was not able to resolve the DNS. I’ve tried a couple of tests. None of them are working. So I decide to kill the Jenkins pod and let it recreate see what happen.
After the restart, I was getting the following error from the pod describe.
Multi-Attach error for volume "pvc" Volume is already exclusively attached to one node and can't be attached to another.
I did list all the pvs and pvcs. Straightly it looks like the pvc is bond correctly. However, that was the actual issues. I did a lookup online and found there is another way of doing it. Try to scale down and scale up.
kubectl scale deployment deploy --replicas=0 -n ca kubectl scale deployment deploy --replicas=1 -n ca
This sounds wired. Because I never need to do that for a pod restart, even if it has a pvc defined. However, this looks like the fix for the issue.