Parcourir la source

(fix) added securityContext to the OpenCost backend container in the OpenCost deployment. Removed privileged escalation, dropped all capabilities, changed to read only access to file system and set the user to 1001 (same as Dockerfile)

Signed-off-by: Dani Wold Kristiansen <dani.wold.kristiansen@intility.no>
Dani Wold Kristiansen il y a 3 ans
Parent
commit
e0a310dcb0
1 fichiers modifiés avec 8 ajouts et 0 suppressions
  1. 8 0
      kubernetes/opencost.yaml

+ 8 - 0
kubernetes/opencost.yaml

@@ -159,6 +159,14 @@ spec:
             - name: CLUSTER_ID
             - name: CLUSTER_ID
               value: "cluster-one" # Default cluster ID to use if cluster_id is not set in Prometheus metrics.
               value: "cluster-one" # Default cluster ID to use if cluster_id is not set in Prometheus metrics.
           imagePullPolicy: Always
           imagePullPolicy: Always
+          securityContext:
+            allowPrivilegeEscalation: false
+            capabilities:
+              drop:
+                - ALL
+            privileged: false
+            readOnlyRootFilesystem: true
+            runAsUser: 1001
         - image: quay.io/kubecost1/opencost-ui:latest
         - image: quay.io/kubecost1/opencost-ui:latest
           name: opencost-ui
           name: opencost-ui
           resources:
           resources: