Advertisement
Guest User

Untitled

a guest
Aug 20th, 2019
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. set -eo pipefail
  4.  
  5. NAMESPACE=$1
  6. PVC=$2
  7.  
  8. if [ "$#" -ne 2 ]; then
  9. echo "Usage: $0 <namespace> <pvc-name>"
  10. exit 1
  11. fi
  12.  
  13.  
  14. kubectl run --rm -n $NAMESPACE --attach=true -i attach-${PVC} --overrides='
  15. {
  16. "spec": {
  17. "containers": [
  18. {
  19. "name": "attach",
  20. "image": "debian:stretch-slim",
  21. "workingDir": "/attached",
  22. "command": ["bash"],
  23. "stdin": true,
  24. "stdinOnce": true,
  25. "tty": true,
  26. "volumeMounts": [
  27. { "mountPath": "/attached", "name": "attached", "readOnly": false }
  28. ]
  29. }
  30. ],
  31. "restartPolicy": "Never",
  32. "volumes": [
  33. { "name": "attached", "persistentVolumeClaim": {"claimName": "'${PVC}'" } }
  34. ]
  35. }
  36. }
  37. ' --image=debian:stretch-slim --restart=Never
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement