More Info:
Sharing the host IPC namespace allows a container to access shared memory of other processes on the node. Enforce policies that restrict admission of hostIPC containers.Risk Level
HighAddress
SecurityCompliance Standards
- CIS OKE
Triage and Remediation
- Remediation
Remediation
Manual Steps
Manual Steps
-
List existing pods using hostIPC in all namespaces
- Run on: any machine with kubectl access
- Command:
- Review which workloads currently require
hostIPC: true, and document the business/technical justification for each.
-
Inspect pod specs that use hostIPC to understand why it is needed
- Run on: any machine with kubectl access
- For each namespace with
hostIPC: truepods: - Decide case-by-case whether the host IPC access is strictly required or can be removed/alternative design used.
-
Review existing admission controls (e.g. Pod Security Standards / policies) per namespace
- Run on: any machine with kubectl access
- If using built-in Pod Security admission labels:
- If using Gatekeeper/Kyverno or another policy engine, list policies and identify those that constrain
spec.hostIPC: - Determine which namespaces hosting user workloads currently lack any policy preventing
hostIPC: true.
-
Decide and design namespace-level policy to minimize hostIPC
- For each user-workload namespace, decide:
- Should
hostIPCbe completely forbidden? - Are there exceptional workloads that must be allowed, and how will they be identified (labels, dedicated namespace, etc.)?
- Should
- Based on your admission controller (Pod Security, Gatekeeper, Kyverno, etc.), design or select a policy that:
- Denies pods with
spec.hostIPC: truein general user namespaces. - Optionally allows only explicitly approved workloads/namespaces.
- Denies pods with
- For each user-workload namespace, decide:
-
Apply or adjust the policy manifests for each user-workload namespace
- Run on: any machine with kubectl access
- Apply your chosen policy manifests using
kubectl apply -f <file>.yaml(content depends on your chosen policy engine and your decision in step 4). - For namespaces that must permit hostIPC for specific workloads, document and implement a controlled exception mechanism (e.g., dedicated namespace with stricter access control).
-
Re-verify that hostIPC usage is minimized and new admission is restricted
- Run on: any machine with kubectl access
- Confirm no unintended pods use hostIPC:
- Attempt (in a test namespace) to create a pod with
hostIPC: trueand confirm it is rejected by the policy, adjusting the policy if necessary.
Using kubectl
Using kubectl
Using kubectl
Run all commands from any machine withkubectl access.1. Discover current PodSecurity admission level per namespace
These labels indicate if baseline/restricted Pod Security is enforced, which can blockhostIPC: true.- Namespaces that run user workloads and either:
- Have no
pod-security.kubernetes.io/*labels, or - Are labeled with
privilegedor have onlywarn/auditlevels, notenforce, may allowhostIPC: truepods.
- Have no
default, app-specific namespaces, and any non-system namespaces.2. List existing pods/containers using hostIPC
- Any workload pod (not a deliberately privileged/system tool) with
hostIPC: trueis a potential security concern.
3. Check workloads that could create hostIPC pods
Deployments:- Any controller spec containing
hostIPC: truewill continuously create pods with host IPC enabled unless changed.
4. Find admission policies that address hostIPC (if using Kyverno/OPA/Gatekeeper, etc.)
Kyverno ClusterPolicies:- No admission policies referencing
hostIPCin namespaces with user workloads means there is no explicit control preventinghostIPC: truepods.
5. Verification after any policy decisions
After you adjust labels/policies manually, verify again:hostIPC: true workloads should be individually reviewed to decide if they are truly necessary and appropriately isolated.Automation
Automation
- The first table lists all pods that currently have
hostIPC: true.- Any entry here is a potential problem that must be explicitly justified as an exception.
- The “Namespaces that contain pods with hostIPC: true” list shows where you must ensure admission policies (e.g., Pod Security, PSP replacements, or validating admission policies) are configured to control or forbid
hostIPC. - The detailed spec section helps you review:
- Which service accounts and applications are using host IPC.
- Whether usage aligns with an approved exception.
- The namespace labels section helps you see if Pod Security (or equivalent) is configured strongly enough; namespaces with permissive labels while also having
hostIPC: truepods are higher-risk and should be reviewed closely.
hostIPC: true pod is acceptable and then adjust admission policies and workload manifests accordingly.
