Wiki workshop · Αγγλικά

Kubernetes Workshop: Advanced + Security – Exercises with Solutions

Reference: 04-advanced-security-EN.md Difficulty level: Advanced + Security Format: security review, hands-on lab, walkthrough, and sample solutions

Παραδείγματα workshop σε ZIP
Πρόοδος μάθησης στη web app

Σημειώστε κεφάλαια ως αναγνωσμένα, δείτε την πρόοδο ανάγνωσης και ολοκληρώστε πρακτικές ενότητες αφού ενεργοποιήσετε την προαιρετική web app. Η πρόοδος του workshop υπολογίζεται από τα κεφάλαια όλων των σελίδων τεκμηρίωσης. Οι επιλογές μένουν σε αυτή τη συσκευή· δεν υπάρχει λογαριασμός ή συγχρονισμός με server. Δεν απαιτείται εγκατάσταση. Η ανάκληση στις Ρυθμίσεις απορρήτου διαγράφει την πρόοδο.

Πρόοδος ανάγνωσης0%
0%
0 / 27 κεφάλαια που διαβάστηκαν

Δεν υπάρχει ακόμη ελληνική έκδοση αυτού του εγγράφου. Το περιεχόμενο εμφανίζεται στα αγγλικά.

Άλλη γλωσσική έκδοσηΓερμανικά ↗Ελληνικά ↗

Kubernetes Workshop: Advanced + Security – Exercises with Solutions

Reference: 04-advanced-security-EN.md
Difficulty level: Advanced + Security
Format: security review, hands-on lab, walkthrough, and sample solutions

Goal of this exercise document

This exercise document complements the Advanced and Security workshop with practical tasks, review checklists, sample solutions, and walkthroughs. The focus is on threat modeling, API Server and control-plane hardening, RBAC, identity, Pod Security Standards, workload hardening, RuntimeClass, network security, supply-chain security, policy-as-code, Admission Control, Secrets security, runtime detection, compliance, evidence, and incident response.

Work only in a lab cluster. Do not use production Secrets, real customer data, or production cluster contexts.

01 / 27

Prerequisites

You need:

  • a lab cluster
  • kubectl
  • rights to create Namespaces, ServiceAccounts, RBAC, NetworkPolicies, and test workloads
  • optional Kyverno, OPA Gatekeeper, or ValidatingAdmissionPolicy support
  • optional Trivy, Grype, Cosign, or a prepared supply-chain demo flow
  • optional Falco, Tetragon, Tracee, or comparable runtime signals

Recommended Namespace:

bash
export NS=workshop-security
kubectl create namespace "$NS"
kubectl config set-context --current --namespace="$NS"
02 / 27

Exercise overview

No. Topic Result
1 Threat Model risks by API, Node, workload, network, Secrets, supply chain
2 RBAC audit effective rights and escalation paths evaluated
3 ServiceAccount Token token automount reduced
4 Pod Security Restricted insecure Pods blocked and hardened
5 Workload hardening SecurityContext set correctly
6 NetworkPolicy Default Deny, DNS, and app traffic controlled
7 Supply Chain image, tag, digest, SBOM, scan, and signature evaluated
8 Admission Policy required Labels or SecurityContext enforced
9 Secrets Security Secret flows and rotation evaluated
10 Runtime Detection signals and reactions defined
11 Compliance Evidence finding, risk, exception, and fix documented
12 Incident Response runbook for compromised Pod and Secret leak

Part A – Exercises

03 / 27

Exercise 1: Write a Kubernetes Threat Model

Goal

You model security risks separately by Kubernetes attack surfaces.

Scenario

A sample app consists of:

  • Namespace shop-prod,
  • Deployment checkout-api,
  • ServiceAccount checkout-sa,
  • Secret payment-api-token,
  • Ingress/Gateway route,
  • private registry,
  • GitOps Controller,
  • CI pipeline.

Task

Create threat-model.md with:

  1. assets and protection value,
  2. trust boundaries,
  3. attack surfaces,
  4. abuse scenarios,
  5. existing controls,
  6. missing controls,
  7. stop criteria,
  8. evidence.

04 / 27

Exercise 2: Perform RBAC audit

Goal

You identify overly broad rights and privilege-escalation paths.

Task

  1. Create two ServiceAccounts: app-sa and overprivileged-sa.
  2. Give app-sa minimal read rights for ConfigMaps.
  3. Intentionally give overprivileged-sa rights to Secrets and RoleBindings.
  4. Check effective rights with kubectl auth can-i.
  5. Document risks and fixes.

05 / 27

Exercise 3: Reduce ServiceAccount token automount

Goal

You make sure that Pods without Kubernetes API needs do not automatically receive a mounted ServiceAccount token.

Task

  1. Create a Deployment no-api-app.
  2. Set automountServiceAccountToken: false.
  3. Check in the Pod whether /var/run/secrets/kubernetes.io/serviceaccount exists.
  4. Explain when a Pod needs a token and when it does not.

06 / 27

Exercise 4: Enforce Pod Security Restricted

Goal

You enforce Pod Security Standards in the Namespace and correct an insecure Pod.

Task

  1. Set Namespace Labels for restricted in enforce, audit, and warn.
  2. Create an insecure Pod with privileged: true.
  3. Observe the rejection.
  4. Create a hardened Pod that satisfies Restricted requirements.
  5. Document the differences.

07 / 27

Exercise 5: Workload hardening with SecurityContext

Goal

You translate workload hardening into concrete Pod and container SecurityContext fields.

Task

Hardening criteria:

  • do not run as root,
  • forbid privilege escalation,
  • read-only root filesystem,
  • drop all Linux capabilities,
  • seccomp RuntimeDefault,
  • temporary writable directory through emptyDir,
  • no host namespace usage.

Create a Deployment that meets these criteria.


08 / 27

Exercise 6: NetworkPolicy Default Deny with DNS and app allow

Goal

You reduce lateral movement and allow only required traffic.

Task

  1. Create frontend and backend.
  2. Create Default Deny for Ingress and Egress.
  3. Allow DNS Egress.
  4. Allow frontend to backend on port 8080.
  5. Block all other Egress.
  6. Document which additional exceptions would be needed in production.

09 / 27

Exercise 7: Check supply-chain security

Goal

You evaluate a Kubernetes workload from a supply-chain perspective.

Task

For a sample image, document:

  • registry,
  • repository,
  • tag,
  • digest,
  • pull policy,
  • ImagePullSecret,
  • scan result,
  • SBOM status,
  • signature status,
  • Admission requirement,
  • stop criterion.

Optional with tools:

bash
trivy image <image>
cosign verify <image>@<digest>

10 / 27

Exercise 8: Write an Admission Policy

Goal

You formulate a Policy that blocks insecure or incomplete resources.

Task

Write a Policy for one of these goals:

  1. required Labels owner, environment, cost-center,
  2. ban privileged: true,
  3. require runAsNonRoot: true,
  4. require resource requests and limits,
  5. only allowed registries.

Depending on your lab, use Kyverno, OPA Gatekeeper, or a native ValidatingAdmissionPolicy.


11 / 27

Exercise 9: Evaluate Secrets security and rotation

Goal

You distinguish Kubernetes Secret, External Secrets, CSI Secret Store, Sealed Secrets, and SOPS based on a concrete risk.

Task

Create secrets-review.md with:

  1. Secret inventory,
  2. who has access,
  3. where Secrets are mounted,
  4. whether Secrets could become visible in logs or Events,
  5. rotation path,
  6. etcd/backup risk,
  7. recommendation for a Secret system,
  8. incident action in case of leak.

12 / 27

Exercise 10: Classify runtime detection

Goal

You define signals that runtime detection or audit logging should detect.

Task

Define detection rules or expected signals for:

  • unexpected shell in the container,
  • write access to /etc, /proc, or /sys,
  • unexpected Egress,
  • access to the Kubernetes API with ServiceAccount,
  • suspicious kubectl exec,
  • OOMKill in a security-relevant Pod.

