Lab 06 — Runtime Security
In the previous Kubernetes labs, you built several preventive security layers:
Lab 01 — Kubernetes Fundamentals ↓Understand Resources
Lab 02 — Kubernetes RBAC ↓Control Identity and Permissions
Lab 03 — Kyverno ↓Enforce Kubernetes-Native Policy
Lab 04 — Network Policies ↓Control Communication
Lab 05 — OPA Gatekeeper ↓Enforce Admission GuardrailsThese controls help prevent insecure configurations from reaching production.
But there is another critical question:
What happens afterthe container starts running?A workload can be securely configured and still become compromised through:
Application Vulnerability
Stolen Credentials
Malicious Dependency
Compromised Image
Insider Activity
Runtime ExploitationThis is where runtime security becomes essential.
Mission Information
Section titled “Mission Information”Difficulty: Intermediate to Advanced
Estimated Time: 90–120 minutes
Primary Skills:
Kubernetes Runtime Security
Container Behavior Monitoring
Process Monitoring
Runtime Detection
Falco Concepts
Security Alert Triage
Threat Investigation
Evidence Collection
Containment
Incident ResponseLab Scenario
Section titled “Lab Scenario”Your organization operates several production Kubernetes clusters.
Preventive controls are already implemented:
RBAC
NetworkPolicy
Admission Policies
Image Controls
Workload Security StandardsDuring monitoring, the security team receives an alert indicating that an unexpected shell was started inside an application container.
The application normally runs only:
Web Server Processbut runtime telemetry shows:
/bin/shexecuting inside the container.
Your mission is to investigate the activity and determine:
What Happened?
Which Workload Was Affected?
Which Process Executed?
Who Initiated It?
What Identity Does the Pod Use?
What Could the Workload Access?
Was There Additional Suspicious Activity?
How Should the Incident Be Contained?Lab Objectives
Section titled “Lab Objectives”By the end of this lab, you should be able to:
- Explain Kubernetes runtime security
- Understand preventive vs detective controls
- Establish normal workload behavior
- Identify unexpected process execution
- Understand Falco runtime detection concepts
- Review runtime security events
- Investigate unexpected shell activity
- Investigate suspicious file access
- Investigate unexpected outbound connections
- Correlate runtime activity with Kubernetes context
- Review service-account exposure
- Evaluate workload privileges
- Determine potential blast radius
- Collect incident evidence
- Contain suspicious workloads
- Document runtime-security findings
- Build a Kubernetes runtime investigation workflow
Part 01 — Preventive vs Detective Security
Section titled “Part 01 — Preventive vs Detective Security”Preventive controls attempt to stop insecure activity before it occurs.
Examples:
RBAC ↓Restrict API Permissions
Kyverno / Gatekeeper ↓Block Insecure Configuration
NetworkPolicy ↓Restrict CommunicationRuntime security provides another layer:
Workload Running ↓Observe Behavior ↓Detect Suspicious Activity ↓Investigate ↓RespondSecurity Model
Section titled “Security Model”PREVENT +DETECT +RESPONDA mature Kubernetes security architecture needs all three.
Part 02 — Why Runtime Security Matters
Section titled “Part 02 — Why Runtime Security Matters”Imagine a correctly configured application:
Non-Privileged
Non-Root
Resource Limits
Approved Image
Restricted Network AccessThe application itself contains a vulnerability.
An attacker exploits it.
Internet ↓Application ↓Application Vulnerability ↓Container CompromiseAdmission policy cannot stop an exploit occurring after deployment.
Runtime monitoring may detect the attacker’s behavior.
Example Runtime Sequence
Section titled “Example Runtime Sequence”Normal Application ↓Application Exploited ↓Unexpected Shell ↓Discovery Commands ↓Credential Access ↓Network Connection ↓Lateral Movement AttemptEach step can generate observable signals.
Part 03 — Runtime Security Questions
Section titled “Part 03 — Runtime Security Questions”When monitoring Kubernetes workloads, ask:
Which Processes Are Running?
Which Files Are Being Accessed?
Which Network Connections Are Created?
Which Commands Are Executed?
Which User Is Executing Them?
Which Container Is Involved?
Which Pod?
Which Namespace?
Which Service Account?
Which Node?Context turns:
Suspicious Processinto:
Actionable Security IncidentPart 04 — Runtime Security Architecture
Section titled “Part 04 — Runtime Security Architecture”A simplified architecture is:
Kubernetes Workloads ↓Runtime Activity ↓Runtime Security Sensor ↓Detection Rules ↓Security Events ↓Alert Pipeline ↓SOC / SIEM ↓InvestigationPart 05 — Runtime Signals
Section titled “Part 05 — Runtime Signals”Important signals include:
Process Execution
File Access
Network Connections
Container Activity
Privilege Changes
Namespace Activity
System Calls
Kubernetes API ActivityDifferent runtime-security platforms collect these signals differently.
Part 06 — Understand Falco
Section titled “Part 06 — Understand Falco”Falco is commonly used in cloud-native environments for runtime threat detection.
Conceptually:
Runtime Activity ↓Falco ↓Detection Rules ↓Security EventFalco rules can identify behavior such as:
Shell Started in Container
Sensitive File Access
Unexpected Process Execution
Package Management Activity
Suspicious Network Tools
Privilege-Related ActivityImportant
Section titled “Important”Falco is primarily:
Detectionrather than:
Admission PreventionCompare:
Gatekeeper ↓Should this workload be deployed?with:
Falco ↓What is this workload doing now?Part 07 — Lab Environment
Section titled “Part 07 — Lab Environment”Use only:
Your Own Kubernetes Cluster
Dedicated Training Environment
Explicitly Authorized LabYou need:
kubectl
Training Namespace
Runtime Security Visibility
Falco or Equivalent Lab Runtime SensorIf Falco is not installed, the investigation sections can still be performed using Kubernetes evidence and provided runtime-event scenarios.
Part 08 — Verify Kubernetes Context
Section titled “Part 08 — Verify Kubernetes Context”Run:
kubectl config current-contextThen:
kubectl cluster-infoRecord:
Cluster:
Context:
Environment:
Authorization:Always verify the target before conducting security testing.
Part 09 — Create the Training Namespace
Section titled “Part 09 — Create the Training Namespace”Create:
kubectl create namespace ghc-runtime-labSet your working namespace:
kubectl config set-context --current --namespace=ghc-runtime-labVerify:
kubectl config view --minifyPart 10 — Deploy the Training Application
Section titled “Part 10 — Deploy the Training Application”Create:
runtime-app.yamlAdd:
apiVersion: apps/v1kind: Deploymentmetadata: name: runtime-app namespace: ghc-runtime-labspec: replicas: 1 selector: matchLabels: app: runtime-app template: metadata: labels: app: runtime-app spec: containers: - name: web image: nginx ports: - containerPort: 80 resources: requests: cpu: "50m" memory: "32Mi" limits: cpu: "200m" memory: "128Mi"Apply:
kubectl apply -f runtime-app.yamlVerify:
kubectl get podsThen:
kubectl get deployment runtime-appPart 11 — Inspect the Workload
Section titled “Part 11 — Inspect the Workload”Run:
kubectl describe deployment runtime-appThen inspect the Pod:
kubectl get pods -l app=runtime-appRecord:
Pod Name:
Namespace:
Container:
Image:
Node:
Service Account:
Pod IP:
Restart Count:Why Context Matters
Section titled “Why Context Matters”A runtime alert stating:
Shell Executedis incomplete.
You need:
Shell Executed ↓Which Container? ↓Which Pod? ↓Which Namespace? ↓Which Application? ↓Which Identity?Part 12 — Establish the Normal Baseline
Section titled “Part 12 — Establish the Normal Baseline”Before detecting abnormal behavior, understand normal behavior.
For the training web application, expected activity may include:
Web Server Process
Normal Configuration Reads
Expected Log Writes
Expected Network ConnectionsUnexpected activity may include:
Interactive Shell
Package Installation
Credential Discovery
Network Scanning
Unexpected Downloads
Sensitive File ModificationBaseline Template
Section titled “Baseline Template”Application:runtime-app
Expected Primary Process:Web Server
Expected User:
Expected Network Destinations:
Expected Writable Locations:
Expected Child Processes:
Expected Administrative Activity:MinimalPart 13 — Process Baseline
Section titled “Part 13 — Process Baseline”Inspect running processes inside your own lab container:
kubectl exec <runtime-app-pod> -- psAvailable process tools depend on the image.
Record the expected process tree.
Conceptually:
Container ↓Main Application Process ↓Expected Worker ProcessesRuntime Principle
Section titled “Runtime Principle”You cannot reliably identify abnormal behavior unless you understand:
Normal BehaviorPart 14 — Review Container Logs
Section titled “Part 14 — Review Container Logs”Run:
kubectl logs <runtime-app-pod>If multiple containers exist:
kubectl logs <pod-name> -c <container-name>Record:
Normal Log Pattern
Normal Requests
Errors
Unexpected EventsPart 15 — Review Kubernetes Events
Section titled “Part 15 — Review Kubernetes Events”Run:
kubectl get events --sort-by=.metadata.creationTimestampEvents may reveal:
Scheduling
Image Pulls
Container Starts
Restarts
Probe Failures
Resource ProblemsEvents are useful context but should not be treated as a complete runtime security log.
Part 16 — Verify Falco Availability
Section titled “Part 16 — Verify Falco Availability”If Falco is installed in your lab environment, identify its namespace and workloads.
For example:
kubectl get pods -A | grep -i falcoThen inspect the appropriate namespace:
kubectl get pods -n <falco-namespace>What You Are Looking For
Section titled “What You Are Looking For”Runtime Sensor Healthy
Detection Components Running
Events Being GeneratedExact deployment architecture varies.
Do not assume fixed component names.
Part 17 — Understand Falco Rules
Section titled “Part 17 — Understand Falco Rules”A Falco-style detection rule conceptually contains:
Rule Name
Condition
Output
Priority
TagsExample logic:
IFShell Process Starts
ANDProcess Is Inside Container
THENGenerate AlertDetection Model
Section titled “Detection Model”Runtime Event ↓Condition Match ↓Alert ↓ContextPart 18 — Safe Shell Detection Exercise
Section titled “Part 18 — Safe Shell Detection Exercise”In your own isolated lab workload, deliberately open a shell:
kubectl exec -it <runtime-app-pod> -- /bin/shInside the container, perform only harmless inspection such as:
whoamiThen:
pwdThen exit:
exitSecurity Purpose
Section titled “Security Purpose”The goal is not exploitation.
You are generating a controlled runtime event:
Shell Started Inside Containerso you can observe and investigate it.
Part 19 — Why a Shell Can Be Suspicious
Section titled “Part 19 — Why a Shell Can Be Suspicious”Many production containers are designed to run:
One ApplicationThey do not normally require interactive shell activity.
Therefore:
Web Server Container ↓Interactive Shellcan be a valuable detection signal.
Important
Section titled “Important”A shell does not automatically prove compromise.
Legitimate reasons may include:
Administrator Troubleshooting
SRE Investigation
Approved MaintenanceTherefore the correct response is:
Detect ↓Validate ↓Investigate Contextnot:
Shell = AttackerPart 20 — Review Runtime Alert
Section titled “Part 20 — Review Runtime Alert”If your runtime sensor detects the event, capture:
Timestamp
Rule Name
Priority
Namespace
Pod
Container
Process
User
Parent Process
NodeAlert Triage Template
Section titled “Alert Triage Template”Alert:
Timestamp:
Severity:
Cluster:
Namespace:
Pod:
Container:
Process:
Parent Process:
User:
Node:
Initial Assessment:Part 21 — Correlate the Pod
Section titled “Part 21 — Correlate the Pod”Once the alert identifies a Pod:
kubectl get pod <pod-name> -o wideThen:
kubectl describe pod <pod-name>Record:
Node
Pod IP
Image
Service Account
Container State
Restart Count
LabelsInvestigation Question
Section titled “Investigation Question”Ask:
Is this the workloadwe expected the alert from?Part 22 — Review Pod Security Context
Section titled “Part 22 — Review Pod Security Context”Inspect:
kubectl get pod <pod-name> -o yamlReview:
securityContext
runAsUser
runAsNonRoot
privileged
allowPrivilegeEscalation
capabilities
readOnlyRootFilesystemSecurity Questions
Section titled “Security Questions”Is the Container Privileged?
Is It Running as Root?
Can It Escalate Privileges?
Does It Have Extra Capabilities?
Can It Modify Its Root Filesystem?Part 23 — Review Service Account
Section titled “Part 23 — Review Service Account”Identify:
kubectl get pod <pod-name> -o jsonpath='{.spec.serviceAccountName}'Then inspect the ServiceAccount:
kubectl get serviceaccount <service-account-name>Why This Matters
Section titled “Why This Matters”A compromised workload may attempt to use:
Workload Identityto interact with Kubernetes APIs.
Attack Path
Section titled “Attack Path”Application Compromise ↓Container Access ↓Service Account Credential ↓Kubernetes API ↓Authorized ActionsPart 24 — Review Effective Permissions
Section titled “Part 24 — Review Effective Permissions”Where authorized, use:
kubectl auth can-i --list --as=system:serviceaccount:ghc-runtime-lab:<service-account-name>Review the output carefully.
Ask:
Can It Read Secrets?
Can It Create Pods?
Can It Create Jobs?
Can It Modify Deployments?
Can It Access Other Namespaces?Security Principle
Section titled “Security Principle”Runtime compromise severity depends partly on:
Permissions AvailableAfter CompromisePart 25 — Blast Radius Analysis
Section titled “Part 25 — Blast Radius Analysis”Think:
Compromised Pod ↓Service Account ↓RBAC Permissions ↓Network Reachability ↓Secrets ↓Other WorkloadsThe investigation must evaluate all of these.
Blast Radius Template
Section titled “Blast Radius Template”Affected Pod:
Service Account:
RBAC Access:
Reachable Services:
Accessible Secrets:
Mounted Volumes:
Host Access:
Potential Impact:Part 26 — Review Mounted Volumes
Section titled “Part 26 — Review Mounted Volumes”Inspect:
kubectl describe pod <pod-name>Look for:
Volumes
Mounts
Secrets
ConfigMaps
Persistent Storage
HostPathWhy Volumes Matter
Section titled “Why Volumes Matter”A compromised container may gain access to:
Application Data
Configuration
Credentials
Shared Storagethrough mounted volumes.
Part 27 — Review Environment Configuration
Section titled “Part 27 — Review Environment Configuration”Inspect the workload specification.
Look for:
Environment Variables
Secret References
ConfigMap ReferencesDo not print or copy actual production secret values into investigation notes.
Record:
Secret Reference Existsrather than unnecessarily exposing the secret itself.
Part 28 — Sensitive File Access
Section titled “Part 28 — Sensitive File Access”Runtime tools can detect suspicious access to sensitive files.
Examples may include:
Credential Files
System Account Files
Service Account Credentials
Shell Configuration
Sensitive Application ConfigurationDetection Model
Section titled “Detection Model”Unexpected Process ↓Sensitive File Access ↓Runtime AlertInvestigation Question
Section titled “Investigation Question”Ask:
Does this applicationnormally access this file?Context determines severity.
Part 29 — Safe Sensitive-File Exercise
Section titled “Part 29 — Safe Sensitive-File Exercise”In your isolated training container, inspect a harmless system identity file:
kubectl exec <runtime-app-pod> -- cat /etc/passwdThis may trigger a runtime rule depending on your sensor configuration.
The purpose is to observe:
File Access Eventnot to obtain credentials.
Part 30 — Package Management Detection
Section titled “Part 30 — Package Management Detection”Production containers generally should not require software installation after deployment.
Unexpected package-manager execution can indicate:
Interactive Modification
Troubleshooting
Attacker Tool InstallationRuntime detection may monitor commands associated with package management.
Better Container Model
Section titled “Better Container Model”Build Required Software ↓Create Image ↓Scan ↓Deploy Immutable Imagerather than:
Deploy Container ↓Install Tools at RuntimePart 31 — Unexpected Network Tools
Section titled “Part 31 — Unexpected Network Tools”Security monitoring may flag unexpected use of diagnostic or network utilities inside application containers.
The key signal is not simply:
Tool Existsbut:
Application Does Not NormallyExecute This ToolBehavioral Security
Section titled “Behavioral Security”Expected Behavior ↓Baseline ↓Deviation ↓InvestigationPart 32 — Outbound Connection Investigation
Section titled “Part 32 — Outbound Connection Investigation”Suppose runtime monitoring reports:
Unexpected Outbound ConnectionInvestigate:
Source Pod
Source Process
Destination
Port
Protocol
TimestampInvestigation Flow
Section titled “Investigation Flow”Network Alert ↓Identify Pod ↓Identify Process ↓Identify Destination ↓Compare With Baseline ↓Determine LegitimacyPart 33 — NetworkPolicy Correlation
Section titled “Part 33 — NetworkPolicy Correlation”Review policies:
kubectl get networkpolicyThen:
kubectl describe networkpolicy <policy-name>Ask:
Should this workloadhave been able to makethat connection?Security Finding
Section titled “Security Finding”If unexpected outbound traffic was possible:
Runtime Detection ↓Reveals Egress Gap ↓NetworkPolicy ImprovementRuntime security can therefore improve preventive controls.
Part 34 — Unexpected Process Investigation
Section titled “Part 34 — Unexpected Process Investigation”Suppose an alert shows:
/bin/shfollowed by several unexpected processes.
Create a timeline:
10:14:02Application Request
10:14:05Shell Started
10:14:08System Discovery
10:14:15Sensitive File Access
10:14:30Unexpected Network ConnectionWhy Timelines Matter
Section titled “Why Timelines Matter”Individual alerts may appear unrelated.
A timeline reveals:
Attack SequencePart 35 — Runtime Investigation Timeline
Section titled “Part 35 — Runtime Investigation Timeline”Use:
Timestamp | Source | Event | Resource | AssessmentExample:
| Time | Source | Event | Assessment |
|---|---|---|---|
| 10:14:05 | Runtime | Shell started | Suspicious |
| 10:14:08 | Runtime | Unexpected process | Suspicious |
| 10:14:15 | Runtime | Sensitive file read | Investigate |
| 10:14:30 | Network | External connection | High priority |
Part 36 — Correlate Kubernetes Audit Activity
Section titled “Part 36 — Correlate Kubernetes Audit Activity”If Kubernetes audit logs are available in your lab, search around the runtime-event timestamp.
Look for actions such as:
pods/exec
Pod Creation
Secret Access
RoleBinding Changes
Deployment ChangesCritical Correlation
Section titled “Critical Correlation”A shell alert plus:
pods/execmay indicate an administrator intentionally opened the shell.
A shell alert without corresponding legitimate administrative activity may deserve greater investigation.
Part 37 — kubectl exec as Security Context
Section titled “Part 37 — kubectl exec as Security Context”When an administrator runs:
kubectl execthere are two important evidence sources:
Kubernetes API Activity +Container Runtime ActivityCorrelation helps answer:
Who Initiated the Shell?Part 38 — Alert Context Enrichment
Section titled “Part 38 — Alert Context Enrichment”A raw alert might say:
Shell in ContainerEnrich it with:
Cluster
Namespace
Application
Pod
Container Image
Node
Service Account
Owner
Environment
Network ExposureNow the alert becomes much more actionable.
Part 39 — Severity Assessment
Section titled “Part 39 — Severity Assessment”Consider:
Process Risk
Workload Exposure
Privileges
Identity Permissions
Data Sensitivity
Network Reachability
Evidence of Follow-On ActivityExample
Section titled “Example”Shell in Development Test Pod+No Sensitive Access+Known Administratormay have different severity from:
Shell in Internet-Facing Production Pod+Powerful Service Account+Secret Access+Unexpected External ConnectionPart 40 — Runtime Risk Matrix
Section titled “Part 40 — Runtime Risk Matrix”| Signal | Context | Potential Risk |
|---|---|---|
| Interactive shell | Web container | Medium–High |
| Privilege change | Restricted workload | High |
| Sensitive credential access | Unexpected process | High |
| Unknown outbound connection | Internet-facing workload | High |
| Package installation | Immutable production container | Medium–High |
| Unexpected process | Unknown parent | Investigate |
Severity should always be adjusted for environment context.
Part 41 — Container Restart Investigation
Section titled “Part 41 — Container Restart Investigation”Check:
kubectl get podsReview:
RESTARTSThen:
kubectl describe pod <pod-name>Look for:
Previous State
Exit Code
Reason
EventsUnexpected restarts may indicate:
Application Failure
Resource Exhaustion
Crash
Security ActivityThey are not automatically malicious.
Part 42 — Node Context
Section titled “Part 42 — Node Context”Determine which node hosts the affected Pod:
kubectl get pod <pod-name> -o wideWhy?
Because potential incident scope can include:
Container ↓Pod ↓Node ↓ClusterIf evidence suggests host-level impact, escalation becomes more urgent.
Part 43 — Container Escape Concept
Section titled “Part 43 — Container Escape Concept”A container escape occurs when activity breaks expected container isolation and gains access to underlying host resources.
Conceptually:
Container Compromise ↓Isolation Boundary Bypassed ↓Node AccessIndicators may include unusual:
Host File Access
Namespace Activity
Privilege Operations
Kernel Interaction
Host Process InteractionThis lab does not attempt a container escape.
The objective is to understand detection and response.
Part 44 — Privileged Workloads and Runtime Risk
Section titled “Part 44 — Privileged Workloads and Runtime Risk”A privileged container may dramatically increase potential incident impact.
Check:
privileged: trueIf present:
Runtime Alert +Privileged Workload ↓Higher Investigation PriorityPart 45 — HostPath Risk
Section titled “Part 45 — HostPath Risk”A workload with:
hostPathmay have access to host filesystem locations.
During investigation determine:
Which Host Path?
Read-Only or Writable?
Why Is It Required?
What Could an Attacker Access?Part 46 — Host Namespace Risk
Section titled “Part 46 — Host Namespace Risk”Review whether the workload uses:
hostNetwork
hostPID
hostIPCThese configurations can weaken isolation and increase blast radius.
Part 47 — Capabilities Review
Section titled “Part 47 — Capabilities Review”Containers can receive Linux capabilities.
Review the security context for added capabilities.
Ask:
Which Capabilities Are Added?
Does the Application Need Them?
Could They Increase Post-Compromise Impact?Better Model
Section titled “Better Model”Drop Unnecessary Capabilities ↓Add Only Explicitly Required CapabilitiesPart 48 — Read-Only Root Filesystem
Section titled “Part 48 — Read-Only Root Filesystem”A read-only root filesystem can make some runtime modifications harder.
Review:
readOnlyRootFilesystemThis does not prevent every attack.
It contributes to:
Defense in DepthPart 49 — Runtime Detection and Admission Policy
Section titled “Part 49 — Runtime Detection and Admission Policy”Suppose runtime investigations repeatedly identify:
Privileged WorkloadsYou should not rely only on detection.
Improve preventive policy:
Runtime Finding ↓Security Requirement ↓Kyverno / Gatekeeper ↓Prevent Future DeploymentSecurity Feedback Loop
Section titled “Security Feedback Loop”Detect ↓Investigate ↓Learn ↓PreventPart 50 — Runtime Detection and NetworkPolicy
Section titled “Part 50 — Runtime Detection and NetworkPolicy”Suppose investigations repeatedly show:
Unexpected External ConnectionsImprove:
Egress NetworkPolicywhere technically appropriate.
Feedback Loop
Section titled “Feedback Loop”Runtime Alert ↓Network Gap ↓Policy Improvement ↓Reduced Attack SurfacePart 51 — Runtime Detection and RBAC
Section titled “Part 51 — Runtime Detection and RBAC”Suppose a compromised workload uses its ServiceAccount to access unnecessary resources.
Remediation should include:
Reduce RBAC Permissionsnot only:
Delete Compromised PodRoot Cause Thinking
Section titled “Root Cause Thinking”Incident ↓What Allowed Impact? ↓Fix Supporting ControlPart 52 — Runtime Alert Triage Workflow
Section titled “Part 52 — Runtime Alert Triage Workflow”Use:
01 Receive Alert
02 Validate Alert
03 Identify Cluster
04 Identify Namespace
05 Identify Pod
06 Identify Container
07 Identify Process
08 Review Workload Baseline
09 Review Security Context
10 Review Service Account
11 Review RBAC
12 Review Network Reachability
13 Review Related Events
14 Determine Blast Radius
15 Assign SeverityPart 53 — False Positives
Section titled “Part 53 — False Positives”Runtime alerts require context.
Example:
Shell Startedmay result from:
Approved TroubleshootingTherefore verify:
Who?
Why?
When?
Approved?
Expected?Detection Engineering Principle
Section titled “Detection Engineering Principle”Avoid both extremes:
Alert = Incidentand:
Alert = IgnoreInstead:
Alert ↓Context ↓DecisionPart 54 — Alert Tuning
Section titled “Part 54 — Alert Tuning”If a rule repeatedly generates legitimate alerts, consider controlled tuning.
Do not simply disable useful detections.
Evaluate:
Rule Condition
Known Workloads
Namespaces
Process Names
Approved Administrative ActivityReduce:
Noisewithout creating:
Blind SpotsPart 55 — Runtime Rule Design
Section titled “Part 55 — Runtime Rule Design”A useful detection rule should answer:
What Behavior?
Why Suspicious?
Which Workloads?
What Severity?
What Context?
What Response?Detection Documentation Template
Section titled “Detection Documentation Template”Rule Name:
Behavior:
Data Source:
Condition:
Severity:
Expected False Positives:
Investigation Steps:
Response:Part 56 — Runtime Security Event Categories
Section titled “Part 56 — Runtime Security Event Categories”Build detection coverage across categories such as:
Execution
Persistence
Privilege
Credential Access
Discovery
Network Activity
Defense Evasion
Container Escape IndicatorsThis helps structure a runtime-detection program.
Part 57 — Execution Detection
Section titled “Part 57 — Execution Detection”Examples:
Unexpected Shell
Unexpected Binary
Interpreter Execution
Administrative Tool ExecutionAsk:
Does the application normallyexecute this process?Part 58 — Credential Access Detection
Section titled “Part 58 — Credential Access Detection”Monitor suspicious interaction with:
Service Account Credentials
Application Secrets
Cloud Credentials
Configuration FilesCritical Principle
Section titled “Critical Principle”Never include exposed secret values unnecessarily in incident reports.
Record:
Credential May Have Been Accessedand rotate it when appropriate.
Part 59 — Discovery Detection
Section titled “Part 59 — Discovery Detection”After compromise, attackers often try to understand the environment.
Runtime security may observe unexpected:
Process Discovery
Network Discovery
Identity Discovery
Filesystem InspectionThe important signal is deviation from normal application behavior.
Part 60 — Persistence Thinking
Section titled “Part 60 — Persistence Thinking”Containers are often ephemeral, but attackers may attempt persistence through Kubernetes resources.
Examples conceptually include unauthorized changes to:
Deployments
Jobs
CronJobs
DaemonSets
RBAC ObjectsRuntime telemetry alone may not reveal all of these.
Correlate with:
Kubernetes Audit LogsPart 61 — Defense Evasion
Section titled “Part 61 — Defense Evasion”Suspicious activity may attempt to:
Disable Monitoring
Delete Logs
Modify Security Agents
Alter PoliciesChanges affecting:
Falco
Logging
Admission Policies
NetworkPolicyshould receive strong scrutiny.
Part 62 — Evidence Collection
Section titled “Part 62 — Evidence Collection”For a runtime incident collect:
Alert
Timestamp
Pod Metadata
Deployment Manifest
Container Image
Container Logs
Kubernetes Events
Service Account
RBAC Information
NetworkPolicy
Runtime Events
Audit Logs
Relevant Node InformationEvidence Principle
Section titled “Evidence Principle”Preserve evidence before destructive remediation when feasible and consistent with incident severity.
Part 63 — Evidence Timeline
Section titled “Part 63 — Evidence Timeline”Create:
T1 — Initial Activity
T2 — Runtime Alert
T3 — Follow-On Process
T4 — Network Activity
T5 — Security Triage
T6 — Containment
T7 — RemediationPart 64 — Containment Strategy
Section titled “Part 64 — Containment Strategy”Once malicious activity is sufficiently validated, containment options may include:
Isolate Workload
Restrict Network Access
Revoke Credentials
Reduce Permissions
Remove Malicious Workload
Scale Down Affected Application
Quarantine NodeThe correct response depends on severity.
Important
Section titled “Important”Do not immediately destroy evidence without considering:
Incident Response Requirements
Forensic Requirements
Business AvailabilityPart 65 — Network Isolation
Section titled “Part 65 — Network Isolation”One containment option is restricting network communication.
Conceptually:
Compromised Pod ↓Emergency Network Isolation ↓No Unnecessary CommunicationThis may reduce:
Lateral Movement
Command-and-Control
ExfiltrationPart 66 — Credential Containment
Section titled “Part 66 — Credential Containment”If a credential may have been exposed:
Identify Credential ↓Determine Usage ↓Revoke / Rotate ↓Update Workload ↓ValidatePotential credentials include:
Application Secrets
Service Account Credentials
Cloud Credentials
Database CredentialsPart 67 — RBAC Containment
Section titled “Part 67 — RBAC Containment”If the compromised workload has excessive Kubernetes permissions:
Identify RoleBinding ↓Assess Requirement ↓Remove Excessive Permission ↓Validate ApplicationPart 68 — Workload Replacement
Section titled “Part 68 — Workload Replacement”Containers should generally be treated as:
Disposablerather than manually cleaned and trusted again.
A typical recovery model is:
Identify Root Cause ↓Fix Source / Image / Configuration ↓Build Trusted Image ↓Redeploynot:
Manually Clean Compromised Container ↓Return It to ProductionPart 69 — Image Investigation
Section titled “Part 69 — Image Investigation”Record:
Image Repository
Image Tag
Image Digest
Build Source
Registry
Scan StatusAsk:
Was the image compromised before deployment?
Or was the running application compromised later?These represent different incident paths.
Part 70 — Supply-Chain Scenario
Section titled “Part 70 — Supply-Chain Scenario”Possible sequence:
Compromised Source ↓Malicious Build ↓Container Image ↓Registry ↓Deployment ↓Runtime ActivityRuntime detection may be the first place malicious behavior becomes visible.
Part 71 — Application Exploit Scenario
Section titled “Part 71 — Application Exploit Scenario”Another sequence:
Trusted Image ↓Vulnerable Application ↓External Request ↓Runtime Exploitation ↓Suspicious ProcessThis requires different remediation:
Patch Applicationrather than only:
Replace Registry ImagePart 72 — Investigation Scenario
Section titled “Part 72 — Investigation Scenario”Assume the following runtime event:
Rule:Shell Spawned in Container
Namespace:ghc-runtime-lab
Pod:runtime-app-xxxxx
Container:web
Process:/bin/sh
Severity:WarningYour Investigation
Section titled “Your Investigation”Determine:
1. Is the Pod expected?
2. Is shell activity normal?
3. Who initiated it?
4. Was pods/exec used?
5. What ServiceAccount is attached?
6. What permissions exist?
7. What network access exists?
8. What secrets are mounted?
9. What processes followed?
10. Is containment required?Part 73 — Incident Decision
Section titled “Part 73 — Incident Decision”After investigation, classify:
Benign
Expected Administrative Activity
Policy Violation
Suspicious
Confirmed IncidentExample Benign Outcome
Section titled “Example Benign Outcome”Shell initiated by authorized SRE
Change ticket exists
No follow-on suspicious activity
No credential exposureResult:
Benign Administrative ActivityBut you may still decide production shell access should be better governed.
Example Malicious Outcome
Section titled “Example Malicious Outcome”No approved administrator activity
Unexpected shell
Credential access
External connection
Excessive ServiceAccount permissionsResult:
Potential Container CompromisePart 74 — Runtime Security Finding
Section titled “Part 74 — Runtime Security Finding”Document:
Finding:Unexpected Interactive ShellObserved in Application Container
Affected Resource:runtime-app
Namespace:ghc-runtime-lab
Observation:An interactive shell executed insidea container whose normal behaviordoes not require shell activity.
Security Impact:Unexpected shell execution may indicateunauthorized administrative activityor post-exploitation behavior.
Risk:High
Recommendation:Investigate the initiating identity,review Kubernetes audit activity,validate ServiceAccount permissions,review subsequent runtime events,and restrict unnecessary administrative access.Part 75 — Excessive Runtime Privilege Finding
Section titled “Part 75 — Excessive Runtime Privilege Finding”Example:
Finding:Application Container Executeswith Excessive Runtime Privileges
Observation:The workload configuration grantspermissions beyond the application'snormal operational requirement.
Threat Scenario:If the application is compromised,excessive privileges may increasepost-compromise impact.
Recommendation:Apply least privilege throughsecurityContext controls and admission policy.Part 76 — Runtime Finding Template
Section titled “Part 76 — Runtime Finding Template”Use:
Finding:
Alert:
Timestamp:
Affected Cluster:
Namespace:
Pod:
Container:
Process:
Observed Behavior:
Expected Behavior:
Evidence:
Service Account:
RBAC Exposure:
Network Exposure:
Data Exposure:
Threat Scenario:
Business Impact:
Risk:
Recommendation:
Containment:
Remediation:
Validation:Part 77 — Root Cause Analysis
Section titled “Part 77 — Root Cause Analysis”Do not stop at:
We Deleted the PodAsk:
How Did the Activity Begin?
Why Was It Possible?
Why Was It Not Prevented?
Why Was It Detected?
What Increased the Blast Radius?
Which Control Should Change?Root Cause Categories
Section titled “Root Cause Categories”Possible categories include:
Application Vulnerability
Weak Authentication
Excessive RBAC
Weak Network Segmentation
Insecure Workload Configuration
Compromised Image
Credential Exposure
Administrative MisusePart 78 — Security Control Improvement
Section titled “Part 78 — Security Control Improvement”Map findings to controls.
| Runtime Finding | Preventive Improvement |
|---|---|
| Privileged container | Admission policy |
| Excessive SA permissions | RBAC |
| Unnecessary outbound access | NetworkPolicy |
| Root execution | Workload security policy |
| Unknown image | Registry policy |
| Unexpected shell | Runtime detection + access governance |
| Credential exposure | Secrets management |
Part 79 — Detection-to-Prevention Loop
Section titled “Part 79 — Detection-to-Prevention Loop”This is one of the most important concepts in the lab:
DETECT ↓INVESTIGATE ↓UNDERSTAND ROOT CAUSE ↓IMPROVE PREVENTION ↓IMPROVE DETECTIONPart 80 — Detection Coverage Assessment
Section titled “Part 80 — Detection Coverage Assessment”Ask:
Can We Detect Unexpected Shells?
Can We Detect Privilege Changes?
Can We Detect Sensitive File Access?
Can We Detect Unexpected Processes?
Can We Detect Suspicious Network Activity?
Can We Correlate With Kubernetes Identity?Record gaps.
Part 81 — Detection Gap Finding
Section titled “Part 81 — Detection Gap Finding”Example:
Finding:Insufficient Kubernetes Runtime Monitoring
Observation:The environment lacks reliable detectionfor unexpected process executioninside production containers.
Impact:Post-exploitation activity may occurwithout timely security visibility.
Risk:High
Recommendation:Implement runtime telemetry and detectionfor high-risk container behaviors andintegrate alerts with centralized monitoring.Part 82 — SIEM Integration
Section titled “Part 82 — SIEM Integration”In enterprise environments:
Runtime Security ↓Alert Pipeline ↓SIEM ↓SOCThis allows correlation with:
Cloud Logs
Identity Logs
Kubernetes Audit Logs
Network Logs
Application LogsExample Correlation
Section titled “Example Correlation”Suspicious Login ↓Kubernetes API Request ↓Pod Exec ↓Runtime Shell AlertTogether, these events tell a stronger story than any one signal.
Part 83 — Runtime Alert Priority
Section titled “Part 83 — Runtime Alert Priority”Prioritize alerts using:
Severity
Confidence
Workload Criticality
Internet Exposure
Privilege
Data Sensitivity
Identity Permissions
Follow-On ActivityPart 84 — High-Risk Combination
Section titled “Part 84 — High-Risk Combination”For example:
Internet-Facing Pod +Unexpected Shell +Powerful ServiceAccount +No Egress Restrictionsshould generally receive more attention than an isolated low-impact training workload.
Part 85 — Detection Rule Quality
Section titled “Part 85 — Detection Rule Quality”A strong detection rule should produce useful context.
Instead of:
Shell Detectedprefer telemetry containing:
Shell Detected
Cluster
Namespace
Pod
Container
Process
User
Parent Process
Node
TimestampPart 86 — Investigation Runbook Thinking
Section titled “Part 86 — Investigation Runbook Thinking”Every high-value runtime alert should eventually have:
Alert Description
Triage Steps
Evidence Sources
Escalation Criteria
Containment Options
Recovery StepsThis converts detection engineering into repeatable operations.
Part 87 — Runtime Security Challenge 01
Section titled “Part 87 — Runtime Security Challenge 01”Scenario:
Unexpected Shellin Web Application PodDetermine:
Was kubectl exec used?
Which user initiated it?
Is it approved?
What happened afterward?Document your conclusion.
Part 88 — Runtime Security Challenge 02
Section titled “Part 88 — Runtime Security Challenge 02”Scenario:
Unexpected Sensitive File AccessDetermine:
Which Process?
Which File?
Normal Application Behavior?
Any Credential Exposure?
Rotation Required?Part 89 — Runtime Security Challenge 03
Section titled “Part 89 — Runtime Security Challenge 03”Scenario:
Unexpected Outbound ConnectionDetermine:
Source Process
Destination
Port
NetworkPolicy
Business Requirement
Potential Exfiltration RiskPart 90 — Runtime Security Challenge 04
Section titled “Part 90 — Runtime Security Challenge 04”Scenario:
Compromised Poduses powerful ServiceAccountDetermine:
Effective RBAC
Accessible Resources
Potential Cluster Impact
Required Credential/RBAC ContainmentPart 91 — Runtime Security Challenge 05
Section titled “Part 91 — Runtime Security Challenge 05”Build a timeline from:
Application Request
Shell Alert
Sensitive File Access
Network Connection
Kubernetes API ActivityThen determine the likely sequence of events.
Part 92 — Evidence Collection Checklist
Section titled “Part 92 — Evidence Collection Checklist”Capture:
- Runtime alert
- Alert timestamp
- Cluster
- Namespace
- Pod
- Container
- Process
- Parent process
- Container image
- Pod security context
- Service account
- RBAC permissions
- Network policies
- Mounted volumes
- Secret references
- Kubernetes events
- Application logs
- Relevant audit events
- Related runtime events
- Timeline
Part 93 — Incident Report Template
Section titled “Part 93 — Incident Report Template”Incident:Kubernetes Runtime Security Event
Date:
Cluster:
Namespace:
Affected Workload:
Initial Alert:
Observed Behavior:
Expected Behavior:
Runtime Evidence:
Kubernetes Evidence:
Identity Evidence:
Network Evidence:
Potential Data Exposure:
Blast Radius:
Root Cause:
Severity:
Containment:
Remediation:
Recovery:
Preventive Improvements:
Detection Improvements:
Final Status:Part 94 — Cleanup
Section titled “Part 94 — Cleanup”Before cleanup, preserve the evidence required for your lab report.
Then remove the training namespace:
kubectl delete namespace ghc-runtime-labVerify:
kubectl get namespace ghc-runtime-labRestore your namespace context if necessary:
kubectl config set-context --current --namespace=defaultImportant
Section titled “Important”Do not remove:
Falco
Runtime Security Agents
Cluster Logging
Monitoring Componentsunless they were installed specifically for your isolated lab and you are responsible for removing them.
Lab Completion Checklist
Section titled “Lab Completion Checklist”Runtime Fundamentals
Section titled “Runtime Fundamentals”- Understood runtime security
- Understood preventive vs detective controls
- Understood behavioral monitoring
- Established application baseline
Runtime Detection
Section titled “Runtime Detection”- Understood Falco concepts
- Generated a safe shell event
- Reviewed runtime-event context
- Understood process monitoring
- Understood sensitive-file monitoring
- Understood network monitoring
Kubernetes Investigation
Section titled “Kubernetes Investigation”- Identified affected Pod
- Reviewed container image
- Reviewed security context
- Reviewed ServiceAccount
- Reviewed RBAC
- Reviewed NetworkPolicy
- Reviewed mounted resources
- Reviewed Kubernetes events
Incident Analysis
Section titled “Incident Analysis”- Created event timeline
- Assessed blast radius
- Classified the alert
- Identified possible root cause
- Identified containment options
Security Improvement
Section titled “Security Improvement”- Mapped runtime findings to RBAC
- Mapped findings to NetworkPolicy
- Mapped findings to admission policy
- Identified detection improvements
- Documented security finding
Skills You Practiced
Section titled “Skills You Practiced”You have now worked with:
Kubernetes Runtime Security
Container Monitoring
Behavioral Detection
Falco Concepts
Process Analysis
Alert Triage
Runtime Investigation
Kubernetes Context Enrichment
Blast Radius Analysis
Containment
Incident ResponseCareer Connection
Section titled “Career Connection”These skills are highly relevant for:
Kubernetes Security Engineer
Cloud Security Engineer
SOC Analyst
Cloud SOC Analyst
Detection Engineer
DevSecOps Engineer
Platform Security Engineer
Incident Responder
Cloud Incident ResponderRuntime security becomes especially important for security professionals responsible for:
Production Kubernetes
Cloud-Native Applications
Containerized Workloads
Enterprise Detection and ResponseInterview Questions
Section titled “Interview Questions”- What is Kubernetes runtime security?
- Why is runtime security necessary if admission policies already exist?
- What is the difference between preventive and detective controls?
- What is Falco?
- What types of behavior can runtime security monitor?
- Why can a shell inside a container be suspicious?
- Does a shell automatically mean compromise?
- What context should accompany a runtime alert?
- Why is application baselining important?
- What is behavioral detection?
- Why can package installation inside a production container be suspicious?
- Why is unexpected process execution important?
- What is a container escape?
- Why are privileged containers high risk?
- How can hostPath increase incident impact?
- Why are hostPID and hostNetwork security-sensitive?
- Why should Linux capabilities be reviewed?
- How can read-only root filesystems improve security?
- Why should you investigate a Pod’s ServiceAccount?
- How can RBAC affect runtime incident blast radius?
- Why should NetworkPolicies be reviewed during runtime investigations?
- What is lateral movement?
- How can egress restrictions reduce runtime risk?
- What evidence would you collect during a container incident?
- Why are Kubernetes audit logs useful?
- How can
pods/execactivity help explain a shell alert? - What is alert enrichment?
- What is alert triage?
- What is a false positive?
- How should runtime rules be tuned?
- Why should detections not simply be disabled because of noise?
- How do you determine incident severity?
- What is blast-radius analysis?
- How would you contain a compromised Kubernetes workload?
- Why might credentials need to be rotated?
- Why should compromised containers generally be replaced rather than manually cleaned?
- How can runtime findings improve admission policies?
- How can runtime findings improve NetworkPolicies?
- How can runtime findings improve RBAC?
- What is the detect-investigate-prevent feedback loop?
- How can runtime alerts integrate with a SIEM?
- Why is event correlation important?
- What is runtime evidence?
- Why is timeline reconstruction useful?
- How would you investigate an unexpected outbound connection?
- How would you investigate suspicious credential access?
- What is runtime detection coverage?
- What is a detection gap?
- How would you build a runtime incident runbook?
- What controls should complement runtime security?
Practical Readiness Milestone
Section titled “Practical Readiness Milestone”You should now be able to receive an alert:
Shell Spawned in Containerand perform:
Alert ↓Identify Cluster ↓Identify Pod ↓Identify Process ↓Review Baseline ↓Review Security Context ↓Review Service Account ↓Review RBAC ↓Review Network Access ↓Correlate Evidence ↓Determine Blast Radius ↓ContainYou are no longer looking only at:
The AlertYou are investigating:
The Entire Kubernetes ContextAround the Alert.Security Readiness Milestone
Section titled “Security Readiness Milestone”You should now understand the relationship between:
RBAC ↓Who Can Do What?
Admission Policy ↓What Can Be Deployed?
NetworkPolicy ↓Where Can It Communicate?
Runtime Security ↓What Is It Actually Doing?This creates:
IDENTITY +CONFIGURATION +NETWORK +BEHAVIORFinal Lab Mental Model
Section titled “Final Lab Mental Model”Remember:
WORKLOAD ↓NORMAL BASELINE ↓RUNTIME TELEMETRY ↓DETECTION ↓ALERT ↓CONTEXT ↓INVESTIGATION ↓BLAST RADIUS ↓CONTAINMENT ↓REMEDIATIONThe goal of runtime security is not:
Generate More AlertsThe goal is:
Detect MeaningfulPost-Deployment ThreatsEarly Enough to Respond.Lab Outcome
Section titled “Lab Outcome”Before this lab:
You focused mainly onpreventing insecure Kubernetesconfigurations and communication.After this lab:
You established workload baselines,
generated safe runtime events,
investigated process activity,
correlated Kubernetes context,
reviewed service-account permissions,
assessed network exposure,
built an incident timeline,
evaluated blast radius,
and designed containment actions.You have moved from:
Kubernetes Preventionto:
Kubernetes Detectionand Response.What’s Next?
Section titled “What’s Next?”➡️ Lab 07 — Workload Security
In the final Kubernetes lab, you will bring the security controls together and harden the workload itself.
You will focus on:
Security Contexts
Non-Root Execution
Privilege Escalation
Linux Capabilities
Read-Only Filesystems
Resource Controls
Service Accounts
Secrets
Container Images
Pod Security Standards
Workload HardeningThe lab progression becomes:
Lab 01 — Kubernetes Fundamentals ↓Understand Resources
Lab 02 — Kubernetes RBAC ↓Control Identity
Lab 03 — Kyverno ↓Control Configuration
Lab 04 — Network Policies ↓Control Communication
Lab 05 — OPA Gatekeeper ↓Enforce Governance
Lab 06 — Runtime Security ↓Detect Suspicious Behavior
Lab 07 — Workload Security ↓Harden Kubernetes WorkloadsAfter Lab 07, you will be ready to move from individual security controls into repeatable Kubernetes security operations through the Kubernetes Runbooks.