12 Cloud Native Security Best Practices by Phase

12 cloud native security practices organized by the CNCF lifecycle: develop, distribute, deploy and runtime, with examples, owners and a 90-day plan.

Dec 25, 2025 - 12:27
Nov 6, 2026 - 17:55
 0  66
12 Cloud Native Security Best Practices by Phase

Cloud native security works best when controls are placed at each stage of the application lifecycle: secure code and dependencies while developing, scan, sign and record what you ship while distributing, enforce policy and identity at deploy time, and restrict, watch and patch workloads at runtime. The 12 practices below follow those four stages, as defined by the CNCF and the Kubernetes documentation.

Many security checklists jump straight to cluster settings. This guide is organized around the lifecycle instead, so you can see which team owns each control and where gaps usually hide. It complements two other posts: 12 Kubernetes security best practices goes deep on cluster configuration, and 10 cloud-native security mistakes to avoid covers what goes wrong. Product names, commands and project statuses here were checked against official documentation in November 2026.

Key takeaways

  • The CNCF cloud native security whitepaper and the Kubernetes docs describe four lifecycle phases: develop, distribute, deploy and runtime. Each needs its own controls.
  • Most risk enters early, through vulnerable dependencies, leaked secrets and unverified images, so scanning and signing in the pipeline pays off more than runtime tooling alone.
  • Admission control is the gate between "built" and "running". Use it to verify signatures and enforce Pod Security Standards.
  • Replace long-lived cloud keys with workload identity, and give every service account the least privilege it needs.
  • Kubernetes does not encrypt Secrets at rest by default. Turn encryption on, ideally with a KMS provider.
  • Runtime detection, audit logs and fast patching cover what prevention misses.

The 12 practices by lifecycle phase

Phase#PracticeTypical owner
Develop1Threat model services and trust boundariesDev team with security
Develop2Scan code, dependencies and IaC in every pull requestDev team / platform
Develop3Keep secrets out of code and repositoriesDev team
Distribute4Build minimal, pinned and scanned imagesPlatform / dev team
Distribute5Generate an SBOM for every buildPlatform
Distribute6Sign images and record build provenancePlatform
Deploy7Enforce policy at admissionPlatform / security
Deploy8Use workload identity instead of static keysPlatform / cloud team
Deploy9Apply least-privilege RBACPlatform
Runtime10Default-deny network traffic and encrypt it in transitPlatform / network
Runtime11Detect threats and keep audit logsSecurity operations
Runtime12Encrypt data at rest and patch continuouslyPlatform / ops

Develop phase

The Kubernetes cloud native security page lists zero trust design, security-focused code review, threat modelling and security automation such as fuzzing for this phase. In practice, three habits matter most.

1. Threat model services and trust boundaries

Before writing code for a new service, sketch its data flows and ask where an attacker could enter, what they could reach, and what would happen if a dependency were compromised. A short session using a method such as STRIDE, repeated when the design changes, is enough for most services. The output is a list of controls you need later: which endpoints require authentication, which data must be encrypted, which services may talk to each other. That list feeds practices 7 to 10.

2. Scan code, dependencies and IaC in every pull request

Run three kinds of checks on each pull request:

  • Static analysis (SAST) for insecure code patterns.
  • Dependency scanning (SCA) for known vulnerabilities in open source libraries.
  • Infrastructure as code scanning for risky Terraform, Kubernetes or Helm settings, such as public storage buckets or privileged containers.

Open source tools such as Trivy and Checkov cover the IaC and dependency side. Block merges only on high-severity findings at first, then tighten the rules as noise drops. More pipeline controls are listed in 15 CI/CD pipeline security practices.

# Scan a repository's IaC and dependency files with Trivy
trivy fs --scanners vuln,misconfig,secret --severity HIGH,CRITICAL .

3. Keep secrets out of code and repositories

API keys and passwords committed to Git stay in history even after deletion. Add secret scanning as a pre-commit hook and in CI, turn on your Git host's push protection if it has one, and load secrets at runtime from a secret manager (HashiCorp Vault or your cloud provider's service) rather than from files in the repository. If a secret is ever committed, treat it as exposed: rotate it first, then clean the history.

