BERRY9 IT Services, home

Kubernetes and Container Security Testing: What It Covers

Many SaaS and enterprise teams in Hyderabad now run their products on Kubernetes. A cloud account review shows who can do what in AWS, Azure or Google Cloud. It does not show what an attacker can do from a compromised container inside a cluster. A Kubernetes test follows that path.

Cloud · By Thimmagurudu Bathini · Published · 3 min read

What Is in Scope

Layers of a Kubernetes test
LayerWhat a tester checks
Cluster accessWho can reach the API server and from where, how users sign in, and what each role may do (RBAC).
WorkloadsPrivileged containers, host mounts, containers running as root, the settings of each pod.
SecretsWhere secrets are stored, who can read them, and whether they appear in images, logs or environment variables.
NetworkWhether pods can talk to every other pod and to the nodes, and what reaches the internet.
Images and pipelineWhere images come from, what they contain, and who can push to the registry or change the deployment pipeline.
Cloud layerThe cloud permissions given to pods and nodes, and access to the instance metadata service.

The Starting Position

Tests usually begin from one of two places: an attacker who has remote code execution in one container of an application, or a developer account with limited access. The tester asks what that position can reach next.

A Worked Example

From a shell in an application container, the tester checks what the pod's service account may do:

$ kubectl auth can-i --list
Resources                          Non-Resource URLs   Resource Names   Verbs
*.*                                []                  []               [*]

The account can do anything in the cluster. An application pod has been given cluster-admin, a common shortcut taken during a migration. With it, the tester can read secrets from every namespace and start a new pod on any node. The report shows the command, the role binding that grants this and the fix: a role with only the verbs and resources the application needs, in its own namespace.

What Testers Commonly Find

  • Service accounts with far more rights than the workload needs, and tokens mounted into pods that never call the API.
  • Privileged pods, hostPath mounts and access to the container runtime socket, which can give control of the whole node.
  • Secrets stored as plain environment variables or committed to deployment files.
  • No network policies, so any pod can reach every other pod, the database and the metadata service.
  • The dashboard, the kubelet or the API server reachable from the internet.
  • Images pulled from public registries with no pinning or scanning.

How to Check Your Own Cluster

  • List the cluster role bindings and look for subjects that are not people you recognize: kubectl get clusterrolebindings -o wide.
  • From inside a pod, run kubectl auth can-i --list with the pod's own account.
  • List pods that run privileged or with a host path, and ask why each one needs it.
  • Check whether a default-deny network policy exists in each namespace.
  • Find out how the cloud account gives rights to pods, and whether pods can reach the metadata address.

What a Fix Looks Like

apiVersion: v1
kind: ServiceAccount
metadata: { name: orders-api }
automountServiceAccountToken: false     # most pods never call the API

---
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata: { name: default-deny, namespace: orders }
spec:
  podSelector: {}
  policyTypes: [Ingress, Egress]       # then allow only the flows you need

Apply the Pod Security Standards at the restricted level to namespaces that can take it, keep roles narrow, store secrets in a dedicated secrets manager or encrypt them at rest, scan and sign images, and give pods their cloud permissions one role per workload. Test in a staging cluster first, because tightening network rules can break traffic nobody wrote down.

A Kubernetes test is scoped with a cloud security assessment, so that the account and the cluster are tested together. See also SSRF and cloud metadata.

To plan a test for your own systems, request a scoping call, or download the pre-test checklist and scoping questionnaire.

Sources

Links checked on 5 November 2026.

Next Step

To see what an attacker could reach in your own cloud accounts and clusters, see cloud security assessment. To get your scope ready first, use the pre-test checklist and scoping questionnaire.

Written by Thimmagurudu Bathini, BERRY9 IT SERVICES PRIVATE LIMITED, Hyderabad. Questions about your own systems? Request a scoping call or call +91 86868 92922.

Plan Your Next Security Test

Tell us what needs Penetration Testing and when you need it done, and we will propose a scope and timeline. We respond within 24 hours. If you would rather talk first, call or write to us.