Enhancing Security in Kubernetes Environments
A practical guide to Kubernetes security covering RBAC, network policies, pod security standards, secrets management, runtime detection, and supply chain security.
THNKBIG Team
Engineering Insights
Why Kubernetes Security Demands a Different Mindset
Kubernetes does not become secure by default. Out of the box, most clusters allow unrestricted pod-to-pod communication, run containers as root, and store secrets in plaintext etcd entries. That is not a design flaw. It is a conscious trade-off for flexibility. The problem is that too many teams ship to production without tightening those defaults.
A 2024 Red Hat survey found that 67% of organizations delayed or slowed Kubernetes deployments because of security concerns. The concerns are valid. But the answer is not to avoid Kubernetes. It is to treat security as a first-class operational discipline, not a checkbox exercise.
This post covers the six areas that matter most: RBAC, network policies, pod security standards, secrets management, runtime security, and supply chain security. Each section includes concrete steps you can implement this week.
RBAC: Least Privilege Is Not Optional
Role-Based Access Control is the front door to your cluster. Every API request — from kubectl commands to service account tokens inside pods — passes through the RBAC admission chain. Get this wrong, and everything downstream is compromised.
Start with deny-all. Create ClusterRoles and Roles that grant only the specific verbs and resources each workload needs. Avoid binding to the cluster-admin ClusterRole in production. Audit existing bindings with kubectl auth can-i --list --as=system:serviceaccount:namespace:sa-name to find over-permissioned accounts.
Rotate service account tokens. Kubernetes 1.24+ no longer auto-generates long-lived tokens, but legacy clusters may still have them. Use projected service account tokens with short TTLs. NIST SP 800-190 (Application Container Security Guide) explicitly recommends scoping service accounts per workload, not per namespace.
Network Policies: Segment or Be Breached
By default, every pod can reach every other pod across every namespace. In a compromised container, lateral movement is trivial. Network policies fix this by defining explicit ingress and egress rules at the pod level.
A baseline policy: deny all ingress and egress at the namespace level, then whitelist specific traffic. For example, your API pods should only accept traffic from the ingress controller namespace. Your database pods should only accept traffic from the API namespace on port 5432.
Not all CNI plugins support network policies equally. Calico and Cilium provide full support, including egress rules and DNS-based policies. Flannel does not support network policies at all. If you run Flannel, you have no network segmentation inside the cluster. That is a critical gap. Consider migrating to Cilium, which also adds eBPF-based observability — see our service mesh consulting for migration guidance.
Pod Security Standards: Replace PodSecurityPolicies
PodSecurityPolicies were deprecated in Kubernetes 1.21 and removed in 1.25. The replacement is Pod Security Standards (PSS) enforced through the built-in Pod Security Admission controller. Three profiles exist: Privileged (unrestricted), Baseline (prevents known privilege escalations), and Restricted (hardened best practices).
Apply the Restricted profile to all production namespaces. It blocks running as root, prevents privilege escalation, requires a read-only root filesystem, and drops all Linux capabilities except NET_BIND_SERVICE. Label your namespaces: pod-security.kubernetes.io/enforce: restricted.
For workloads that genuinely need elevated privileges — like monitoring agents or CNI plugins — isolate them in dedicated namespaces with the Baseline profile and strict RBAC. Document every exception. Undocumented exceptions become permanent.
Secrets Management: Get Out of etcd
Kubernetes Secrets are base64-encoded, not encrypted. Anyone with read access to the Secrets API in a namespace can decode them. Etcd encryption at rest helps, but the real solution is an external secrets manager.
HashiCorp Vault, AWS Secrets Manager, or Azure Key Vault should be the source of truth. Use the External Secrets Operator or the Secrets Store CSI Driver to sync secrets into Kubernetes. This gives you audit trails, automatic rotation, and centralized policy enforcement that native Kubernetes Secrets cannot provide.
Never bake secrets into container images. Never pass them as environment variables in pod specs committed to Git. Use sealed-secrets or SOPS for GitOps workflows where encrypted secrets live in the repository and are decrypted only inside the cluster.
Runtime Security: Detect What Policies Cannot Prevent
Admission policies prevent known-bad configurations at deploy time. Runtime security detects unknown-bad behavior at execution time. Both are necessary. Neither is sufficient alone.
Falco is the de facto open-source runtime security engine for Kubernetes. It monitors system calls at the kernel level and fires alerts when a container does something unexpected — spawning a shell, reading /etc/shadow, or making outbound network connections to unfamiliar IPs.
Pair Falco with a response framework. An alert that nobody acts on is just noise. Route Falco events to your SIEM, create runbooks for the top ten alert types, and automate responses for the most critical detections. Killing a compromised pod automatically is better than waiting for a human to notice the alert at 3 AM. Our zero-trust security practice helps teams build these response workflows from detection to automated remediation.
Supply Chain Security: Trust Nothing by Default
Container images are the software supply chain for Kubernetes. If an attacker poisons a base image, every workload built on it is compromised. NIST SP 800-204 recommends verifying image provenance and scanning for known vulnerabilities before admission.
Use Sigstore Cosign to sign images in your CI pipeline and verify signatures at admission with Kyverno or OPA Gatekeeper. Scan images with Trivy or Grype and block deployments with critical CVEs. Pin image tags to digests — never deploy :latest in production.
Maintain a private registry with curated base images. Rebuild base images weekly to pick up OS-level patches. Track your SBOM (Software Bill of Materials) so you can respond to zero-day disclosures within hours, not days.
Security Is an Operational Practice, Not a Feature
Kubernetes security is not a one-time project. It is an ongoing operational discipline that requires policy enforcement, runtime monitoring, regular audits, and incident response playbooks. The clusters that get breached are not the ones missing a tool. They are the ones missing a process.
If your team is running Kubernetes in production and has not audited RBAC bindings, network policies, and secrets management in the last quarter, you have blind spots. Our engineers have hardened clusters across financial services, healthcare, and SaaS platforms.
Talk to an engineer about a Kubernetes security assessment.
Security as a Platform Feature
- The most effective Kubernetes security posture treats security controls as platform features — built into the deployment toolchain and enforced automatically, not applied manually post-deployment.
- Policy-as-code with Kyverno or OPA Gatekeeper enforces security baselines at admission time, before workloads run — catching misconfigurations that runtime detection cannot prevent.
- A zero-trust approach inside the cluster (deny-all network policy, mTLS between services, RBAC least privilege) dramatically reduces the blast radius of any single compromised workload.
Building on the security controls covered in this post, the most important organizational shift is treating Kubernetes security as an ongoing operational discipline rather than a one-time project. Security posture degrades over time as new workloads are deployed, RBAC bindings accumulate, and network policies drift from their original intent. Quarterly security review cycles — auditing RBAC bindings, validating network policy completeness, reviewing Falco alert trends — maintain the posture that initial hardening established.
THNKBIG's zero-trust Kubernetes security practice designs and implements security architectures for regulated industries, conducts quarterly posture reviews, and provides incident response support when security events occur. US-based clients across financial services, healthcare, and government rely on our team for Kubernetes security depth that general-purpose security firms cannot match. Schedule a security assessment.
Explore Our Solutions
Related Reading
Image Registry Snowed In: What You Need to Know About the k8s.gcr.io Freeze
Prepare for the Kubernetes image registry migration from k8s.gcr.io to registry.k8s.io. Timeline, impact assessment, and migration steps.
KubeCon 2022 Recap: Insights from the Kubernetes Community
Running GPU Workloads on Kubernetes: A Practical Guide
GPUs on Kubernetes require more than just installing drivers. Learn how to schedule, share, and optimize GPU resources for AI/ML workloads at scale.
THNKBIG Team
Engineering Insights
Expert infrastructure engineers at THNKBIG, specializing in Kubernetes, cloud platforms, and AI/ML operations.
Ready to make AI operational?
Whether you're planning GPU infrastructure, stabilizing Kubernetes, or moving AI workloads into production — we'll assess where you are and what it takes to get there.
US-based team · All US citizens · Continental United States only