10 Kubernetes Cluster Hardening Steps (2027)

A 10-step Kubernetes cluster hardening checklist: API server access, RBAC, etcd encryption with KMS v2, kubelet, audit logs, Pod Security Admission, CIS.

Dec 8, 2025 - 12:22
Nov 11, 2026 - 14:21
 0  84
10 Kubernetes Cluster Hardening Steps (2027)

Securing a Kubernetes cluster starts with the infrastructure under your workloads: lock down API server access, enforce RBAC, encrypt Secrets in etcd, protect etcd itself, harden the kubelet, enable audit logging, apply Pod Security Admission, restrict network paths, stay on a supported version and check everything against the CIS Kubernetes Benchmark.

This post is a cluster hardening checklist for the control plane and nodes, with the configuration that implements each step. For workload-level advice such as image scanning and runtime detection, read 12 Kubernetes security best practices you must follow. If several teams share one cluster, 10 Kubernetes multi-tenant security practices covers isolation between tenants. The component names used below are explained in 12 must-know Kubernetes architecture components.

Key takeaways

  • Anyone who can reach etcd or the kubelet API without authentication effectively controls the cluster. Protect both first.
  • Kubernetes Secrets are only base64-encoded in etcd unless you configure encryption at rest. A KMS provider keeps the key off the control plane nodes.
  • Audit logging is off until you give the API server a policy file.
  • PodSecurityPolicy was removed in Kubernetes 1.25. Use Pod Security Admission or a policy engine instead.
  • On managed services (EKS, GKE, AKS) the provider runs the control plane, so many steps become provider settings. The checklist still applies; only the switch changes.

The checklist at a glance

#StepMain controlManaged service note
1Restrict API server accessPrivate endpoint, authorized networks, no anonymous accessProvider endpoint settings
2Enforce least-privilege RBACRoles, RoleBindings, no wildcard cluster-admin grantsYou own this
3Encrypt Secrets at restEncryptionConfiguration with KMS v2Provider envelope encryption option
4Protect etcdMutual TLS, firewalling, encrypted backupsProvider-managed
5Harden the kubeletDisable anonymous auth, webhook authorizationMostly provider defaults; verify on custom nodes
6Enable audit loggingAudit policy and log backendTurn on control plane audit logs
7Enforce Pod Security StandardsPod Security Admission labelsYou own this
8Restrict network pathsNetworkPolicy default deny, node firewallingCNI must support NetworkPolicy
9Stay on a supported versionRegular minor upgrades, node OS patchingProvider release channels
10Benchmark and monitor continuouslyCIS Benchmark scans, alerts on audit eventsProvider-specific CIS benchmarks exist

1. Restrict access to the API server

The API server (TCP 6443 by default on kubeadm clusters) is the front door for every change. Reduce who can reach it and how they prove who they are.

  • Expose it on a private network or limit it to known address ranges. Managed services offer private endpoints and authorized network lists.
  • Disable anonymous requests with --anonymous-auth=false unless you have a reviewed reason to allow them (some health checks rely on them; newer releases allow anonymous access to be limited to specific endpoints through the authentication configuration file).
  • Authenticate humans through an identity provider with OIDC rather than sharing long-lived client certificates. Client certificates cannot be revoked individually in Kubernetes.
  • Use --authorization-mode=Node,RBAC and keep the NodeRestriction admission plugin enabled so kubelets can only modify their own Node and Pods.
# Excerpt from /etc/kubernetes/manifests/kube-apiserver.yaml (kubeadm)
spec:
  containers:
    - command:
        - kube-apiserver
        - --anonymous-auth=false
        - --authorization-mode=Node,RBAC
        - --enable-admission-plugins=NodeRestriction
        - --encryption-provider-config=/etc/kubernetes/enc/encryption-config.yaml
        - --audit-policy-file=/etc/kubernetes/audit/policy.yaml
        - --audit-log-path=/var/log/kubernetes/audit/audit.log
        - --audit-log-maxage=30
        - --audit-log-maxbackup=10
        - --audit-log-maxsize=100

Editing this static Pod manifest restarts the API server. The files it references must also be mounted into the Pod with volumes and volumeMounts. Test on a non-production cluster first.

2. Enforce least-privilege RBAC

RBAC decides what an authenticated identity can do. Common problems are wildcard verbs, broad ClusterRoleBindings and default ServiceAccounts with permissions they never use.

  • Prefer namespaced Roles and RoleBindings over cluster-wide grants.
  • Avoid * in verbs and resources. Be careful with escalate, bind, impersonate, and create on Pods, which can all lead to privilege escalation.
  • Treat read access to Secrets as sensitive; list and watch return Secret contents.
  • Set automountServiceAccountToken: false for Pods that never call the API.
  • Review bindings to cluster-admin regularly.
# Who can read secrets in the payments namespace?
kubectl auth can-i list secrets --namespace payments --as system:serviceaccount:payments:default

# List everything bound to cluster-admin
kubectl get clusterrolebindings -o wide | grep cluster-admin

3. Encrypt Secrets at rest in etcd

By default the API server stores Secret data in etcd base64-encoded, which is not encryption. Anyone with an etcd backup or disk image can read it. Configure an EncryptionConfiguration and point the API server at it with --encryption-provider-config.

apiVersion: apiserver.config.k8s.io/v1
kind: EncryptionConfiguration
resources:
  - resources:
      - secrets
    providers:
      - kms:
          apiVersion: v2
          name: cloud-kms
          endpoint: unix:///var/run/kmsplugin/socket.sock
      - identity: {}

The KMS v2 provider (stable since Kubernetes 1.29) uses envelope encryption: data keys are encrypted by a key held in an external key management service, so the root key never sits on the control plane disk. The local aescbc and secretbox providers keep the key in the configuration file, which then becomes the thing to protect. After enabling encryption, existing Secrets stay unencrypted until they are rewritten:

kubectl get secrets --all-namespaces -o json | kubectl replace -f -

On managed services, enable the provider's envelope encryption option for Secrets. Our guide to tools to manage Kubernetes Secrets safely covers external secret managers that keep sensitive values out of etcd altogether.

4. Protect etcd

etcd holds the entire cluster state. Direct read access exposes every Secret; write access lets an attacker change anything. On self-managed clusters:

  • Require mutual TLS for client traffic (port 2379) and peer traffic (port 2380), using --client-cert-auth=true and --peer-client-cert-auth=true with certificates from a dedicated CA.
  • Allow only the API servers to reach etcd client ports. Block them from worker nodes and everything else at the firewall.
  • Encrypt etcd snapshots and store them away from the cluster, with restricted access. A snapshot holds the same data as the live database.
  • Test restores. A backup you have never restored is a guess.
ETCDCTL_API=3 etcdctl \
  --endpoints=https://127.0.0.1:2379 \
  --cacert=/etc/kubernetes/pki/etcd/ca.crt \
  --cert=/etc/kubernetes/pki/etcd/server.crt \
  --key=/etc/kubernetes/pki/etcd/server.key \
  snapshot save /backup/etcd-$(date +%F).db

5. Harden the kubelet

The kubelet API on each node (TCP 10250) can run commands in containers and read logs. If it accepts anonymous requests, anyone who can reach the node can do the same. Set these in the kubelet configuration file:

apiVersion: kubelet.config.k8s.io/v1beta1
kind: KubeletConfiguration
authentication:
  anonymous:
    enabled: false
  webhook:
    enabled: true
  x509:
    clientCAFile: /etc/kubernetes/pki/ca.crt
authorization:
  mode: Webhook
readOnlyPort: 0
rotateCertificates: true
protectKernelDefaults: true

Webhook authorization makes the kubelet ask the API server whether a caller may use its API, so RBAC applies at the node too. readOnlyPort: 0 turns off the old unauthenticated read-only port (10255). Also limit SSH access to nodes, use a minimal node OS, and keep node firewalls closed except for what the CNI and control plane need.

6. Enable audit logging

Audit logs record who did what through the API server. Without them, an incident investigation has very little to work with. The API server logs nothing until you supply a policy with --audit-policy-file and a backend such as --audit-log-path.

apiVersion: audit.k8s.io/v1
kind: Policy
omitStages:
  - RequestReceived
rules:
  # Never log Secret or ConfigMap bodies, only who touched them
  - level: Metadata
    resources:
      - group: ""
        resources: ["secrets", "configmaps"]
  # Skip noisy read-only health and discovery traffic
  - level: None
    nonResourceURLs: ["/healthz*", "/readyz*", "/livez*", "/version"]
  # Record request bodies for changes to RBAC
  - level: RequestResponse
    resources:
      - group: rbac.authorization.k8s.io
  # Everything else at Metadata
  - level: Metadata

The four levels are None, Metadata, Request and RequestResponse. Rules are evaluated in order and the first match wins. Ship the log off the node to your log platform and alert on events such as new ClusterRoleBindings, exec into Pods in production namespaces, and requests denied for Secrets. On managed services, enable control plane audit logs in the provider console or CLI. Where to find these logs during an incident is covered in 10 hidden Kubernetes logs you should check.

7. Enforce Pod Security Standards with Pod Security Admission

A Pod that runs privileged, mounts the host filesystem or uses the host network can often escape to the node. The Pod Security Standards define three levels: privileged, baseline and restricted. The built-in Pod Security Admission controller, stable since Kubernetes 1.25, enforces them per namespace with labels:

apiVersion: v1
kind: Namespace
metadata:
  name: payments
  labels:
    pod-security.kubernetes.io/enforce: restricted
    pod-security.kubernetes.io/enforce-version: latest
    pod-security.kubernetes.io/warn: restricted
    pod-security.kubernetes.io/audit: restricted

Start with warn and audit to find violations, then switch on enforce. Keep privileged only for system namespaces that need it, such as CNI or storage drivers. For rules beyond the standards (allowed registries, required labels), use ValidatingAdmissionPolicy, which is built into Kubernetes, or a policy engine such as Kyverno or OPA Gatekeeper.

