A security review requires every pod to run non-root with a read-only filesystem. How do you enforce it in your charts?
IntermediateScenarioChart Design & Authoring
Answer
Situation read → Defaults must be secure, and overriding them should be visible.
What I'd do →
- Default values:
podSecurityContext: { runAsNonRoot: true, runAsUser: 10001, fsGroup: 10001, seccompProfile: { type: RuntimeDefault } }
securityContext: { allowPrivilegeEscalation: false, readOnlyRootFilesystem: true, capabilities: { drop: [ALL] } }
- Add an
emptyDirfor/tmpso apps can still write scratch files. - Put these defaults in the library chart so all services inherit them.
- Enforce at the cluster with Pod Security Admission
restrictedor Kyverno, so charts that override them fail loudly.
Why → Chart defaults make the right thing easy; admission policy makes the wrong thing impossible.
Interview tip → Defense in depth: chart defaults plus admission control, not one or the other.
More on Chart Design & Authoring
Your team has 15 near-identical YAML folders, one per microservice per environment. How do you introduce Helm?BeginnerShould you build one generic chart for all microservices or one chart per service?IntermediateA developer hardcoded `namespace: production` in every template. What is wrong and how do you fix it?BeginnerChanging a ConfigMap value in the chart does not restart the pods, so the app keeps old config. What do you change?IntermediateYou need the same chart to support both Ingress and Gateway API HTTPRoute. How do you design it?IntermediateYour chart's Deployment template has grown to 300 lines of nested `if`s. How do you clean it up?Intermediate