⚡ ~/naveed k8s
⚡ Portfolio Home ✍️ Engineering Blog Deep Dives 🎯 Interview Hub 1,000+ Scenarios ☸️ Kubernetes Mastery Hub 24 Modules 🎮 DevOps Arcade & Quizzes Subnet Blitz ⚡ 🗺️ DevOps Roadmaps PDFs & Guides 🤖 Morpheus Analysis AI Quant ↗ 🛠️ Developer Tools Utilities 🧪 Labs & Experiments 📄 Interactive CV & Certs 🔗 All Links & Socials ⚡ Join The Dispatch (Weekly SRE Newsletter) →
Phase 3 — Security Module 19 of 24 Free & Open Access

Runtime & Network Security

Complete production curriculum breakdown. Learn core architectural mechanics, study definitions in plain language, practice hands-on labs with the local minikube prod-sim cluster, and test active recall.

19 - Runtime & Network Security

Why this matters

Prevention (topics 16-18) will eventually fail once — you need detection: something watching what's actually happening at runtime and alerting/blocking on suspicious behavior.

Read this first — Definitions & Explanations

Runtime security

Detect suspicious behavior while workloads run (unexpected process, shell in container, crypto miner patterns). Tools in the Falco family are examples of this class.

Egress control

NetworkPolicies can limit outbound connections so a compromised Pod can’t freely exfiltrate data.

mTLS between services

mutual TLS so services authenticate each other and encrypt traffic — often provided by a service mesh.

Segmentation

Separate sensitive workloads by namespace + network policy + strict RBAC to reduce blast radius.

Privileged containers

privileged: true / hostNetwork / hostPID are powerful and dangerous. Use only with strong justification.

Official docs (read for detail)

Key Concepts

YouTube search terms

Hands-on lab (on prod-sim)

# Install Falco
helm repo add falcosecurity https://falcosecurity.github.io/charts
helm install falco falcosecurity/falco -n falco --create-namespace \
  --set tty=true

# Watch Falco's live output
kubectl -n falco logs -l app.kubernetes.io/name=falco -f &

# Trigger a real detection: spawn a shell inside a running container (classic red flag)
kubectl run victim --image=nginx
kubectl exec -it victim -- /bin/bash
  whoami; exit
# check the Falco log tab — you should see a "Terminal shell in container" alert

# Trigger another: write to a sensitive path
kubectl exec victim -- sh -c "touch /etc/newfile"
# Falco should flag "Write below etc"

kill %1   # stop tailing falco logs

# Egress lockdown drill: deny-all egress except DNS + one destination
kubectl create namespace locked-egress
kubectl -n locked-egress run app --image=nginx
cat <<EOF | kubectl apply -f -
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
  name: default-deny-egress
  namespace: locked-egress
spec:
  podSelector: {}
  policyTypes: ["Egress"]
  egress:
  - to:
    - namespaceSelector: {}
    ports:
    - protocol: UDP
      port: 53
    - protocol: TCP
      port: 53
EOF
kubectl -n locked-egress exec app -- curl -m2 -sS http://example.com   # should fail/timeout
kubectl -n locked-egress exec app -- nslookup example.com              # DNS still works

Notes

(fill in your own words after watching + labbing)

📋 Self-Assessment Mastery Checklist (4 Competencies)
🧠 Practice Exam Questions (Module 19 MCQs)
⚡ Take Quiz & Save Progress in Tracker

Review these sample exam questions out loud, test your retrieval, and then unlock official scoring in the interactive tracker.

Question 1: Runtime security tools (e.g. Falco-style) detect:
  • A. Suspicious behavior in running workloads
  • B. Only YAML syntax errors
  • C. Helm lint issues
  • D. PVC capacity
✓ Correct Answer: A (Suspicious behavior in running workloads)
Option A ('Suspicious behavior in running workloads') is the standard production architectural best practice.
Question 2: Egress NetworkPolicies can limit:
  • A. Outbound connections from Pods
  • B. API server QPS only
  • C. etcd compaction
  • D. Scheduler scoring
✓ Correct Answer: A (Outbound connections from Pods)
Option A ('Outbound connections from Pods') is the standard production architectural best practice.
Question 3: mTLS between services is commonly associated with:
  • A. Service mesh security
  • B. PV access modes
  • C. kubeadm certs only for nodes
  • D. ConfigMap hashing
✓ Correct Answer: A (Service mesh security)
Option A ('Service mesh security') is the standard production architectural best practice.
Question 4: Least privilege for runtime means:
  • A. Minimal capabilities, no unnecessary privileges
  • B. Privileged: true everywhere
  • C. hostNetwork on all Pods
  • D. cluster-admin in every Pod
✓ Correct Answer: A (Minimal capabilities, no unnecessary privileges)
Option A ('Minimal capabilities, no unnecessary privileges') is the standard production architectural best practice.
Question 5: Segmenting sensitive workloads (namespaces + policies) reduces:
  • A. Blast radius of compromises
  • B. Need for backups
  • C. Need for monitoring
  • D. Need for TLS to the API
✓ Correct Answer: A (Blast radius of compromises)
Option A ('Blast radius of compromises') is the standard production architectural best practice.
← Previous Module (18) Supply Chain Security & Admission Control Next Module (20) → CRDs & Custom Controllers/Operators