psp.yaml 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. {{- if and .Values.nodeExporter.enabled .Values.rbac.create .Values.podSecurityPolicy.enabled }}
  2. apiVersion: {{ template "prometheus.podSecurityPolicy.apiVersion" . }}
  3. kind: PodSecurityPolicy
  4. metadata:
  5. name: {{ template "prometheus.nodeExporter.fullname" . }}
  6. labels:
  7. {{- include "prometheus.nodeExporter.labels" . | nindent 4 }}
  8. annotations:
  9. {{- if .Values.nodeExporter.podSecurityPolicy.annotations }}
  10. {{ toYaml .Values.nodeExporter.podSecurityPolicy.annotations | indent 4 }}
  11. {{- end }}
  12. spec:
  13. privileged: false
  14. allowPrivilegeEscalation: false
  15. requiredDropCapabilities:
  16. - ALL
  17. volumes:
  18. - 'configMap'
  19. - 'hostPath'
  20. - 'secret'
  21. allowedHostPaths:
  22. - pathPrefix: /proc
  23. readOnly: true
  24. - pathPrefix: /sys
  25. readOnly: true
  26. - pathPrefix: /
  27. readOnly: true
  28. {{- range .Values.nodeExporter.extraHostPathMounts }}
  29. - pathPrefix: {{ .hostPath }}
  30. readOnly: {{ .readOnly }}
  31. {{- end }}
  32. hostNetwork: {{ .Values.nodeExporter.hostNetwork }}
  33. hostPID: {{ .Values.nodeExporter.hostPID }}
  34. hostIPC: false
  35. runAsUser:
  36. rule: 'RunAsAny'
  37. seLinux:
  38. rule: 'RunAsAny'
  39. supplementalGroups:
  40. rule: 'MustRunAs'
  41. ranges:
  42. # Forbid adding the root group.
  43. - min: 1
  44. max: 65535
  45. fsGroup:
  46. rule: 'MustRunAs'
  47. ranges:
  48. # Forbid adding the root group.
  49. - min: 1
  50. max: 65535
  51. readOnlyRootFilesystem: false
  52. hostPorts:
  53. - min: 1
  54. max: 65535
  55. {{- end }}