Home
Cybersecurity & AI Security / Part 52 — Container and Kubernetes Security

Container and Kubernetes Security

CAP, ACID vs BASE, latency numbers, back-of-envelope estimation, single points of failure — the vocabulary every system designer thinks in.


Core Philosophy: Modern cloud applications are overwhelmingly packaged in containers and run at scale by orchestration platforms like Kubernetes. This is the technology of how software actually runs today — and it has its own substantial security considerations at every layer. This page secures that stack. It connects directly to the container material in your On-Prem/DevOps module: you already understand containers and orchestration — this is the security layer over them.

Part 1: The Problem

The way software is packaged and run has changed. Modern applications are largely built as containers — and run, at scale, by container orchestration platforms, the dominant one being Kubernetes. This is not a niche; it is how a great deal of modern cloud software runs.

That shift brings its own security considerations. A containerized, orchestrated application has layers — the container image, the running container, the orchestration platform, the underlying hosts — and each layer has things that can go wrong. Securing this stack is a real and in-demand part of cloud security.

This page assumes you understand what containers and orchestration are — and you do: your On-Prem/DevOps module covers exactly this technology. That is a genuine advantage. Where someone new to the field would have to learn containers and their security at once, you already have the foundation. This page is the security layer over technology you already know. (If the container/orchestration concepts feel rusty, review that module’s relevant pages alongside this one.)

Part 2: The Concept — Containers and Their Security Model

A quick security-focused framing of what a container is (full coverage is in your DevOps module).

A container packages an application together with everything it needs to run, as a single, portable, isolated unit. Containers are created from container images — the templates that define what is in a container. Containers run isolated from one another and from the host.

The security-relevant points:

The mindset: containers are a packaging-and-running technology with real security benefits (isolation, consistency) and real security responsibilities at every layer. Treating “we use containers” as automatically secure is a mistake.

Part 3: The Concept — Image Security and the Supply Chain

Because a container is created from an image, image security is foundational — get the image wrong and every container from it is compromised.

The key image security concerns:

Vulnerable components in the image. A container image bundles an application and its dependencies and often an operating-system layer. All of that can contain known vulnerabilities — this is exactly the vulnerable-components / supply-chain problem from 2.10, now packaged into an image. An image built on an outdated base, or bundling vulnerable libraries, ships those vulnerabilities into every container.

The defense: image scanning — automatically scanning container images for known vulnerabilities (the SCA idea from 2.10 / 5B.3, applied to images). Scanned ideally before images are deployed, and continuously (because new vulnerabilities are disclosed in components that were “clean” yesterday).

Untrusted image sources. Images are often pulled from registries — image repositories. Pulling images from untrustworthy sources, or pulling a tampered image, means running code you cannot trust (the supply-chain integrity problem from 2.10). The defense: use trusted, verified image sources; verify image integrity.

Secrets baked into images. A common, serious mistake: hard-coding secrets — credentials, keys, tokens — inside a container image. Anyone who obtains the image obtains the secrets (the leaked-secrets problem from 2.10 / 4.2, now baked into an artifact that gets distributed widely). Secrets must never be built into images; they are supplied to containers at runtime through proper secrets management.

Bloated images. An image that includes far more than the application needs — extra tools, extra packages — has a larger attack surface (the attack-surface-reduction principle from 0.4 / 4.4). Minimal images — containing only what the application genuinely needs — are more secure.

Image hardening. Beyond the above: images built following secure practices — minimal, current, from trusted bases, no secrets, scanned.

The principle: the image is the foundation of container security. A scanned, minimal, trusted, secret-free, current image is the starting point for a secure container; an insecure image poisons everything built from it.

Part 4: The Concept — Runtime and Orchestration Security

Beyond the image, security applies to running containers and to the orchestration platform that runs them at scale.

Running container security:

Orchestration (Kubernetes) security. Orchestration platforms like Kubernetes manage many containers across many hosts — and the orchestration platform itself is a major security surface:

The host layer. Underneath it all, containers and orchestration run on hosts — and those hosts must be hardened too (Phase 4.4). The stack is only as secure as its foundation.

Part 5: The Concept — Defense in Depth Across the Stack

The unifying way to think about container and Kubernetes security: it is defense in depth (4.3) applied across the layers of the container stack.