8. Restrict network paths

By default every Pod can talk to every other Pod and often to the node and cloud metadata endpoints. NetworkPolicy changes that, but only if your CNI plugin enforces it (Calico and Cilium do, for example).

apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
  name: default-deny
  namespace: payments
spec:
  podSelector: {}
  policyTypes:
    - Ingress
    - Egress

After a default deny, add policies that allow only the traffic each workload needs, including DNS egress to CoreDNS. Block Pod access to the cloud instance metadata service unless a workload needs it, and use workload identity features for cloud credentials. At the infrastructure level, keep control plane and node ports off the internet. 10 Kubernetes network policies every engineer must know has ready-made examples.

9. Stay on a supported Kubernetes version

The Kubernetes project maintains release branches for the three most recent minor releases, and each minor release gets roughly 14 months of patch support. Running an unsupported version means security fixes stop arriving.

  • Plan minor upgrades on a regular schedule rather than in emergencies.
  • Upgrade the control plane first, then nodes, respecting the documented version skew between components.
  • Patch the node operating system and container runtime as well as Kubernetes.
  • Subscribe to the Kubernetes security announcements list and your provider's security bulletins.

Managed services publish their own version calendars and release channels, which may differ from upstream dates.

10. Benchmark against CIS and monitor continuously

The CIS Kubernetes Benchmark from the Center for Internet Security turns most of the steps above into checkable items: API server flags, file permissions on manifests and certificates, etcd settings, kubelet configuration and policies. CIS also publishes provider-specific benchmarks for EKS, GKE and AKS.

kube-bench, an open source tool from Aqua Security, runs the CIS checks on your nodes:

kubectl apply -f https://raw.githubusercontent.com/aquasecurity/kube-bench/main/job.yaml
kubectl logs job/kube-bench

Run scans after every upgrade and on a schedule, not once. Combine them with alerts from audit logs and with runtime detection (for example Falco, a CNCF graduated project) so you notice when someone changes a setting you already hardened.

Self-managed vs managed: who does what

AreaSelf-managed (kubeadm and similar)Managed (EKS, GKE, AKS)
API server flagsYou set them in static Pod manifestsProvider sets most; you choose endpoint access
etcdYou secure, back up and restore itProvider operates it
Secrets encryptionYou write EncryptionConfigurationYou enable envelope encryption with your KMS key
Audit logsYou write policy and ship logsYou enable the log type and route it
Kubelet and node OSYou configure and patchShared; you patch or replace node images
RBAC, Pod Security, NetworkPolicyYouYou

Learn cluster hardening hands-on

Every step in this checklist, from API server flags to audit policies and Pod Security Admission, maps to topics in the CKS exam. Our CKS training in Pune works through them on real clusters, in the Kharadi classroom or live online across India. If you are earlier in the journey, start with CKA training.

Frequently asked questions

Are Kubernetes Secrets encrypted by default?

No. Secret data is base64-encoded in etcd unless you configure encryption at rest with an EncryptionConfiguration. A KMS v2 provider is preferred because the key stays outside the cluster.

What replaced PodSecurityPolicy?

PodSecurityPolicy was removed in Kubernetes 1.25. The built-in replacement is Pod Security Admission, which enforces the Pod Security Standards per namespace. Policy engines such as Kyverno or OPA Gatekeeper cover custom rules.

How do I enable Kubernetes audit logging?

Give the API server an audit policy with --audit-policy-file and a backend such as --audit-log-path or a webhook. On managed services, enable control plane audit logs through the provider instead.

Why is the kubelet a security risk?

The kubelet API can run commands in containers and read logs. If anonymous authentication is enabled or authorization is set to AlwaysAllow, anyone who can reach port 10250 on a node can use it.

What is the CIS Kubernetes Benchmark?

It is a set of configuration checks published by the Center for Internet Security for the control plane, etcd, nodes and policies. Tools such as kube-bench automate the checks.

Do these steps apply to EKS, GKE and AKS?

Yes, but the provider runs the control plane and etcd. You still own RBAC, Pod Security, NetworkPolicy and node configuration, and you enable options such as private endpoints, Secrets encryption and audit logs.

How often should I upgrade Kubernetes?

Often enough to stay within the three supported minor releases. Each minor release gets about 14 months of patches, so most teams plan at least one or two minor upgrades a year.

References

What's Your Reaction?

Like Like 1
Dislike Dislike 0
Love Love 0
Funny Funny 0
Angry Angry 0
Sad Sad 0
Wow Wow 0
Mridul I am a passionate technology enthusiast with a strong focus on DevOps, Cloud Computing, and Cybersecurity. Through my blogs at DevOps Training Institute, I aim to simplify complex concepts and share practical insights for learners and professionals. My goal is to empower readers with knowledge, hands-on tips, and industry best practices to stay ahead in the ever-evolving world of DevOps.