Skip to content

Instantly share code, notes, and snippets.

@bsnux
Created August 30, 2023 23:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bsnux/15b618f5b69a8034e758faf4f00e6acf to your computer and use it in GitHub Desktop.
Save bsnux/15b618f5b69a8034e758faf4f00e6acf to your computer and use it in GitHub Desktop.
k8s-pvc-inspector
#!/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