text
   THE CONTAINER STACK — secure EVERY layer
   ┌─────────────────────────────────────────────┐
   │ ORCHESTRATION  — platform config, access     │
   │                  control, network controls   │
   │  ┌──────────────────────────────────────┐    │
   │  │ RUNTIME      — least-privilege         │    │
   │  │  containers  containers, resource      │    │
   │  │              limits, monitoring        │    │
   │  │  ┌────────────────────────────────┐    │    │
   │  │  │ IMAGE  — scanned, minimal,      │    │    │
   │  │  │          trusted, no secrets    │    │    │
   │  │  └────────────────────────────────┘    │    │
   │  └──────────────────────────────────────┘    │
   │ HOST           — hardened underlying hosts    │
   └─────────────────────────────────────────────┘
   A weakness at ANY layer is a weakness in the whole.

No single layer’s security is sufficient. A perfectly scanned image running as an over-privileged container is not secure. Least-privilege containers on a misconfigured orchestration platform are not secure. Everything well-configured on un-hardened hosts is not secure. Container security means securing every layer — image, runtime, orchestration, host — and the principles you need are all ones you already have:

Container security is not a new set of principles — it is the principles you already know, applied to a specific, layered, modern technology stack.

Part 6: The Concept — How This Fits, and the Bridge to DevSecOps

Container and Kubernetes security sits within the broader picture of Track C and connects forward.

So this page completes the “securing the cloud” half of Track C (5C.1 fundamentals, 5C.2 misconfiguration, 5C.3 containers/orchestration) and points firmly at the second half: building that security in, automatically, through DevSecOps.

🔑 The deep lesson: modern software runs in containers orchestrated by platforms like Kubernetes, and that stack has security at every layer — image (scanned, minimal, trusted, secret-free), runtime (least-privilege containers, limits, monitoring), orchestration (configuration, access control, network segmentation), and host (hardened). It is defense in depth across the stack, using principles you already hold — least privilege, attack-surface reduction, supply-chain management, hardening, segmentation, monitoring, secrets management. And because you already know the underlying technology from your DevOps module, this is the most direct “add security to what you know” page in the track — best realized by building the security in through DevSecOps.

📓 Key Terms

Term Plain meaning
ContainerA portable, isolated unit packaging an application with everything it needs to run.
Container imageThe template a container is created from.
Image scanningAutomatically scanning container images for known vulnerabilities.
Container registryA repository where container images are stored and pulled from.
Container escapeBreaking out of a container’s isolation — a real security concern.
OrchestrationManaging many containers across many hosts at scale.
KubernetesThe dominant container orchestration platform.
Runtime securitySecuring containers while they are running.

🧪 Hands-On Lab

Use containers and (where possible) a local or learning Kubernetes environment. This connects directly to your On-Prem/DevOps module — use that knowledge.

Task 1 — Review the technology. Revisit the container and orchestration material in your On-Prem/DevOps module. Confirm you are solid on what containers, images, and orchestration are — this page is the security layer over that.

Task 2 — Scan a container image. Take a container image (build one, or use a public one). Use an image-scanning tool (free/open-source options exist) to scan it for known vulnerabilities. Read the results — this is 2.10’s supply-chain scanning, applied to images.

Task 3 — Build a minimal, secure image. Build a container image deliberately: minimal (only what the app needs), from a trusted current base, with no secrets baked in. Compare its attack surface to a bloated image. Practice image hardening.

Task 4 — Run a least-privilege container. Run a container configured with minimum privileges (not privileged/root-equivalent) and with resource limits. Understand how an over-privileged container would be more dangerous if compromised.

Task 5 — Explore orchestration security. In a learning Kubernetes environment, explore its access-control system. Configure least-privilege access for something. See how the identity/access discipline from 5C.1/5C.2 applies to the orchestration layer.

Task 6 — Examine orchestration configuration. Look at the security-relevant configuration of an orchestration setup. Identify settings that matter for security. Connect this to the 5C.2 misconfiguration lesson — the orchestration platform is complex and easily misconfigured.

Task 7 — Map the defense-in-depth stack. In Notion, draw the container stack (image → runtime → orchestration → host) and, for each layer, write the security measures and the curriculum principle each comes from. See container security as principles you already know, layered.

Task 8 — Write a container security note. In Notion, create a “Container & Kubernetes Security” page — the layers, image security, runtime and orchestration security, and defense in depth across the stack.

⚠️ Common Mistakes

✅ Recap & What’s Next

Next (5C.4): Cloud infrastructure is defined through software — which means it can be defined as code. Page 5C.4 covers Infrastructure as Code security: finding and fixing infrastructure issues before deployment, preventing misconfiguration at the source.

⁂ Back to all modules