Distribute phase

This phase covers everything between a successful build and a deployable artifact: the image, its contents, and proof of where it came from.

4. Build minimal, pinned and scanned images

Smaller images have fewer packages to patch. Use minimal or distroless base images, multi-stage builds that leave compilers behind, and a non-root user. Pin base images by digest so a rebuild does not silently pull different content. Scan the final image in CI, and scan stored images again on a schedule, because new vulnerabilities are published after you build. Tools for this are compared in 12 container security tools.

FROM golang:1.24 AS build
WORKDIR /src
COPY . .
RUN CGO_ENABLED=0 go build -o /out/app ./cmd/app

FROM gcr.io/distroless/static-debian12:nonroot
COPY --from=build /out/app /app
USER nonroot
ENTRYPOINT ["/app"]

5. Generate an SBOM for every build

A software bill of materials lists every component in an artifact. When the next widely exploited library vulnerability is announced, an SBOM lets you answer "are we affected, and where?" in minutes instead of days. SPDX (published as ISO/IEC 5962:2021) and CycloneDX are the two common formats. Generate the SBOM in the pipeline, store it next to the image in the registry, and index it so you can search across services.

# Produce a CycloneDX SBOM for an image with Trivy
trivy image --format cyclonedx --output sbom.cdx.json registry.example.com/checkout:2.4.1

6. Sign images and record build provenance

Signing proves an image came from your pipeline and was not altered. Sigstore's cosign supports keyless signing, where the pipeline authenticates through an OIDC identity and no long-lived signing key has to be stored. Provenance records how the artifact was built. The SLSA framework defines build levels: L1 means provenance exists, L2 means a hosted build platform generates and signs it, and L3 means the build platform is hardened against tampering during the build. Aim for L2 first; most hosted CI systems can reach it.

# Keyless signing in CI (authenticates through the CI system's OIDC identity)
cosign sign registry.example.com/checkout@sha256:<digest>

Deploy phase

The deploy phase decides what may run, who may run it, and where. The Kubernetes docs call out verifying image identity cryptographically and isolating workloads with namespaces.

7. Enforce policy at admission

Admission controllers check every object before the API server stores it. Use them for three jobs:

  • Pod Security Admission, built into Kubernetes, enforces the Privileged, Baseline or Restricted Pod Security Standard per namespace through labels.
  • Signature verification rejects images that were not signed by your pipeline.
  • Custom policy as code with a policy engine such as OPA Gatekeeper or Kyverno, for rules like "images only from our registry" or "every Deployment has resource limits".
apiVersion: v1
kind: Namespace
metadata:
  name: checkout
  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

Roll out new policies in warn or audit mode first, fix the violations they report, then switch to enforce. Tools that automate this are reviewed in 12 tools to automate cloud security policies.

8. Use workload identity instead of static keys

Cloud access keys stored in Kubernetes Secrets or environment variables are a common source of breaches, because they work from anywhere if leaked. The major clouds let a Kubernetes service account receive short-lived cloud credentials instead: EKS Pod Identity and IAM roles for service accounts on AWS, Workload Identity Federation for GKE on Google Cloud, and Microsoft Entra Workload ID on Azure. Each workload gets its own identity with only the permissions it needs, and nothing long-lived sits in the cluster.

9. Apply least-privilege RBAC

Give people and service accounts the narrowest Role that works, bound in a single namespace where possible. Avoid cluster-admin bindings for humans in day-to-day work, avoid wildcard verbs and resources, and turn off automatic service account token mounting for Pods that never call the API.

apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
  name: config-reader
  namespace: checkout
rules:
  - apiGroups: [""]
    resources: ["configmaps"]
    verbs: ["get", "list", "watch"]
# Check what a service account can do
kubectl auth can-i --list --as=system:serviceaccount:checkout:checkout-api -n checkout

Zero trust identity tools beyond Kubernetes RBAC are covered in 14 zero trust security tools for DevOps.

Runtime phase

The Kubernetes docs split runtime protection into access (securing the API), compute (Pod Security, isolation, seccomp and AppArmor, quotas) and storage. These last three practices cover the gaps that prevention leaves.

