Vicedomini Softworks

Software Security

Kubernetes Security Without Breaking Production Workloads

14 October 2026

Engineer reviewing a staged Kubernetes security policy

Kubernetes security is defence-in-depth across build, deploy and runtime. Start by protecting the API with TLS and no anonymous access, then apply least-privilege RBAC, the restricted Pod Security Standard and default-deny network policies. Add image scanning and signing, audit logs and etcd encryption. Defaults are permissive, so these controls must be verified continuously and automatically, not configured once.


TL;DR:

  • Generate an SBOM for every image, scan each in CI, block promotion for critical CVEs, and use build credentials that expire quickly.
  • Test admission rules in audit or warn mode, fix violations, then enforce them in a canary namespace with a rollback ready.
  • Apply explicit ingress and egress rules after default denial, and confirm your CNI enforces NetworkPolicy because unsupported policies isolate nothing.
  • Schedule CIS benchmark checks, compare live cluster state with Git, and send audit logs to your SIEM to spot configuration drift.
  • Keep etcd behind a firewall accessible only to API servers, and secure the Kubelet with authentication and authorization while blocking external access.

Vicedomini Softworks
Build More Secure Kubernetes Software
Vicedomini Softworks builds cloud-native software and infrastructure, with engineering practices that include Kubernetes orchestration and Zero Trust security.
Ask for a consultation

Table of Contents

What is Kubernetes security and why does it matter?

Kubernetes security is the set of protections around the control plane, nodes, workloads, network and software supply chain of a cluster. The platform gives you primitives such as RBAC, admission control, NetworkPolicy and Pod Security Admission, but it does not switch them on in a hardened state. A default cluster can leave the API open to anonymous requests, etcd unencrypted at rest and audit logging disabled, as CISA and NSA warn. That is the shared responsibility model in practice: the project supplies the mechanisms, and you configure them.

We organise this guide by lifecycle phase, because each phase has its own typical failure:

  • Build: a vulnerable or tampered image enters the registry because nothing scanned or signed it.
  • Deploy: a misconfigured RBAC role or a privileged pod passes straight through to the scheduler.
  • Runtime: a compromised container moves laterally or exfiltrates data because no network policy or detection existed.
  • Control plane and nodes: an exposed Kubelet or an unencrypted etcd hands an attacker the whole cluster.

The reference points throughout are the CISA and NSA Kubernetes Hardening Guide and the CIS Kubernetes Benchmark, which many teams use as the baseline for automated checks. We at Vicedomini Softworks build and operate containerised platforms on Kubernetes and Red Hat OpenShift, and the staging advice below reflects how we introduce controls into production without breaking workloads.

Which build-time controls stop vulnerable artefacts reaching your cluster?

The cheapest place to stop a vulnerability is before an image exists. Build-time controls treat the pipeline as part of the attack surface, because a compromised CI job can ship malicious code through every downstream control you have.

Start with provenance. Sign your images and verify the signatures at admission, so that only artefacts produced by your pipeline can run. Guidance on platform integrity for cloud infrastructures recommends exactly this: sign container images and enforce verification through admission controllers. Pair it with a private registry and an allowlist, so that a developer cannot pull an arbitrary public image into production by accident.

The practical controls, in the order we usually introduce them:

  • Generate a software bill of materials (SBOM) for every image and store it next to the artefact, then reference it in admission policies.
  • Run SAST on source code and DAST against a running test deployment, so that flaws are caught before an image is built. This follows the secure-by-design principles that build on the NIST Secure Software Development Framework.
  • Scan images for vulnerabilities in CI, and block promotion of any image with critical CVEs.
  • Validate infrastructure as code (Terraform, Helm charts, raw YAML) with automated policy checkers, so a privileged container or an open security group fails the build.
  • Use short-lived build credentials and rotate signing keys through automation, never through a shared secret in a CI variable.

Operational discipline matters as much as tooling. Build worker node images once, keep them immutable, and replace nodes instead of patching them in place. A node that drifts from its golden image is a node you can no longer reason about.

Pro Tip: Fail the pipeline on a missing signature or SBOM, not only on a known CVE. A scanner can only report vulnerabilities it already knows about, while a provenance gate stops unknown artefacts regardless.

The OWASP Kubernetes Security Cheat Sheet covers image handling and admission patterns in more depth and is a useful companion when you write your first pipeline gates.

How do you control who can act on the cluster at deploy time?

