✳ The reference desk / In practice

Container

A process run with its own view of the file system and resources, sharing the host's kernel.

What it means

A container packages an application with the files and libraries it needs, then runs it as an ordinary process on a host. The host's kernel gives that process its own view of the file system, processes, and network through namespaces, and limits its memory and processor time through control groups. Capabilities and seccomp filters narrow what it may ask the kernel to do.

Ordinary containers on a host share that one kernel. Sandboxed runtimes, such as gVisor or Kata Containers, add a separate kernel layer. A virtual machine runs its own kernel on virtual hardware, so it isolates more. A container's fence is only as strong as the settings around it. Running it privileged, on the host's network, or with a host directory mounted takes most of the fence down. In Kubernetes, containers run inside pods, and the pod spec holds those settings.

See the idea / Cloud

An ordinary container shares its node's kernel, so its settings are the fence.

Follow the uplink-status pod as two lines in its spec take down its fence, and the second one hands it the node role's credentials.

Meridian's uplink-status service runs as a Kubernetes pod on one node of the ground-telemetry cluster. A pod is one or more containers that start together. The node is a cloud server whose role, telemetry-ingest-node, can read the halcyon-downlink bucket. The node's metadata service hands that role's credentials to the node. It requires IMDSv2 tokens with a hop limit of 1, so its token replies cannot cross into a pod's own network.

Container: Follow the uplink-status pod as two lines in its spec take down its fence, and the second one hands it the node role's credentials. The chapter text below describes every state.ground-telemetry · one nodePod uplink-status, before the fixuplink-status · a processStartingSame kernel as the nodePrivileged settingNot read yetKubernetes: about root on hostNetwork namespaceNot read yetSpec: hostNetwork: trueNode metadata serviceNot askedIMDSv2 · hop limit 1A PROCESS ON A SHARED KERNEL

01 / 04

Process

The uplink-status container runs as an ordinary process on the node. Namespaces give it its own view, and a control group caps its memory.

More about this step

There is no second kernel. Namespaces give the process its own view of processes, network interfaces, and mounted files. A control group limits it to 256 MiB of memory. Capabilities and a seccomp filter would narrow what it may ask the kernel to do. All of these are settings in the pod spec.

Keep in mindOne pod on one node, before the fix. Kernel flaws, host path mounts, and the pod's service account token are not shown. The restricted Pod Security Standard would refuse this pod before it started.

Read the visual, step by step
  1. Process. The uplink-status container runs as an ordinary process on the node. Namespaces give it its own view, and a control group caps its memory. There is no second kernel. Namespaces give the process its own view of processes, network interfaces, and mounted files. A control group limits it to 256 MiB of memory. Capabilities and a seccomp filter would narrow what it may ask the kernel to do. All of these are settings in the pod spec.
  2. Privileged. The spec sets privileged: true. Most of the protections around the process are switched off. Kubernetes describes the processes in a privileged container as essentially equivalent to root on the host. The setting was left from a debug session. The baseline Pod Security Standard already refuses it.
  3. Host network. The spec also sets hostNetwork: true. The pod skips its own network namespace and uses the node's addresses. With its own network namespace, a pod gets its own address, one hop away from the node. With hostNetwork, its traffic leaves from the node's own interfaces. To anything on the network, including the metadata service, it looks like the node.
  4. Credentials. The pod asks the metadata service for a token. It is not a hop away, so the hop limit does not stop it, and it receives the node role's credentials. A hop limit of 1 stops a token reply from crossing into a pod's own network. This pod has none of its own. With the token, it collects temporary credentials for telemetry-ingest-node, which can read halcyon-downlink. Privileged played no part in this step. Host networking alone was enough. The bucket's access log later showed only the nodes' own reads.

One pod on one node, before the fix. Kernel flaws, host path mounts, and the pod's service account token are not shown. The restricted Pod Security Standard would refuse this pod before it started.

Flow references: NIST SP 800-190: Application Container Security Guide (September 2017) · Kubernetes documentation: Pod Security Standards · Amazon EC2 User Guide: instance metadata service options

AN ILLUSTRATIVE SCENARIO

A status page that was the node

Meridian's uplink-status service ran in a Kubernetes pod with privileged: true and hostNetwork: true, left over from a debug session. Because the pod shared the node's network, it could ask the node's metadata service for the node role's credentials, which could read the halcyon-downlink bucket. Kael moved the namespace to the restricted Pod Security Standard, which refuses both settings, and gave the pod its own narrow identity.

Put it to work

  1. List every workload that runs privileged, on a host namespace, or with a host path mount, and record why each one needs it.
  2. Enforce the baseline or restricted Pod Security Standard on each namespace, and keep workloads that truly need more in their own namespace.
  3. Run containers as a non-root user, drop the capabilities they do not need, and set a seccomp profile.

How to check your work

Try to create a pod with privileged: true in a restricted namespace and confirm admission refuses it. From inside a running container, confirm it cannot see the host's processes or get a reply from the metadata service.

Connect the ideas

  • Least privilege

    Granting each identity only the actions, objects, and time window required for the current job.

  • Privilege escalation

    Gaining rights that the starting account was not given. Vertical escalation reaches a more powerful account, such as an administrator. Horizontal escalation reaches another account at the same level.

  • Blast radius

    How much additional loss a failure or a response action can cause beyond the original asset.

Explore a field lesson

Find your next idea.

Tip: press / to open search. Escape closes this window.