For each signal, document: risk, data source, first reaction, and evidence.


13 / 27

Exercise 11: Create compliance evidence

Goal

You create a defensible compliance finding with risk, owner, exception, or fix.

Task

Create compliance-evidence.md with at least five findings:

  1. Namespace without Pod Security Label,
  2. ServiceAccount with overly broad rights,
  3. Pod without requests/limits,
  4. Secret without rotation note,
  5. workload without NetworkPolicy.

For each finding, document:

  • timestamp,
  • resource,
  • risk,
  • evidence,
  • owner,
  • fix,
  • exception with expiration date or remediation deadline.

14 / 27

Exercise 12: Write incident runbook

Goal

You formulate a Kubernetes incident-response path for a compromised Pod and a Secret leak.

Task

Create incident-runbook.md with:

  1. triage,
  2. isolation,
  3. evidence preservation,
  4. containment,
  5. Secret and token rotation,
  6. image and CI check,
  7. rebuild and redeploy,
  8. communication,
  9. lessons learned,
  10. policy hardening.

Part B – Solutions and walkthroughs

15 / 27

Solution 1: Threat Model

Sample structure:

markdown
# Threat Model: checkout-api

## Assets

| Asset | Protection value |
| --- | --- |
| payment-api-token | very high |
| checkout-api Deployment | high |
| checkout-sa ServiceAccount | high |
| Registry Image | high |
| GitOps Repository | very high |
| Ingress/Gateway Route | medium to high |

## Trust Boundaries

- Internet to Ingress/Gateway
- App Namespace to Kubernetes API
- Pod to Secret Store
- CI to Registry
- GitOps Controller to Cluster
- Namespace to other Namespaces

## Abuse scenarios

| Scenario | Risk | Control |
| --- | --- | --- |
| Pod reads Secret and exfiltrates token | payment-data access | RBAC, minimize Secret mount, NetworkPolicy, rotation |
| ServiceAccount can list Secrets | Secret exfiltration | Least Privilege, `can-i`, audit logs |
| unsigned image is deployed | malware | signature verification, digest pinning, Admission |
| missing NetworkPolicy allows lateral movement | spread | Default Deny, targeted Egress rules |
| CI has cluster-admin | pipeline compromise becomes cluster compromise | GitOps, reduced CI rights |

## Stop criteria

- ServiceAccount can `get/list/watch secrets` without business need.
- Workload runs `privileged` without exception.
- Image is not signed or not scanned.
- Secret rotation is not possible.
- no evidence for Policy exceptions.

16 / 27

Solution 2: RBAC audit

ServiceAccounts:

yaml
apiVersion: v1
kind: ServiceAccount
metadata:
  name: app-sa
  namespace: workshop-security
---
apiVersion: v1
kind: ServiceAccount
metadata:
  name: overprivileged-sa
  namespace: workshop-security

Minimal Role:

yaml
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
  name: configmap-reader
  namespace: workshop-security
