Created
August 30, 2023 23:41
-
-
Save bsnux/15b618f5b69a8034e758faf4f00e6acf to your computer and use it in GitHub Desktop.
k8s-pvc-inspector
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -euo pipefail | |
claim=$1 | |
ns=$2 | |
pod_name="pvc-inspector" | |
kubectl get po "$pod_name" -n "$ns" && kubectl delete po "$pod_name" -n "$ns" | |
cat <<EOF | kubectl apply -f - | |
apiVersion: v1 | |
kind: Pod | |
metadata: | |
name: pvc-inspector | |
namespace: $ns | |
spec: | |
containers: | |
- image: busybox | |
name: pvc-inspector | |
command: ["tail"] | |
args: ["-f", "/dev/null"] | |
volumeMounts: | |
- mountPath: /pvc | |
name: pvc-mount | |
volumes: | |
- name: pvc-mount | |
persistentVolumeClaim: | |
claimName: $claim | |
EOF | |
kubectl wait --for=condition=ready pod/pvc-inspector -n "$ns" --timeout=180s | |
kubectl exec -it pvc-inspector -n tekton-runner -- ls -l /pvc/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment