File tree Expand file tree Collapse file tree 7 files changed +83
-13
lines changed Expand file tree Collapse file tree 7 files changed +83
-13
lines changed Original file line number Diff line number Diff line change 1+ # Security
2+
3+ This file documents security measures and their configuration in current code base
4+
5+ ## Application developer
6+
7+ Full list: https://kubernetes.io/docs/concepts/security/application-security-checklist/
8+
9+ #### Pod-level securityContext recommendations
10+
11+ Enable pod security standard on namespace level:
12+ * create namespace with labels https://aro-labs.com/pod-security-standards/
13+ * configure pod and container security context to satisfy security standards
14+
15+ ## Cluster / OPS developers
16+
17+ Full list: https://kubernetes.io/docs/concepts/security/security-checklist/
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ type: application
1515# This is the chart version. This version number should be incremented each time you make changes
1616# to the chart and its templates, including the app version.
1717# Versions are expected to follow Semantic Versioning (https://semver.org/)
18- version : 0.0.1
18+ version : 0.0.2
1919
2020# This is the version number of the application being deployed. This version number should be
2121# incremented each time you make changes to the application. Versions are not expected to
Original file line number Diff line number Diff line change 7272 { {- end } }
7373{ {- end } }
7474{ {- end -} }
75+
76+ { {/*
77+
78+ Usage:
79+ {{- include " common-helpers.defaultPodSecurityContext" . | nindent 0 } }
80+
81+ Defines a common pod security context to ensure minimal privileges for containers.
82+
83+ Values inspired from https://medium.com/dynatrace-engineering/kubernetes-security-part-3-security-context-7d44862c4cfa
84+ */}}
85+ { {- define " common-helpers.defaultPodSecurityContext" -} }
86+ runAsNonRoot: true
87+ seccompProfile:
88+ type: RuntimeDefault
89+ { {- end -} }
90+
91+ { {/*
92+
93+ Usage:
94+ {{- include " common-helpers.defaultContainerSecurityContext" . | nindent 0 } }
95+
96+ Defines a common container security context to ensure minimal privileges for containers.
97+
98+ Values inspired from https://medium.com/dynatrace-engineering/kubernetes-security-part-3-security-context-7d44862c4cfa
99+ */}}
100+ { {- define " common-helpers.defaultContainerSecurityContext" -} }
101+ privileged: false
102+ readOnlyRootFilesystem: true
103+ allowPrivilegeEscalation: false
104+ capabilities:
105+ drop:
106+ - ALL
107+ { {- end -} }
Original file line number Diff line number Diff line change 1+ # namespace with defined pod security standard
2+ # inspired from https://aro-labs.com/pod-security-standards/
3+ # official doc: https://kubernetes.io/docs/concepts/security/pod-security-standards/
4+ #
5+ # Warning: if pod / container does not meet enforced standards, it will not be deployed (silently)
6+ # execute `kubectl -n <namespace> events` to see errors (e.g.)
7+ # Error creating: pods "xyz" is forbidden: violates PodSecurity "baseline:latest": privileged
8+ # container "xyz" must not set securityContext.privileged to true
9+ #
10+ apiVersion : v1
11+ kind : Namespace
12+ metadata :
13+ name : simcore
14+ labels :
15+ pod-security.kubernetes.io/enforce : baseline
16+ pod-security.kubernetes.io/warn : restricted
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ description: A Helm chart for Kubernetes
44
55dependencies :
66 - name : common-helpers
7- version : 0.0.1
7+ version : 0.0.2
88 repository : " file://../common-helpers"
99
1010# A chart can be either an 'application' or a 'library' chart.
@@ -20,7 +20,7 @@ type: application
2020# This is the chart version. This version number should be incremented each time you make changes
2121# to the chart and its templates, including the app version.
2222# Versions are expected to follow Semantic Versioning (https://semver.org/)
23- version : 0.0.1
23+ version : 0.0.2
2424
2525# This is the version number of the application being deployed. This version number should be
2626# incremented each time you make changes to the application. Versions are not expected to
Original file line number Diff line number Diff line change @@ -29,11 +29,19 @@ spec:
2929 {{- end }}
3030 serviceAccountName : {{ include "resource-usage-tracker.serviceAccountName" . }}
3131 securityContext :
32+ {{- if .Values.podSecurityContext }}
3233 {{- toYaml .Values.podSecurityContext | nindent 8 }}
34+ {{- else }}
35+ {{- include "common-helpers.defaultPodSecurityContext" . | nindent 8 }}
36+ {{- end }}
3337 containers :
3438 - name : {{ .Chart.Name }}
3539 securityContext :
40+ {{- if .Values.securityContext }}
3641 {{- toYaml .Values.securityContext | nindent 12 }}
42+ {{- else }}
43+ {{- include "common-helpers.defaultContainerSecurityContext" . | nindent 12 }}
44+ {{- end }}
3745 image : " {{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
3846 imagePullPolicy : {{ .Values.image.pullPolicy }}
3947 env :
Original file line number Diff line number Diff line change @@ -28,16 +28,12 @@ serviceAccount:
2828podAnnotations: {}
2929podLabels: {}
3030
31- podSecurityContext: {}
32- # fsGroup: 2000
33-
34- securityContext: {}
35- # capabilities:
36- # drop:
37- # - ALL
38- # readOnlyRootFilesystem: true
39- # runAsNonRoot: true
40- # runAsUser: 1000
31+ podSecurityContext:
32+ seccompProfile:
33+ type: RuntimeDefault
34+
35+ securityContext:
36+ privileged: false
4137
4238service:
4339 type: ClusterIP
You can’t perform that action at this time.
0 commit comments