Deploy-time controls answer two questions: who is allowed to talk to the API, and what is a workload allowed to look like when it arrives. The Kubernetes documentation on securing a cluster treats the API as the centre of gravity: configure TLS, authentication and authorisation for every client.

Work through these in order:

  • Protect the API. Require TLS for all API traffic and disable anonymous access. Prefer OIDC and single sign-on for human users over long-lived static credentials or shared client certificates.
  • Apply RBAC with least privilege. Remove wildcard verbs and resources, bind roles to groups rather than individuals, and reserve cluster-admin for a documented break-glass procedure. Schedule periodic access reviews, because permissions accumulate quietly and rarely shrink on their own.
  • Enforce policy at admission. Use OPA Gatekeeper or Kyverno to require image allowlists, readOnlyRootFilesystem, dropped capabilities and a deliberate decision on service account token automounting.
  • Adopt the restricted Pod Security Standard. Use Pod Security Admission for production namespaces, and label namespaces at creation so the baseline is secure by default rather than retrofitted.

The part teams get wrong is rollout. Switching admission policy to enforce on a live cluster can block a deployment pipeline. Stage every change instead. Run Pod Security Admission in audit and warn modes first, read the violations, fix the workloads that deserve fixing and grant documented exceptions for the rest. Policy engines support the same pattern: deploy a rule in audit mode, review what it would have denied, then flip it to deny in a canary namespace before widening scope.

Keep a rollback path for each step. A policy that can be reverted with a single commit is a policy your team will actually dare to enforce.

Which runtime controls contain a threat that is already inside?

Assume something eventually runs that you did not intend. Runtime controls limit what it can reach and make its behaviour visible. The Cloud Native Security guidance from the Kubernetes project lists seccomp, AppArmor, resource quotas and node partitioning among the runtime protections to adopt.

  • Default-deny NetworkPolicy. Apply a deny rule for ingress and egress in every namespace, then add explicit allow rules per workload. NetworkPolicy is a declarative standard that many CNIs honour, and the Project Calico documentation describes how it expresses pod-to-pod and pod-to-external rules. Confirm that your CNI actually enforces it, since a policy object on a CNI that ignores it protects nothing. Consider a service mesh for mutual TLS where service-to-service identity matters.
  • Process and filesystem hardening. Set the seccomp profile to RuntimeDefault, use AppArmor or SELinux where your nodes support them, enforce runAsNonRoot, drop all capabilities you do not need and set resource limits so that one workload cannot starve its neighbours.
  • Runtime detection. Deploy tooling that observes syscalls, unexpected processes, file changes and unusual network patterns, and forward Kubernetes audit logs to your SIEM so that API activity and container behaviour can be correlated.
  • Metadata and credential exposure. Block pod access to cloud metadata endpoints with egress filtering and keep instance credentials narrowly scoped, so a compromised pod cannot borrow the node’s identity.

Why read-only filesystems pay off: practitioners auditing ingress-nginx found that a read-only root filesystem often stops configuration injection from becoming a full compromise, and that auditing controller annotations and moving toward Gateway API reduces exposure.

Enable audit logging early and keep it on. An audit trail with no runtime alert beside it is a record of what happened, while an alert with no audit trail is a guess about why. You need both to reconstruct an incident, and to know which credentials to rotate afterwards.

How do you harden the control plane, etcd and nodes?

The control plane is the cluster’s centre of trust, and everything else inherits its weaknesses. Anyone who can read etcd can read every Secret; anyone who controls the API server controls every workload.

  • Encrypt etcd at rest and use mutual TLS between the API server and etcd. Place etcd behind a firewall so that only API servers can reach it, never application subnets.
  • Protect your certificate authorities and automate certificate rotation with short lifetimes. An expired certificate is an outage, and a never-rotated one is a standing liability.
  • Harden the Kubelet. Enable authentication and authorisation on the Kubelet API and never expose its endpoints to the internet or to general pod networks. The Kubernetes security checklist covers etcd protection and Kubelet settings in one place.
  • Treat nodes as disposable. Use immutable images, restrict SSH in favour of agent-based maintenance, keep worker nodes in private subnets and replace them on a schedule so that drift cannot accumulate.

These controls rarely appear in application code reviews, which is precisely why they deserve an explicit owner on the platform team.

How do you keep security posture continuous with tooling and automation?

