You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

97 lines
2.1 KiB

  1. ---
  2. apiVersion: v1
  3. kind: ServiceAccount
  4. metadata:
  5. name: flannel
  6. namespace: kube-system
  7. ---
  8. apiVersion: policy/v1beta1
  9. kind: PodSecurityPolicy
  10. metadata:
  11. name: psp.flannel.unprivileged
  12. annotations:
  13. seccomp.security.alpha.kubernetes.io/allowedProfileNames: runtime/default
  14. seccomp.security.alpha.kubernetes.io/defaultProfileName: runtime/default
  15. {% if podsecuritypolicy_enabled and apparmor_enabled %}
  16. apparmor.security.beta.kubernetes.io/allowedProfileNames: runtime/default
  17. apparmor.security.beta.kubernetes.io/defaultProfileName: runtime/default
  18. {% endif %}
  19. spec:
  20. privileged: false
  21. volumes:
  22. - configMap
  23. - secret
  24. - emptyDir
  25. - hostPath
  26. allowedHostPaths:
  27. - pathPrefix: "/etc/cni/net.d"
  28. - pathPrefix: "/etc/kube-flannel"
  29. - pathPrefix: "/run/flannel"
  30. readOnlyRootFilesystem: false
  31. # Users and groups
  32. runAsUser:
  33. rule: RunAsAny
  34. supplementalGroups:
  35. rule: RunAsAny
  36. fsGroup:
  37. rule: RunAsAny
  38. # Privilege Escalation
  39. allowPrivilegeEscalation: false
  40. defaultAllowPrivilegeEscalation: false
  41. # Capabilities
  42. allowedCapabilities: ['NET_ADMIN']
  43. defaultAddCapabilities: []
  44. requiredDropCapabilities: []
  45. # Host namespaces
  46. hostPID: false
  47. hostIPC: false
  48. hostNetwork: true
  49. hostPorts:
  50. - min: 0
  51. max: 65535
  52. # SELinux
  53. seLinux:
  54. # SELinux is unused in CaaSP
  55. rule: 'RunAsAny'
  56. ---
  57. kind: ClusterRole
  58. apiVersion: rbac.authorization.k8s.io/v1
  59. metadata:
  60. name: flannel
  61. rules:
  62. - apiGroups: ['extensions']
  63. resources: ['podsecuritypolicies']
  64. verbs: ['use']
  65. resourceNames: ['psp.flannel.unprivileged']
  66. - apiGroups:
  67. - ""
  68. resources:
  69. - pods
  70. verbs:
  71. - get
  72. - apiGroups:
  73. - ""
  74. resources:
  75. - nodes
  76. verbs:
  77. - list
  78. - watch
  79. - apiGroups:
  80. - ""
  81. resources:
  82. - nodes/status
  83. verbs:
  84. - patch
  85. ---
  86. kind: ClusterRoleBinding
  87. apiVersion: rbac.authorization.k8s.io/v1
  88. metadata:
  89. name: flannel
  90. roleRef:
  91. apiGroup: rbac.authorization.k8s.io
  92. kind: ClusterRole
  93. name: flannel
  94. subjects:
  95. - kind: ServiceAccount
  96. name: flannel
  97. namespace: kube-system