Understanding Kubernetes Pod Security Standards: Definitions and Significance
Kubernetes Pod Security Standards (PSS) are designed to provide scalable security configurations that cater to a wide range of security requirements for pods within a Kubernetes cluster. These standards are defined across three distinct levels: Privileged, Baseline, and Restricted. Each level is structured to provide different security controls that progressively enhance the security posture of the Kubernetes environment. Here, we'll explore each security level in more detail, explaining their implications and the security outcomes they aim to achieve.
Privileged Profile
Definition: The Privileged profile offers the highest level of permissions and the least amount of restrictions within a Kubernetes environment. It allows for full operational freedom, including the capability for known privilege escalations.
Impact: This profile is typically reserved for system-level and infrastructure workloads where administrators are trusted and fully aware of the security implications. The absence of restrictions maximizes operational flexibility but increases the risk of security breaches if not managed by knowledgeable and trusted personnel. It is ideal for:
System daemons that require high-level access to the host.
Infrastructure services that manage the underlying hardware or Kubernetes software.
Example Configuration:
apiVersion: v1
kind: Pod
metadata:
name: privileged-pod
spec:
containers:
- name: privileged-container
image: privilegedimage:latest
securityContext:
privileged: true
In this setup, the pod is configured with a privileged security context, reflecting the highest level of trust and capability within the cluster.
Baseline Profile
Definition: The Baseline profile establishes a default security level that prevents known privilege escalations while permitting sufficient flexibility to accommodate most common containerized applications.
Impact: This profile is designed as a security-enhanced starting point for most applications, balancing security and usability without compromising essential functionalities. It is suited for:
Application operators and developers.
Non-critical applications that still require standard security protections.
Workloads where compatibility and ease of use are critical.
Example Configuration:
apiVersion: apps/v1
kind: Deployment
metadata:
name: baseline-app
spec:
replicas: 1
selector:
matchLabels:
app: baseline-app
template:
metadata:
labels:
app: baseline-app
spec:
containers:
- name: baseline-container
image: baselineimage:latest
securityContext:
runAsNonRoot: true
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
This configuration enhances security by enforcing non-root operation, disallowing privilege escalation, and utilizing a read-only root filesystem.
Restricted Profile
Definition: The Restricted profile applies the strictest security settings, adhering to current best practices for hardening pods. It aims to minimize the attack surface and mitigate potential vulnerabilities.
Impact: This profile is intended for security-sensitive applications and environments where security is prioritized above ease of use. It is recommended for:
Security-critical applications such as those handling sensitive or regulated data.
Environments where strict compliance and minimum risk are required.
Example Configuration:
apiVersion: apps/v1
kind: Deployment
metadata:
name: secure-app
spec:
replicas: 2
selector:
matchLabels:
app: secure-app
template:
metadata:
labels:
app: secure-app
spec:
securityContext:
seLinuxOptions:
level: "s0:c123,c456"
containers:
- name: secure-container
image: secureimage:latest
securityContext:
allowPrivilegeEscalation: false
runAsNonRoot: true
capabilities:
drop:
- ALL
add:
- NET_BIND_SERVICE
seccompProfile:
type: RuntimeDefault
In this deployment, stringent security settings are enforced, including SE Linux contexts, minimal capabilities, and the default Seccomp profile, representing a high-security posture.
Conclusion
Understanding and correctly implementing Kubernetes Pod Security Standards are essential for safeguarding your Kubernetes environment. Each profile serves distinct operational and security needs, enabling administrators to align their security strategies with their specific operational requirements and risk profiles. Regular updates and audits of these configurations, aligned with evolving security practices and Kubernetes enhancements, ensure that the security measures remain effective and robust.
Subscribe to my newsletter
Read articles from Samokhvalova Valentina directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by