Zum Hauptinhalt springen
tsecurity.de LIVE
Echtzeit-Radar & Feeds
Alle RSS Feeds
👥 Community & Social
Sichere ProgrammierungLarge AI Labs Face Regulatory Capture Allegations(21.09.2026 um 05:18 Uhr)
Sichere ProgrammierungWhat people are building with Jev: a look through nine awesome lists(21.09.2026 um 05:44 Uhr)
IT Security Toolsnetwatch v0.32.3(21.09.2026 um 04:36 Uhr)
Sichere ProgrammierungLarge AI Labs Face Regulatory Capture Allegations(21.09.2026 um 05:18 Uhr)
Sichere ProgrammierungWhat people are building with Jev: a look through nine awesome lists(21.09.2026 um 05:44 Uhr)
IT Security Toolsnetwatch v0.32.3(21.09.2026 um 04:36 Uhr)
Intelligence View
⚡ tsecurity.de Intelligence

Project: Understanding Kubernetes Volume Types

Reagiere als Erste:r — dein Feedback zählt!

🎯 Goal

By the end, you will viscerally know:

  • why some data disappears
  • why some data survives pod restarts
  • when to use each volume
  • why databases require PVCs

🧠 The 3 volume types we will test

Volume Data survives pod restart? Use case
emptyDir ❌ NO temp files, cache
hostPath ⚠️ SOMETIMES node-specific (dangerous)
PVC ✅ YES databases, user data

📁 Project structure

k8s-volumes-lab/
├── emptydir.yaml
├── hostpath.yaml
├── pvc.yaml
└── pod-pvc.yaml

🧩 PART 1 — emptyDir (DATA DIES WITH POD)

📄 emptydir.yaml

apiVersion: v1
kind: Pod
metadata:
  name: emptydir-demo
spec:
  containers:
    - name: app
      image: busybox
      command: ["sh", "-c", "sleep 3600"]
      volumeMounts:
        - name: data
          mountPath: /data
  volumes:
    - name: data
      emptyDir: {}

▶️ Apply

kubectl apply -f emptydir.yaml
kubectl exec -it emptydir-demo -- sh

✍️ Create data

echo "HELLO FROM EMPTYDIR" > /data/file.txt
cat /data/file.txt

❌ Kill the pod

kubectl delete pod emptydir-demo
kubectl apply -f emptydir.yaml
kubectl exec -it emptydir-demo -- cat /data/file.txt

💥 Result

No such file or directory

🧠 Lesson

emptyDir lives only as long as the pod lives

🧩 PART 2 — hostPath (DATA TIED TO NODE)

📄 hostpath.yaml

apiVersion: v1
kind: Pod
metadata:
  name: hostpath-demo
spec:
  containers:
    - name: app
      image: busybox
      command: ["sh", "-c", "sleep 3600"]
      volumeMounts:
        - name: host
          mountPath: /data
  volumes:
    - name: host
      hostPath:
        path: /tmp/hostpath-demo
        type: DirectoryOrCreate

▶️ Apply

kubectl apply -f hostpath.yaml
kubectl exec -it hostpath-demo -- sh

✍️ Create data

echo "HELLO FROM HOSTPATH" > /data/file.txt

🔁 Restart pod

kubectl delete pod hostpath-demo
kubectl apply -f hostpath.yaml
kubectl exec -it hostpath-demo -- cat /data/file.txt

✅ Result

HELLO FROM HOSTPATH

⚠️ Why this is dangerous

  • Data exists only on one node
  • Pod moves → data gone
  • Breaks HA
  • NEVER use for DBs in prod

🧠 Lesson

hostPath is node-coupled, not cluster-safe

🧩 PART 3 — PVC (PRODUCTION-SAFE STORAGE)

📄 pvc.yaml

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: demo-pvc
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 1Gi

📄 pod-pvc.yaml

apiVersion: v1
kind: Pod
metadata:
  name: pvc-demo
spec:
  containers:
    - name: app
      image: busybox
      command: ["sh", "-c", "sleep 3600"]
      volumeMounts:
        - name: data
          mountPath: /data
  volumes:
    - name: data
      persistentVolumeClaim:
        claimName: demo-pvc

▶️ Apply

kubectl apply -f pvc.yaml
kubectl apply -f pod-pvc.yaml
kubectl exec -it pvc-demo -- sh

✍️ Create data

echo "HELLO FROM PVC" > /data/file.txt

🔁 Restart pod

kubectl delete pod pvc-demo
kubectl apply -f pod-pvc.yaml
kubectl exec -it pvc-demo -- cat /data/file.txt

✅ Result

HELLO FROM PVC

🧠 Lesson

PVC survives pod death — this is how databases live

🧠 FINAL COMPARISON (MEMORIZE THIS)

Volume Pod dies Data
emptyDir
hostPath ⚠️ (node-only)
PVC

🔥 WHY DATABASES REQUIRE PVCs

Databases:

  • must survive restarts
  • must survive rescheduling
  • must survive upgrades

PVC gives:

  • persistent disk
  • node-independent storage
  • safe recovery

Without PVC:

Kubernetes is doing exactly what it was designed to do — destroy pods.

🖼️ Visual intuition

Image

Image

🎯 What a 6-year DevOps engineer says in interviews

“Pods are ephemeral, so persistent data must live on PVCs. emptyDir is for temporary data, hostPath is node-coupled and unsafe in production, and PVC abstracts durable storage from pod lifecycle.”

Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten Project: Understanding Kubernetes Volume Types

Thematisch verwandte Begriffe: Project, Understanding, Kubernetes, Volume · 6 Treffer

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Zum Aktualisieren ziehen
ZERO-DAY CVE-2026-94104 | NivoCart through 2.4.0 contains an arbitrary file upload vulnerability i…
Advisory →
TTS Reader • tsecurity.de Voice
tsecurity.de Icon
tsecurity.de App
Offline-Lesen, Eilmeldungen & 0ms Ladezeit

Installiere tsecurity.de direkt auf deinen Home-Bildschirm für das ultimative Vollbild-Magazinerlebnis ohne Browser-Leisten.

Nächster Beitrag
Themen-Radar & Intelligence Matrix
Echtzeit-Taxonomie nach Angriffsvektoren & Plattformen

tsecurity.de Live Threat Radar

🔴 LIVE RADAR
MONITORING
AKTIV
CVE-DATENBANK
LIVE
🔍
Community Radar & Live Chat
Sentinel Bot online • Live-Stream
Dein Cluster: Security Explorer
Match:
lädt…
Verbindung zum Community-Stream wird aufgebaut...
Bearbeitungsmodus — Senden überschreibt deine Nachricht
Community-Puls — was gerade passiert
lädt…
Aktivitäten deiner Analysten
lädt…
Neues Thema oder Eilmeldung einreichen

Reiche interessante Links, Zero-Days oder Debatten ein. Die Community entscheidet per Upvote über die Veröffentlichung.

Heiß diskutierte Einreichungen
🔖 Gespeicherte Artikel
📂 Keine gespeicherten Artikel vorhanden.
Zurück Ziehen Vor
Links: vorheriger Artikel Rechts: nächster Artikel unten: schließen
News NIS-2 Frühwarnung Tier-1 Intel ⏱️ 3 Min vor 10 Min
Artikeldaten werden geladen...

Zurück: vorheriger Vor: nächster
↗ Original-Quelle
Social Reaktionen Deine Reaktion zählt
Einstufung & Relevanz-Poll 0 Stimmen
In sozialen Netzwerken teilen 1-Klick