tmate-pod.yaml 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. # Apply this manifest to CI clusters to allow debugging complex failures during CI runs
  2. #
  3. # Usage:
  4. # kubectl apply -f tests/scripts/tmate-pod.yaml
  5. # kubectl -n tmate wait --for=condition=ready -l app=tmate pod --timeout=300
  6. # sleep 1 # just in case tmate hasn't output its web/ssh links yet
  7. # kubectl -n tmate logs deploy/tmate
  8. apiVersion: v1
  9. kind: Namespace
  10. metadata:
  11. name: tmate
  12. ---
  13. apiVersion: v1
  14. kind: ServiceAccount
  15. metadata:
  16. name: tmate
  17. namespace: tmate
  18. ---
  19. apiVersion: rbac.authorization.k8s.io/v1
  20. kind: ClusterRole
  21. metadata:
  22. name: allow-all
  23. rules:
  24. - apiGroups:
  25. - "*"
  26. resources:
  27. - "*"
  28. verbs:
  29. - "*"
  30. - nonResourceURLs:
  31. - "*"
  32. verbs:
  33. - "*"
  34. ---
  35. apiVersion: rbac.authorization.k8s.io/v1
  36. kind: ClusterRoleBinding
  37. metadata:
  38. name: tmate-allow-all
  39. subjects:
  40. - kind: ServiceAccount
  41. name: tmate
  42. namespace: tmate
  43. roleRef:
  44. apiGroup: rbac.authorization.k8s.io
  45. kind: ClusterRole
  46. name: allow-all
  47. ---
  48. apiVersion: apps/v1
  49. kind: Deployment
  50. metadata:
  51. name: tmate
  52. namespace: tmate
  53. spec:
  54. selector:
  55. matchLabels:
  56. app: tmate
  57. template:
  58. metadata:
  59. labels:
  60. app: tmate
  61. spec:
  62. serviceAccountName: tmate
  63. containers:
  64. - name: tmate
  65. image: quay.io/fedora/fedora:39
  66. command:
  67. - sh
  68. - -c
  69. - |
  70. dnf install -y tmate kubernetes-client bash vim
  71. tmate -F -S /var/tmp/tmate.sock
  72. resources: {}
  73. readinessProbe:
  74. exec:
  75. # return ready only when the tmate socket exists -- when tmate is officially running
  76. command:
  77. - ls
  78. - /var/tmp/tmate.sock