LESSON 62 · ADVANCED4 min read

Project: Harden a Cloud Container Deployment

Review a small containerized cloud deployment across identity, network, image, secrets, logging, and recovery, then deliver a hardening plan.

OWASP Top 10 · MITRE ATT&CK · NIST CSF 2.0Free to readModule 12 of 14
YOUR NEXT SMALL WINS

By the end, you’ll be able to…

  • Map a cloud deployment's identities, data flows, and trust boundaries.
  • Assess container and Kubernetes configuration against a hardening baseline.
  • Prioritise cloud findings by exposure, exploitability, and business impact.
  • Produce a verification plan for every recommended change.

01Scope the Deployment Like an Attacker

Start with a diagram. Show the public entry point, the load balancer, the application pods, the database, the container registry, the CI/CD pipeline, the secret store, and the logging destination. Mark which identities can access each component. Then ask the attacker's question: if I compromise the application, what can I reach next? If the answer is the cloud account, the registry, or every other tenant's data, the architecture needs work.

Inventory the identities: human administrators, CI/CD roles, workload identities, service accounts, and emergency accounts. For each, record what it can do and how its credentials are obtained. Look for long-lived keys, wildcard policies, shared service accounts, and identities that can modify logging or backups. These are often more valuable to an attacker than a software bug.

Map the data. What enters, what leaves, where is it stored, and how long is it retained? Identify personal data, credentials, and business-critical records. Check encryption in transit and at rest, backup isolation, and deletion behaviour. A deployment diagram without data flows is only half a model.

02Review the Container and Cluster

Inspect the image build: base image, pinned versions, user, included tools, secrets, and scanning results. Inspect the runtime: non-root user, read-only filesystem, dropped capabilities, resource limits, and whether the service account token is mounted. Inspect the cluster: RBAC bindings, admission policies, network policies, secret encryption, and audit logging.

Look for common high-impact mistakes: privileged containers, hostPath mounts, host networking, the Docker socket, cluster-admin bindings, secrets in environment variables visible to every process, and public registries with mutable tags. A mutable tag such as latest means the artifact you tested may not be the artifact you deploy. Pin by digest or immutable version.

Review the cloud layer around the cluster: public storage, permissive security groups, exposed management endpoints, disabled audit logs, and overprivileged node roles. A hardened pod on a compromised node is still compromised. Security has to hold at every layer.

cluster-review.shShell
# Who can do what in the cluster?kubectl get clusterrolebindings -o widekubectl get rolebindings -A -o widekubectl get serviceaccounts -A# Are workloads running with risky settings?kubectl get pods -A -o json | jq -r '  .items[] |  [.metadata.namespace, .metadata.name,   (.spec.hostNetwork // false),   (.spec.hostPID // false),   (.spec.containers[].securityContext.privileged // false)] | @tsv'# Network policy coverage.kubectl get networkpolicies -A# Audit and secret configuration are provider-specific; record the evidence.kubectl get secrets -A --no-headers | wc -l
Outputstdout
namespace   pod          hostNetwork  hostPID  privileged
shop        api-7c9f     false        false    false
shop        debug-2a1    false        false    true
No network policies found in namespace shop.

03Prioritise and Plan

Not every finding deserves the same urgency. Rank by exposure, exploitability, privilege gained, and business impact. A public workload with a privileged container and a mounted cloud identity is critical. A missing resource limit on an internal batch job may be a medium availability finding. A mutable image tag is a supply-chain integrity risk that becomes critical if the registry is writable by a broad group.

Build a remediation sequence that reduces the most risk with the least disruption. Immediate actions might include removing a privileged workload, revoking a long-lived key, restricting a public bucket, and enabling audit logging. Thirty-day actions might include network policies, image pinning, and admission controls. Ninety-day actions might include workload identity migration, automated policy checks, and restore testing.

For each action, define verification. A policy is not fixed because a ticket says so. Prove it with a command, a test, or a configuration check. Record the before and after evidence. If an exception is necessary, document the risk, the compensating control, the owner, and the expiry date.

04Project Brief: The Hardening Review

