Pod shares the host IPC namespace

Disable host_ipc for pods that do not need host IPC resources.

Description

Set host_ipc = false for Pods that do not need host shared memory or semaphores. With true, a process may read or modify node IPC data where the resource permissions allow it.

Potential impact

Changes to a shared IPC resource or exhaustion of that resource can disrupt other processes that depend on it.

Remediation

Review the purpose and permissions of system tools that need an exception. Run them as non-root with the privileges they need, and enforce IPC isolation for other workloads with Pod Security Admission or a policy engine.

Examples

Use a maintained deployment image in place of the example’s nginx:1.7.9.

Before

hcl
resource "kubernetes_pod" "pod" {
  metadata {
    name = "terraform-example"
  }

  spec {
    host_ipc = true

    container {
      image = "nginx:1.7.9"
      name  = "example"
    }
  }
}

After

hcl
resource "kubernetes_pod" "pod" {
  metadata {
    name = "terraform-example"
  }

  spec {
    host_ipc = false

    container {
      image = "nginx:1.7.9"
      name  = "example"
    }
  }
}

Verify that hostIPC is disabled in the deployed Pod and that the application works with its own IPC resources.

References