Update documentation for Cluster-API and Flux
[icn.git] / deploy / cluster / templates / podsecurity-addon.yaml
1 ---
2 apiVersion: v1
3 data:
4   podsecurity.yaml: |
5     ---
6     apiVersion: policy/v1beta1
7     kind: PodSecurityPolicy
8     metadata:
9       name: privileged
10       annotations:
11         seccomp.security.alpha.kubernetes.io/allowedProfileNames: '*'
12     spec:
13       privileged: true
14       allowPrivilegeEscalation: true
15       allowedCapabilities:
16       - '*'
17       volumes:
18       - '*'
19       hostNetwork: true
20       hostPorts:
21       - min: 0
22         max: 65535
23       hostIPC: true
24       hostPID: true
25       runAsUser:
26         rule: 'RunAsAny'
27       seLinux:
28         rule: 'RunAsAny'
29       supplementalGroups:
30         rule: 'RunAsAny'
31       fsGroup:
32         rule: 'RunAsAny'
33     ---
34     apiVersion: policy/v1beta1
35     kind: PodSecurityPolicy
36     metadata:
37       name: baseline
38       annotations:
39         # Optional: Allow the default AppArmor profile, requires setting the default.
40         apparmor.security.beta.kubernetes.io/allowedProfileNames: 'runtime/default'
41         apparmor.security.beta.kubernetes.io/defaultProfileName:  'runtime/default'
42         seccomp.security.alpha.kubernetes.io/allowedProfileNames: '*'
43     spec:
44       privileged: false
45       # The moby default capability set, minus NET_RAW
46       allowedCapabilities:
47         - 'CHOWN'
48         - 'DAC_OVERRIDE'
49         - 'FSETID'
50         - 'FOWNER'
51         - 'MKNOD'
52         - 'SETGID'
53         - 'SETUID'
54         - 'SETFCAP'
55         - 'SETPCAP'
56         - 'NET_BIND_SERVICE'
57         - 'SYS_CHROOT'
58         - 'KILL'
59         - 'AUDIT_WRITE'
60       # Allow all volume types except hostpath
61       volumes:
62         # 'core' volume types
63         - 'configMap'
64         - 'emptyDir'
65         - 'projected'
66         - 'secret'
67         - 'downwardAPI'
68         # Assume that ephemeral CSI drivers & persistentVolumes set up by the cluster admin are safe to use.
69         - 'csi'
70         - 'persistentVolumeClaim'
71         - 'ephemeral'
72         # Allow all other non-hostpath volume types.
73         - 'awsElasticBlockStore'
74         - 'azureDisk'
75         - 'azureFile'
76         - 'cephFS'
77         - 'cinder'
78         - 'fc'
79         - 'flexVolume'
80         - 'flocker'
81         - 'gcePersistentDisk'
82         - 'gitRepo'
83         - 'glusterfs'
84         - 'iscsi'
85         - 'nfs'
86         - 'photonPersistentDisk'
87         - 'portworxVolume'
88         - 'quobyte'
89         - 'rbd'
90         - 'scaleIO'
91         - 'storageos'
92         - 'vsphereVolume'
93       hostNetwork: false
94       hostIPC: false
95       hostPID: false
96       readOnlyRootFilesystem: false
97       runAsUser:
98         rule: 'RunAsAny'
99       seLinux:
100         # This policy assumes the nodes are using AppArmor rather than SELinux.
101         # The PSP SELinux API cannot express the SELinux Pod Security Standards,
102         # so if using SELinux, you must choose a more restrictive default.
103         rule: 'RunAsAny'
104       supplementalGroups:
105         rule: 'RunAsAny'
106       fsGroup:
107         rule: 'RunAsAny'
108     ---
109     apiVersion: policy/v1beta1
110     kind: PodSecurityPolicy
111     metadata:
112       name: restricted
113       annotations:
114         seccomp.security.alpha.kubernetes.io/allowedProfileNames: 'docker/default,runtime/default'
115         apparmor.security.beta.kubernetes.io/allowedProfileNames: 'runtime/default'
116         apparmor.security.beta.kubernetes.io/defaultProfileName:  'runtime/default'
117     spec:
118       privileged: false
119       # Required to prevent escalations to root.
120       allowPrivilegeEscalation: false
121       requiredDropCapabilities:
122         - ALL
123       # Allow core volume types.
124       volumes:
125         - 'configMap'
126         - 'emptyDir'
127         - 'projected'
128         - 'secret'
129         - 'downwardAPI'
130         # Assume that ephemeral CSI drivers & persistentVolumes set up by the cluster admin are safe to use.
131         - 'csi'
132         - 'persistentVolumeClaim'
133         - 'ephemeral'
134       hostNetwork: false
135       hostIPC: false
136       hostPID: false
137       runAsUser:
138         # Require the container to run without root privileges.
139         rule: 'MustRunAsNonRoot'
140       seLinux:
141         # This policy assumes the nodes are using AppArmor rather than SELinux.
142         rule: 'RunAsAny'
143       supplementalGroups:
144         rule: 'MustRunAs'
145         ranges:
146           # Forbid adding the root group.
147           - min: 1
148             max: 65535
149       fsGroup:
150         rule: 'MustRunAs'
151         ranges:
152           # Forbid adding the root group.
153           - min: 1
154             max: 65535
155       readOnlyRootFilesystem: false
156     ---
157     apiVersion: policy/v1beta1
158     kind: PodSecurityPolicy
159     metadata:
160       name: icn
161       annotations:
162         seccomp.security.alpha.kubernetes.io/allowedProfileNames: '*'
163     spec:
164       privileged: true
165       allowPrivilegeEscalation: true
166       volumes:
167       - '*'
168       hostNetwork: true
169       hostPorts:
170       - min: 0
171         max: 65535
172       hostIPC: true
173       hostPID: true
174       runAsUser:
175         rule: 'RunAsAny'
176       seLinux:
177         rule: 'RunAsAny'
178       supplementalGroups:
179         rule: 'RunAsAny'
180       fsGroup:
181         rule: 'RunAsAny'
182       allowedCapabilities:
183         - 'NET_ADMIN'
184         - 'SYS_ADMIN'
185         - 'SYS_NICE'
186         - 'SYS_PTRACE'
187       requiredDropCapabilities:
188         - 'NET_RAW'
189     ---
190     apiVersion: rbac.authorization.k8s.io/v1
191     kind: ClusterRole
192     metadata:
193       name: psp:privileged
194       labels:
195         addonmanager.kubernetes.io/mode: Reconcile
196     rules:
197     - apiGroups:
198       - policy
199       resourceNames:
200       - privileged
201       resources:
202       - podsecuritypolicies
203       verbs:
204       - use
205     ---
206     apiVersion: rbac.authorization.k8s.io/v1
207     kind: ClusterRole
208     metadata:
209       name: psp:baseline
210       labels:
211         addonmanager.kubernetes.io/mode: Reconcile
212     rules:
213     - apiGroups:
214       - policy
215       resourceNames:
216       - baseline
217       resources:
218       - podsecuritypolicies
219       verbs:
220       - use
221     ---
222     apiVersion: rbac.authorization.k8s.io/v1
223     kind: ClusterRole
224     metadata:
225       name: psp:icn
226       labels:
227         addonmanager.kubernetes.io/mode: Reconcile
228     rules:
229     - apiGroups:
230       - policy
231       resourceNames:
232       - icn
233       resources:
234       - podsecuritypolicies
235       verbs:
236       - use
237     ---
238     apiVersion: rbac.authorization.k8s.io/v1
239     kind: ClusterRole
240     metadata:
241       name: psp:restricted
242       labels:
243         addonmanager.kubernetes.io/mode: Reconcile
244     rules:
245     - apiGroups:
246       - policy
247       resourceNames:
248       - restricted
249       resources:
250       - podsecuritypolicies
251       verbs:
252       - use
253     ---
254     apiVersion: rbac.authorization.k8s.io/v1
255     kind: RoleBinding
256     metadata:
257       name: psp:privileged:nodes
258       namespace: kube-system
259       labels:
260         addonmanager.kubernetes.io/mode: Reconcile
261     roleRef:
262       apiGroup: rbac.authorization.k8s.io
263       kind: ClusterRole
264       name: psp:privileged
265     subjects:
266     - kind: Group
267       name: system:nodes
268       apiGroup: rbac.authorization.k8s.io
269     ---
270     apiVersion: rbac.authorization.k8s.io/v1
271     kind: RoleBinding
272     metadata:
273       name: psp:privileged:kube-system
274       namespace: kube-system
275     roleRef:
276       apiGroup: rbac.authorization.k8s.io
277       kind: ClusterRole
278       name: psp:privileged
279     subjects:
280     - kind: Group
281       name: system:serviceaccounts:kube-system
282       apiGroup: rbac.authorization.k8s.io
283     ---
284     apiVersion: rbac.authorization.k8s.io/v1
285     kind: ClusterRoleBinding
286     metadata:
287       name: psp:icn:any
288     roleRef:
289       kind: ClusterRole
290       name: psp:icn
291       apiGroup: rbac.authorization.k8s.io
292     subjects:
293     - kind: Group
294       name: system:authenticated
295       apiGroup: rbac.authorization.k8s.io
296 kind: ConfigMap
297 metadata:
298   creationTimestamp: null
299   name: {{ .Values.clusterName }}-podsecurity-addon