rules:
  - apiGroups: [""]
    resources: ["configmaps"]
    verbs: ["get", "list", "watch"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
  name: app-sa-configmap-reader
  namespace: workshop-security
subjects:
  - kind: ServiceAccount
    name: app-sa
    namespace: workshop-security
roleRef:
  kind: Role
  name: configmap-reader
  apiGroup: rbac.authorization.k8s.io

Intentionally risky Role:

yaml
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
  name: risky-role
  namespace: workshop-security
rules:
  - apiGroups: [""]
    resources: ["secrets"]
    verbs: ["get", "list", "watch"]
  - apiGroups: ["rbac.authorization.k8s.io"]
    resources: ["rolebindings"]
    verbs: ["create", "update", "patch"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
  name: risky-binding
  namespace: workshop-security
subjects:
  - kind: ServiceAccount
    name: overprivileged-sa
    namespace: workshop-security
roleRef:
  kind: Role
  name: risky-role
  apiGroup: rbac.authorization.k8s.io

Check:

bash
kubectl apply -f rbac.yml
kubectl auth can-i get configmaps --as system:serviceaccount:workshop-security:app-sa -n workshop-security
kubectl auth can-i get secrets --as system:serviceaccount:workshop-security:app-sa -n workshop-security
kubectl auth can-i get secrets --as system:serviceaccount:workshop-security:overprivileged-sa -n workshop-security
kubectl auth can-i create rolebindings --as system:serviceaccount:workshop-security:overprivileged-sa -n workshop-security

Assessment:

  • app-sa is acceptable if the app needs to read ConfigMaps.
  • overprivileged-sa is critical because Secret read access and RoleBinding creation open escalation paths.
  • Fix: remove Secret access, remove RoleBinding creation, use separate break-glass processes.

17 / 27

Solution 3: ServiceAccount token automount

Deployment:

yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: no-api-app
  namespace: workshop-security
spec:
  replicas: 1
  selector:
    matchLabels:
      app: no-api-app
  template:
    metadata:
      labels:
        app: no-api-app
    spec:
      automountServiceAccountToken: false
      containers:
        - name: app
          image: busybox:1.36
          command: ["sh", "-c", "sleep 3600"]

Check:

bash
kubectl apply -f no-api-app.yml
kubectl rollout status deployment/no-api-app
POD=$(kubectl get pod -l app=no-api-app -o jsonpath='{.items[0].metadata.name}')
kubectl exec "$POD" -- ls -la /var/run/secrets/kubernetes.io/serviceaccount || true

Expected result:

The path does not exist or contains no automatically mounted token.

Technical decision:

  • Pod needs token: Kubernetes API access is technically required, for example for controllers.
  • Pod does not need token: normal web app without cluster API usage.

18 / 27

Solution 4: Pod Security Restricted

Label Namespace:

bash
kubectl label namespace workshop-security \
  pod-security.kubernetes.io/enforce=restricted \
  pod-security.kubernetes.io/audit=restricted \
  pod-security.kubernetes.io/warn=restricted --overwrite

Insecure Pod:

yaml
apiVersion: v1
kind: Pod
metadata:
  name: privileged-pod
  namespace: workshop-security
spec:
  containers:
    - name: app
      image: busybox:1.36
      command: ["sh", "-c", "sleep 3600"]
      securityContext:
        privileged: true

Expected result:

bash
kubectl apply -f privileged-pod.yml

The API Server rejects the Pod because of Pod Security Admission.

Hardened Pod:

yaml
apiVersion: v1
kind: Pod
metadata:
  name: restricted-pod
  namespace: workshop-security
spec:
  securityContext:
    runAsNonRoot: true
    seccompProfile:
      type: RuntimeDefault
  containers:
    - name: app
      image: busybox:1.36
      command: ["sh", "-c", "sleep 3600"]
      securityContext:
        runAsUser: 1000
        runAsGroup: 1000
        allowPrivilegeEscalation: false
        readOnlyRootFilesystem: true
        capabilities:
          drop:
            - ALL

Check:

bash
kubectl apply -f restricted-pod.yml
kubectl get pod restricted-pod
kubectl describe pod restricted-pod

19 / 27

Solution 5: Workload hardening

Deployment:

yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: hardened-app
  namespace: workshop-security
spec:
  replicas: 1
  selector:
    matchLabels:
      app: hardened-app
  template:
    metadata:
      labels:
        app: hardened-app
    spec:
      automountServiceAccountToken: false
      securityContext:
        runAsNonRoot: true
        seccompProfile:
          type: RuntimeDefault
      volumes:
        - name: tmp
          emptyDir: {}
      containers:
        - name: app
          image: busybox:1.36
          command: ["sh", "-c", "while true; do echo ok > /tmp/status; sleep 60; done"]
          volumeMounts:
            - name: tmp
              mountPath: /tmp
          securityContext:
            runAsUser: 1000
            runAsGroup: 1000
            allowPrivilegeEscalation: false
            readOnlyRootFilesystem: true
            capabilities:
              drop:
                - ALL
          resources:
            requests:
              cpu: 50m
              memory: 64Mi
            limits:
              cpu: 200m
              memory: 128Mi

Check:

bash
kubectl apply -f hardened-app.yml
kubectl rollout status deployment/hardened-app
kubectl get pod -l app=hardened-app -o yaml | grep -E 'runAsNonRoot|allowPrivilegeEscalation|readOnlyRootFilesystem|seccompProfile|capabilities' -A3

Explanation:

  • readOnlyRootFilesystem requires a separate writable directory if the app needs to write.
  • drop: ALL reduces Kernel capabilities.
  • allowPrivilegeEscalation: false prevents certain setuid/setcap escalation paths.

20 / 27

Solution 6: NetworkPolicy

Default Deny:

yaml
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
  name: default-deny
  namespace: workshop-security
spec:
  podSelector: {}
  policyTypes:
    - Ingress
    - Egress

Allow DNS:

yaml
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
  name: allow-dns-egress
  namespace: workshop-security
spec:
  podSelector: {}
  policyTypes:
    - Egress
  egress:
    - to:
        - namespaceSelector:
            matchLabels:
              kubernetes.io/metadata.name: kube-system
      ports:
        - protocol: UDP
          port: 53
        - protocol: TCP
          port: 53

Frontend to backend:

yaml
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
  name: allow-frontend-to-backend
  namespace: workshop-security
spec:
  podSelector:
    matchLabels:
      app: backend
  policyTypes:
    - Ingress
  ingress:
    - from:
        - podSelector:
            matchLabels:
              app: frontend
      ports:
        - protocol: TCP
          port: 8080
---
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
  name: allow-frontend-egress-to-backend
  namespace: workshop-security
spec:
  podSelector:
    matchLabels:
      app: frontend
  policyTypes:
    - Egress
  egress:
    - to:
        - podSelector:
            matchLabels:
              app: backend
      ports:
        - protocol: TCP
          port: 8080

Production follow-up questions:

  • Do Pods need Kubernetes API Egress?
  • Do Pods need registry, monitoring, or logging Egress?
  • Are there external APIs with fixed targets?
  • Is IPv6/dual-stack considered?
  • Does the CNI actually enforce these Policies?

21 / 27

Solution 7: Supply-chain security

Sample assessment:

markdown
# Supply-Chain Review

## Image

- Image: registry.example.com/shop/checkout-api:1.4.2
- Digest: sha256:<digest>
- Pull Policy: IfNotPresent or Always according to platform standard
- Registry: private, approved
- Pull Secret: Namespace-specific, rotated

## Checks

| Check | Result | Decision |
| --- | --- | --- |
| Tag is not latest | fulfilled | ok |
| Digest known | fulfilled | ok |
| CVE scan | 1 High, no Critical | remediation required |
| SBOM present | yes | ok |
| Signature | valid | ok |
| Provenance | CI Build ID present | ok |

## Stop criteria

- `latest` without digest in prod.
- Image from unapproved registry.
- Critical CVE without exception.
- missing signature for production workloads.
- Pull Secret without owner or rotation.

Optional:

bash
trivy image registry.example.com/shop/checkout-api:1.4.2
cosign verify registry.example.com/shop/checkout-api@sha256:<digest>

22 / 27

Solution 8: Admission Policy

Kyverno example: Required Labels

yaml
apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:
  name: require-standard-labels
spec:
  validationFailureAction: Enforce
  background: true
  rules:
    - name: require-owner-environment-cost-center
      match:
        any:
          - resources:
              kinds:
                - Pod
                - Deployment
      validate:
        message: "owner, environment, and cost-center Labels are required."
        pattern:
          metadata:
            labels:
              owner: "?*"
              environment: "?*"
              cost-center: "?*"

Kyverno example: Ban privileged

yaml
apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:
  name: disallow-privileged
spec:
  validationFailureAction: Enforce
  background: true
  rules:
    - name: privileged-containers
      match:
        any:
          - resources:
              kinds:
                - Pod
      validate:
        message: "Privileged containers are not allowed."
        pattern:
          spec:
            =(containers):
              - =(securityContext):
                  =(privileged): "false"

Operating path:

  1. Test Policy in Audit/Warn mode.
  2. Clean up findings.
  3. Document exceptions with owner and expiration date.
  4. Activate Enforce.
  5. Define rollback path for Policy failure.

23 / 27

Solution 9: Secrets security

Sample review:

markdown
# Secrets Review

## Inventory

| Secret | Namespace | Usage | Owner | Rotation |
| --- | --- | --- | --- | --- |
| payment-api-token | shop-prod | checkout-api | payments-team | every 90 days |

## Access

- Only checkout-sa may mount the Secret.
- No list rights on Secrets for app ServiceAccounts.
- No Secret in logs, Events, or images.

## Risk

Kubernetes Secrets are Base64-encoded API objects. Protection depends on RBAC, etcd encryption, backup protection, and Pod access.

## Recommended target state

- External Secrets or CSI Secret Store for external Secret source.
- Kubernetes Secret only as short-lived runtime projection.
- Rotation tested.
- Access through ServiceAccount minimized.

## Leak response

1. Identify Secret usage.
2. Isolate affected Pods.
3. Rotate Secret in source system.
4. Update Kubernetes Secret.
5. Restart Pods.
6. Check logs, Events, and audit.
7. Tighten RBAC and NetworkPolicy.

24 / 27

Solution 10: Runtime detection

Sample signal matrix:

Signal Risk Data source First reaction Evidence
unexpected shell interactive compromise Falco/Tetragon, audit exec isolate Pod, check audit process, user, Pod, time
write access /etc manipulation in container runtime sensor check workload hardening file path, process
unexpected Egress exfiltration or C2 flow logs, CNI, runtime block Egress target IP, DNS, Pod
Kubernetes API access token abuse audit logs check ServiceAccount verb, resource, subject
suspicious kubectl exec manual access API audit check user and change user, Pod, command time
OOMKill resource or attack signal kubelet/Event/metrics check logs and limits Events, container status

Important classification:

Detection does not replace prevention. It complements Pod Security, RBAC, NetworkPolicy, and Admission Control.


25 / 27

Solution 11: Compliance Evidence

Sample finding:

markdown
# Compliance Evidence

## Finding 1: Namespace without Pod Security Labels

- Timestamp: 2026-06-12 10:00
- Resource: namespace/team-legacy
- Risk: Insecure Pods can be created without warning or rejection.
- Evidence: `kubectl get ns team-legacy --show-labels`
- Owner: team-legacy
- Fix: Set Labels for enforce/audit/warn.
- Deadline: 14 days

## Finding 2: ServiceAccount with Secret read rights

- Resource: rolebinding/risky-binding
- Risk: Secret exfiltration.
- Evidence: `kubectl auth can-i get secrets --as system:serviceaccount:team-a:app-sa -n team-a`
- Fix: Remove Secret rights, check specific Secret mounting.

## Finding 3: Pod without requests/limits

- Risk: unreliable scheduling, noisy-neighbor effect.
- Fix: Add requests/limits through manifest and Admission.

## Finding 4: Secret without rotation note

- Risk: Long-lived Secret increases damage in case of leak.
- Fix: Document owner, rotation date, and source system.

## Finding 5: Workload without NetworkPolicy

- Risk: Lateral movement.
- Fix: Default Deny and targeted Allow Policies.

Good evidence contains not only a screenshot, but reproducible commands, owner, risk, deadline, and retest.


26 / 27

Solution 12: Incident runbook

Sample runbook:

markdown
# Incident Runbook: compromised Pod and Secret leak

## 1. Triage

- Identify signal source: runtime alert, audit log, user report, SIEM.
- Determine affected resource: Namespace, Pod, Node, ServiceAccount, Secret, image.
- Set criticality.

## 2. Isolation

- Tighten NetworkPolicy or isolate Namespace.
- Do not delete Pod too quickly if evidence is required.
- If Node is suspected: cordon/drain Node according to evidence plan.

## 3. Preserve evidence

- Pod YAML
- Events
- Logs and previous logs
- Image digest
- ServiceAccount and RBAC
- affected Secrets
- audit logs
- runtime alerts

Example:

kubectl get pod <pod> -n <ns> -o yaml > evidence-pod.yaml
kubectl describe pod <pod> -n <ns> > evidence-describe.txt
kubectl logs <pod> -n <ns> --all-containers > evidence-logs.txt
kubectl get events -n <ns> --sort-by=.metadata.creationTimestamp > evidence-events.txt

## 4. Containment

- Reduce ServiceAccount rights.
- Rotate tokens and Secrets.
- Block Egress.
- Block insecure image.

## 5. Recovery

- Roll out workload from clean image.
- Check GitOps state.
- Check CI/CD and registry.
- Run smoke tests.

## 6. Lessons learned

- Which Policy would have prevented the incident?
- Which detection worked?
- Which evidence was missing?
- Which RBAC or Secret control will be tightened?

Compromised Pod – minimal commands:

bash
kubectl get pod <pod> -n <ns> -o wide
kubectl get pod <pod> -n <ns> -o yaml
kubectl describe pod <pod> -n <ns>
kubectl logs <pod> -n <ns> --all-containers
kubectl logs <pod> -n <ns> --all-containers --previous
kubectl get sa,role,rolebinding -n <ns>
kubectl auth can-i get secrets --as system:serviceaccount:<ns>:<sa> -n <ns>

Secret leak – actions:

  1. Find Secret usage.
  2. Block access or isolate workload.
  3. Rotate Secret in source system.
  4. Update Kubernetes Secret.
  5. Restart Pods.
  6. Revoke old tokens.
  7. Check logs and audit for use.
  8. Correct RBAC and Secret process.

Cleanup

bash
kubectl delete namespace workshop-security

Assessment checklist

Criterion Completed?
Threat Model with assets and trust boundaries ☐
RBAC escalation paths identified ☐
ServiceAccount token automount reduced ☐
Pod Security Restricted applied ☐
SecurityContext fully hardened ☐
NetworkPolicy with DNS exception and app allow ☐
Supply-chain review with stop criteria ☐
Admission Policy with operating mode ☐
Secret rotation and leak path documented ☐
Runtime Detection translated into response plan ☐
Compliance Evidence formulated defensibly ☐
Incident runbook with evidence and recovery ☐
27 / 27

K8S · Orthevs Academy

31 modules ως ενιαία διαδρομή μάθησης.

Η σειρά παραμένει αμετάβλητη: από τη βασική δομή του lab μέσω τεχνικών θεμελίων και λειτουργικών μοντέλων έως το τελικό troubleshooting. Τα τεχνικά ονόματα καταλόγων διατηρούνται σκόπιμα.

Orthevs – Η μηχανική ως βάση για όσα ακολουθούν.

Το Orthevs ως εφαρμογή

Εγκατάσταση του Orthevs

Η web app του Orthevs μπορεί να εγκατασταθεί σε υποστηριζόμενες κινητές συσκευές και browsers υπολογιστή.

iPhone και iPad

Ανοίξτε το Orthevs στο Safari. Πατήστε Κοινή χρήση και μετά Προσθήκη στην οθόνη αφετηρίας. Ενεργοποιήστε το Άνοιγμα ως web app, αν εμφανίζεται, και πατήστε Προσθήκη.

Android

Για τη web app, ανοίξτε το μενού του browser και επιλέξτε Εγκατάσταση εφαρμογής ή Προσθήκη στην αρχική οθόνη. Επιβεβαιώστε την εγκατάσταση.

Browser υπολογιστή

Ανοίξτε το μενού του browser ή το εικονίδιο εγκατάστασης στη γραμμή διευθύνσεων και επιλέξτε Εγκατάσταση εφαρμογής ή Προσθήκη στο Dock.

Η εγκατάσταση της web app εξαρτάται από τον browser. Αν δεν εμφανιστεί διάλογος εγκατάστασης, ακολουθήστε τα βήματα του browser που αναφέρονται παραπάνω.