Skip to content

Commit

Permalink
Merge pull request #2178 from prometheus-operator/seccomp
Browse files Browse the repository at this point in the history
Add securityContext items and add pod security labels
  • Loading branch information
metalmatze authored Oct 9, 2023
2 parents 1706065 + fd8436b commit ac1f39f
Show file tree
Hide file tree
Showing 10 changed files with 26 additions and 0 deletions.
3 changes: 3 additions & 0 deletions jsonnet/kube-prometheus/addons/pyrra.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@
securityContext: {
allowPrivilegeEscalation: false,
readOnlyRootFilesystem: true,
runAsNonRoot: true,
capabilities: { drop: ['ALL'] },
seccompProfile: { type: 'RuntimeDefault' },
},
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,5 +63,6 @@ function(params) {
allowPrivilegeEscalation: false,
readOnlyRootFilesystem: true,
capabilities: { drop: ['ALL'] },
seccompProfile: { type: 'RuntimeDefault' },
},
}
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,9 @@ function(params) {
securityContext: {
allowPrivilegeEscalation: false,
readOnlyRootFilesystem: true,
runAsNonRoot: true,
capabilities: { drop: ['ALL'] },
seccompProfile: { type: 'RuntimeDefault' },
},
};

Expand Down
4 changes: 4 additions & 0 deletions jsonnet/kube-prometheus/main.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,10 @@ local utils = import './lib/utils.libsonnet';
kind: 'Namespace',
metadata: {
name: $.values.common.namespace,
labels: {
'pod-security.kubernetes.io/warn': 'privileged',
'pod-security.kubernetes.io/warn-version': 'latest',
},
},
},
},
Expand Down
2 changes: 2 additions & 0 deletions manifests/blackboxExporter-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ spec:
runAsGroup: 65532
runAsNonRoot: true
runAsUser: 65532
seccompProfile:
type: RuntimeDefault
nodeSelector:
kubernetes.io/os: linux
serviceAccountName: blackbox-exporter
Expand Down
4 changes: 4 additions & 0 deletions manifests/kubeStateMetrics-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ spec:
runAsGroup: 65532
runAsNonRoot: true
runAsUser: 65532
seccompProfile:
type: RuntimeDefault
- args:
- --secure-listen-address=:9443
- --tls-cipher-suites=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305,TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305
Expand All @@ -101,6 +103,8 @@ spec:
runAsGroup: 65532
runAsNonRoot: true
runAsUser: 65532
seccompProfile:
type: RuntimeDefault
nodeSelector:
kubernetes.io/os: linux
serviceAccountName: kube-state-metrics
2 changes: 2 additions & 0 deletions manifests/nodeExporter-daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ spec:
runAsGroup: 65532
runAsNonRoot: true
runAsUser: 65532
seccompProfile:
type: RuntimeDefault
hostNetwork: true
hostPID: true
nodeSelector:
Expand Down
3 changes: 3 additions & 0 deletions manifests/prometheusAdapter-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ spec:
drop:
- ALL
readOnlyRootFilesystem: true
runAsNonRoot: true
seccompProfile:
type: RuntimeDefault
startupProbe:
failureThreshold: 18
httpGet:
Expand Down
2 changes: 2 additions & 0 deletions manifests/prometheusOperator-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ spec:
runAsGroup: 65532
runAsNonRoot: true
runAsUser: 65532
seccompProfile:
type: RuntimeDefault
nodeSelector:
kubernetes.io/os: linux
securityContext:
Expand Down
3 changes: 3 additions & 0 deletions manifests/setup/namespace.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
apiVersion: v1
kind: Namespace
metadata:
labels:
pod-security.kubernetes.io/warn: privileged
pod-security.kubernetes.io/warn-version: latest
name: monitoring

0 comments on commit ac1f39f

Please sign in to comment.