Use a local Kubernetes cluster or a cloud free tier with synthetic data. Do not expose an intentionally vulnerable workload to the internet. Review at least twelve controls across identity, network, image, secrets, logging, and recovery. Include at least three high-impact findings and one positive observation.

Produce an architecture diagram, an identity inventory, a findings table, detailed findings, and a 30/60/90-day plan. Include the exact commands and configuration snippets that produced the evidence. Redact account IDs, secrets, and personal data.

Finish with a verification matrix: finding, fix, test, expected result, and evidence captured. The project is complete when another engineer can reproduce the review, understand the risk, and prove that each recommended change works.

cloud-hardening-matrix.txtPlain text
FINDING                     FIX                         VERIFYPrivileged debug pod        remove, enforce admission    kubectl get pods shows no privilegedPublic storage bucket       block public access         policy status private; unauthenticated GET failsWildcard CI role            scope to deployment role    simulate policy; denied on unrelated actionsMutable image tag           pin by digest               deployment uses sha256 digestNo network policy           default deny + allowlist    unauthorized pod connection failsAudit log disabled          enable org trail            test event appears in central logBackup not tested           restore into isolated env   data checksum matches; time recorded
LET IT CLICK

The ideas worth keeping.

  • Cloud container security spans identity, network, image, runtime, secrets, logging, and recovery.
  • Map blast radius: what can a compromised workload reach next?
  • Pin images, enforce admission policies, and constrain workload identities.
  • Every hardening action needs a verification step and an owner.
TURN UNDERSTANDING INTO SOMETHING YOU CAN DO

Make it yours.

Type and test your code right here in the interactive workspace. Run your solution, check the output, and compare with the worked guide when ready.

01

Exercise 1: Assess blast radius

An application pod is compromised. It runs as root, mounts the Docker socket, and has a cloud workload identity that can read all S3 buckets. Describe the attacker's likely next steps and three changes that would reduce blast radius.

Explore a worked solution
one_possible_solution.mdCybersecurity
The attacker could use the Docker socket to control the host runtime, inspect other containers, and potentially escape to the node. The cloud identity could read every bucket, exposing all tenant data. The root user increases the impact of local privilege escalation. Changes: run as non-root with a read-only filesystem and dropped capabilities; remove the Docker socket mount and enforce admission policy; scope the workload identity to the specific bucket and prefix it needs. Also add network policies and detect unexpected cloud API calls.

Blast radius is the combination of local privilege, host access, and cloud identity. Each layer must be constrained separately.

02

Exercise 2: Write a verification step

You recommend pinning a container image by digest. Write a verification command and explain what it proves.

Explore a worked solution
one_possible_solution.mdCybersecurity
kubectl get deployment api -o jsonpath='{.spec.template.spec.containers[0].image}' should return an image reference ending in @sha256:<digest>. This proves the deployment references an immutable content digest rather than a mutable tag. It does not prove the image is vulnerability-free or that the digest came from your trusted build; pair it with signature and provenance verification.

Verification should prove the specific property you changed. Image digest pinning proves immutability, not trustworthiness.

A SMALL QUESTION. A USEFUL NEXT STEP.

What stayed with you?

Check the ideas while they’re fresh. Your answers stay in this page and feedback appears as you go.

A LITTLE ACTIVE RECALL0 / 4 answered
01What is the first step in a cloud container hardening review?
02Why is a mutable image tag a supply-chain risk?
03What should a verification step prove?
04Which is the highest-risk configuration?

Keep exploring.

The official references behind this lesson, when you want a second angle or the full details.

MODULE 12 · PRACTICAL SELF-CHECK

Pause. Put the pieces together.

You’ve reached the end of Cloud, Containers, and DevSecOps. Before moving on, use this task to check what you can do independently.

Complete a cloud attack-and-defense review with at least three high-impact findings, an incident-response plan, and a verification matrix.

Try it in your own environment and write down the result. This is a self-check; reading completion does not evaluate your code.

Review this module

One lesson closer.

Reading is a start. Trying it yourself makes the connection.

Completion is saved in this browser. It records reading and hands-on practice progress.