SKY-D410 · Deployment and infrastructure
Kubernetes pod shares the node's process, IPC or network namespace
Namespaces are how Linux keeps a container's processes, shared memory and network separate from the host. SKY-D410 reports a Kubernetes pod spec that sets hostPID, hostIPC or hostNetwork to true, which puts the pod in the node's own namespace.
- Languages
- Kubernetes YAML
- Quality gate
- counted toward the gate limits (full and diff scans). Reported under security (
danger). It counts towardmax_highandmax_security; the rule never reports CRITICAL. - Finding type
- review
- Catalog name
- Kubernetes host namespace access
Why it matters
With hostPID the pod sees and can signal every process on the node, and can read their environment variables and secrets. With hostNetwork it can reach services bound to the node's localhost and sniff its traffic. Each one removes a wall an attacker would otherwise have to break.
What Skylos flags
apiVersion: apps/v1kind: DaemonSetmetadata: name: node-agent namespace: monitoringspec: selector: matchLabels: app: node-agent template: metadata: labels: app: node-agent spec: hostPID: true containers: - name: agent image: registry.example.com/node-agent:2.4.1What Skylos leaves alone
apiVersion: apps/v1kind: DaemonSetmetadata: name: node-agent namespace: monitoringspec: selector: matchLabels: app: node-agent template: metadata: labels: app: node-agent spec: shareProcessNamespace: true containers: - name: agent image: registry.example.com/node-agent:2.4.1Why Skylos leaves it alone
shareProcessNamespace lets the containers of this pod see each other's processes, for example for a debugging sidecar. It does not reach the node's processes.
How Skylos decides
- Runs with
--danger(or-a). Reads every.yamland.ymlfile that declares anapiVersionand akind, skipping.git,node_modules, build and virtual-environment folders. It never renders Helm templates or Kustomize overlays and never contacts a cluster. - Checks the pod spec of
Pod,PodTemplate,ReplicationController,Deployment,DaemonSet,ReplicaSet,StatefulSet,JobandCronJob, including items of av1List. Values containing template markers such as{{or${are treated as unknown and never reported. - Checks
hostPID,hostIPCandhostNetworkin the pod spec. - Reports each one that is the boolean
true, as its own finding, HIGH, on that line.falseor a missing value pass; a value that is not a boolean is not judged.
How to fix it
Remove the flag. A monitoring agent that needs node metrics can usually read them from /proc through a read-only mount, or from the kubelet's metrics endpoint.
apiVersion: apps/v1kind: DaemonSetmetadata: name: node-agent namespace: monitoringspec: selector: matchLabels: app: node-agent template: metadata: labels: app: node-agent spec:Removed: hostPID: true containers: - name: agent image: registry.example.com/node-agent:2.4.1When it can be wrong
- Node-level agents such as CNI plugins,
kube-proxyand some monitoring agents needhostNetworkorhostPIDby design. hostPorton a container port also exposes the pod on the node, but it is not a namespace setting and is not reported.- Helm chart templates are not rendered. A value written as
{{ .Values.x }}is not judged, and a template file that is not valid YAML on its own (most are not) stops the scan as incomplete, exit 2, with a Kubernetes parse error. Exclude the chart'stemplatesfolder and scan the output ofhelm templateinstead.
Seeing a case that isn't listed here? Report the wrong result so the rule can be fixed. Don't paste company code: describe the shape of it.
How to silence it
The Kubernetes rules read no inline marker:
# skylos: ignore[SKY-D410]on the reported line does not hide the finding.[tool.skylos] ignore = ["SKY-D410"]turns the rule off for the project.A baseline (
skylos baseline ., then--baseline) accepts the workloads that exist today and reports new ones.