10. Default-deny network traffic and encrypt it in transit

By default, every Pod can reach every other Pod. Start each namespace with a default-deny NetworkPolicy, then allow only the flows your threat model needs. NetworkPolicies need a CNI plugin that enforces them. For encryption and identity between services, a service mesh can provide mutual TLS without changing application code. Our guide to Kubernetes network policies has ready-to-use examples.

apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
  name: default-deny
  namespace: checkout
spec:
  podSelector: {}
  policyTypes: ["Ingress", "Egress"]

11. Detect threats and keep audit logs

Prevention fails eventually, so watch what workloads actually do. Falco, a CNCF graduated project since February 2024, detects suspicious runtime behaviour such as a shell starting in a container or unexpected writes to system paths. Turn on Kubernetes API audit logging so you can answer who changed what and when, and send cloud provider audit trails to the same central store. Write alert rules for high-value events: new cluster-admin bindings, exec into production Pods, and changes to admission webhooks.

12. Encrypt data at rest and patch continuously

The Kubernetes documentation states that by default the API server stores resources in etcd as plain text. Enable encryption at rest with an EncryptionConfiguration file passed through --encryption-provider-config, preferably with a KMS provider so the keys live outside the cluster. Managed Kubernetes services usually offer this as a setting. Then keep everything current: node operating systems, the Kubernetes version (each minor release gets about one year of patch support), add-ons, and the base images from practice 4. Rebuild and redeploy images on a schedule even when your code has not changed, so OS package fixes reach production.

A 90-day rollout plan

WeeksFocusPractices
1 to 4Stop the most common leaks3 (secret scanning), 9 (RBAC review), 12 (encryption at rest)
5 to 8Secure the pipeline2 (PR scanning), 4 (image hardening), 5 (SBOMs)
9 to 12Gate and watch production6 and 7 (signing and admission in warn mode), 10 (default deny), 11 (runtime detection)
OngoingDesign and identity1 (threat modelling for new services), 8 (move workloads to workload identity)

Build these skills

Pipeline security, image signing and policy as code are part of our DevSecOps training, and cluster hardening, admission control and runtime detection map to the CKS training. Both run in our Kharadi, Pune classroom and live online. For a tool-by-tool view, see cloud-native security tools for Kubernetes protection.

FAQ

What are the four phases of cloud native security?

Develop, distribute, deploy and runtime. The CNCF cloud native security whitepaper and the Kubernetes documentation use these phases to group controls, from secure coding through image signing, admission policy and runtime protection.

Where should a team start with cloud native security?

Start with the controls that stop common leaks: secret scanning, an RBAC review, and encryption at rest for Secrets. Then add pull request scanning and image hardening, and finally admission policies and runtime detection.

Are Kubernetes Secrets encrypted by default?

No. The Kubernetes documentation states that the API server stores resources in etcd as plain text by default. Enable encryption at rest, ideally with a KMS provider, or use the managed setting your cloud provider offers.

Why sign container images?

Signing proves an image was built by your pipeline and not altered. An admission policy can then refuse unsigned images. Sigstore cosign supports keyless signing using the CI system's OIDC identity.

What is an SBOM and why does it matter?

A software bill of materials lists every component in an artifact. When a new vulnerability is announced, SBOMs let you find affected services quickly. SPDX and CycloneDX are the common formats.

What is workload identity?

It lets a Kubernetes service account get short-lived cloud credentials instead of using stored access keys. Examples include EKS Pod Identity on AWS, Workload Identity Federation for GKE, and Microsoft Entra Workload ID on Azure.

Do I need a service mesh for cloud native security?

Not always. NetworkPolicies handle which Pods may talk to each other. A service mesh adds mutual TLS and service identity, which helps when you need encryption and strong identity between services.

Which tool detects attacks inside running containers?

Falco, a CNCF graduated project, detects suspicious runtime behaviour such as unexpected shells or file writes. Pair it with Kubernetes audit logs and cloud audit trails for full coverage.

References

What's Your Reaction?

Like Like 0
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.