A hardened cluster decays the moment someone applies a quick fix by hand. Automation turns a point-in-time audit into a standing guarantee, and it gives you evidence when someone asks what changed.

  • Run kube-bench on a schedule to check the cluster against the CIS benchmark, and push the output to a dashboard or a CI gate so that regressions are visible.
  • Combine image vulnerability scanners with SBOM tooling, and use admission policies to reject unsigned images.
  • Use OPA Gatekeeper or Kyverno for declarative, version-controlled enforcement, validating each rule in dry-run before it denies anything.
  • Send audit logs into your SIEM or observability pipeline, and detect configuration drift by comparing live cluster state with what is in Git.

Pro Tip: Treat policy as code in the same repository as your manifests. A pull request that changes a Kyverno rule gets the same review, tests and rollback as an application change.

The broader Kubernetes security overview describes how admission controllers, audit logging and the extension mechanisms fit together, which helps when you decide which ecosystem tools to plug in.

What should you do first? A prioritised hardening checklist

Order matters more than completeness. This sequence front-loads the controls with the broadest effect and keeps each step small enough to roll back.

  1. Immediate (days 0–7): enable TLS on the API, disable anonymous access, turn on audit logging, encrypt etcd and apply a default-deny network policy to production namespaces.
  2. Short term: enforce the restricted Pod Security Standard, tighten RBAC to least privilege, add image scanning to CI and configure a Secrets store with KMS-backed encryption.
  3. Medium term: move policy to enforced Gatekeeper or Kyverno rules, automate kube-bench, deploy a runtime security agent with SIEM integration, and rehearse recovery and incident playbooks.
  4. Throughout: stage every change with dry-run, use canary namespaces, keep rollouts small and write the rollback before the change, not after it breaks.

Include incident response in the medium-term work, not as an afterthought. A playbook that says who revokes credentials, who isolates a namespace and who restores from a clean image is worth more during a breach than any additional scanner.

Why does this approach match industry guidance?

The structure above is not our invention. It follows the lifecycle logic of the CISA and NSA hardening guidance, the CIS benchmark and the Kubernetes project’s own recommendations, and it leans on secure-by-design and secure-by-default principles. We bring to it our work in cloud-native engineering, Zero Trust security, containerisation and Kubernetes orchestration, and you can see applied examples in our case studies.

Our editorial take: stage first, enforce later

Most Kubernetes hardening advice fails at the same point: it is a list of correct controls with no account of how a production team adopts them. A guide that says “enforce the restricted profile” is right and also useless to an engineer whose deployments will break on Monday morning.

Our editorial take: stage first, enforce later — overview diagram

We think the overrated work is the long manual audit. A spreadsheet of CIS findings ages faster than anyone can close it. The underrated work is the unglamorous plumbing: dry-run modes, canary namespaces, policy kept in Git and a rollback for every rule. Teams that invest there tend to end up with enforced controls, while teams that skip it end up with controls that were switched off after the first outage.

If you do only one thing, put the API and RBAC in order, then default-deny the network, because those cut the attacker’s options the most per hour spent. Everything else, including detection, matters, but detection without containment only tells you how badly you were hurt.

— Pepe F.

How we can help you secure Kubernetes

Vicedomini Softworks

If your team wants a second pair of engineers on cluster security, we can help directly, without an account-manager layer between you and the people doing the work. Our services include architecture and technology stack consultancy, code audit and technical debt remediation, and custom software development for cloud-native platforms. For ongoing leadership, our CTO advisory and fractional CTO plans help you set a security roadmap and run it. An initial assessment starts from 3500 EUR one-off, and it is the quickest way to get a written view of your cluster. Start with that assessment on the page above, and we will tell you what to fix first.

FAQ

What is the difference between Docker and Kubernetes?

Docker builds and runs individual containers, while Kubernetes orchestrates many containers across a fleet of nodes. Kubernetes handles scheduling, scaling, networking and self-healing, so security controls such as RBAC and NetworkPolicy apply at the cluster level rather than per container.

What is Kubernetes used for?

Kubernetes runs and manages containerised applications at scale, handling deployment, scaling, service discovery and recovery. Because it centralises control of many workloads, securing its API and configuration protects everything running on it.

What is a namespace in Kubernetes?

A namespace is a logical partition of a cluster that groups resources and scopes names, quotas and access rules. It is the natural boundary for applying Pod Security Standards, RBAC roles and default-deny network policies.

What is a pod in Kubernetes?

A pod is a deployable unit in Kubernetes: a set of containers that share network and storage and are scheduled together. Pod-level settings such as runAsNonRoot, seccomp profiles and read-only filesystems are the main workload hardening controls.

Sources

This article was produced with AI assistance and reviewed for accuracy. It is provided for general information only and is not professional advice.