Ugly Command Party - Day 6
Shea Stewart
Technologist working in Platform & Customer Engineering Capacities @ RunWhen
Ugly Command Name: Check for RWO Persistent Volume Node Attachment Issues
What does it do?
Searches through a namespace and finds pods with RWO attached persistent volumes. It outputs the node that the pod is scheduled on along with the node that the volume is attached to. The two should be the same, and it will print as message saying if this is the case or if there is a mismatch.
When would you use it?
Very rarely, but from time to time, a pod has an issue being rescheduled due to a persistent volume that can’t detach from a node and reattach to the new node (where the pod is scheduled). This command can quickly highlight if there are any mismatches within the namespace.
What is the command?
Please view the GitHub Gist below to find the code snippet. Due to a limitation with LinkedIn, it does not accept some code in the code snippet and breaks the Article feature :-/
What is some sample output?
-----
OK: Pod and Storage Node Matched
Pod: jenkins-0
PVC: jenkins
PV: pvc-ba67e928-8e9b-4a9a-be69-4f286e2e6af5
Node with Pod: gke-sandbox-cluster--sandbox-cluster--744aa9b5-5mvt
Node with Storage: gke-sandbox-cluster--sandbox-cluster--744aa9b5-5mvt
-----
OK: Pod and Storage Node Matched
Pod: jenkins2-0
PVC: jenkins2
PV: pvc-0f49efcb-f71e-4722-b0f2-c13ed7d647ea
Node with Pod: gke-sandbox-cluster--sandbox-cluster--744aa9b5-4fbx
Node with Storage: gke-sandbox-cluster--sandbox-cluster--744aa9b5-4fbx
What does it need?
If you want this command tailored for your environment and ready to copy & paste, this command has been added to the open source library of commands available through RunWhen Local. Check it out here: https://docs.runwhen.com/public/runwhen-local/getting-started/running-locally
Find an example of the command here:
Have an ugly command to share? Collaborate with us on GitHub with issues or discussions
This is part of a series.?Check out?this article?to see additional ugly commands posted in the series.