Secure a Deployment with Security Context and Capabilities
Scenario
The security team has identified that the joker-deployment in namespace joker needs hardening. The deployment is currently running with default security settings, which pose potential security risks.
The manifest file for the existing Deployment can be found at /home/laborant/joker-deployment.yaml.
🎯 Task
Modify the existing Deployment named joker-deployment running in namespace joker so that its containers:
- Run with user ID
3000 - Privilege escalation is forbidden
- Add the following Linux capabilities:
NET_BIND_SERVICENET_RAWNET_ADMIN
- Check the logs of the deployment that show user ID
3000.
Modified the YAML file at /home/laborant/joker-deployment.yaml
Hint
All security settings should be applied at the container level under spec.template.spec.containers[].securityContext:
runAsUser: 3000allowPrivilegeEscalation: falsecapabilitieswith add list