Kubernetes Snapshots by Example

Producer

$ kubectl exec -it producer -- /bin/bashroot@producer:/# echo 'Hello World!' > /data/file.txt

Snapshot Resources

$ kubectl describe volumesnapshot data-2021-07-15
...
Status:
Bound Volume Snapshot Content Name: snapcontent-04e67a76-d1d3-4541-a57f-96ad52845e45
Creation Time: 2021-07-16T14:33:56Z
Ready To Use: true
Restore Size: 10Gi
...

Demo

$ kubectl get pvc
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE
data Bound pvc-69fb87f1-ceeb-4a50-b7be-4b989ffeac4a 10Gi RWO standard-rwo 47m
demo Bound pvc-c9d2e792-0b85-474c-8c3f-80c261cb7a3f 10Gi RWO standard-rwo 54s
$ kubectl exec -it demo -- cat /data/file.txt
Hello World!

Consumer

$ kubectl get pvc
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE
data Bound pvc-69fb87f1-ceeb-4a50-b7be-4b989ffeac4a 10Gi RWO standard-rwo 56m
data-consumer-2021-07-15-0 Bound pvc-47058fe7-800c-4e75-9a85-abedcdfd5447 10Gi RWO standard-rwo 3m11s
data-consumer-2021-07-15-1 Bound pvc-ba6ec5a9-0e7a-455c-99d9-ee1f36ebf77e 10Gi RWO standard-rwo 2m27s
data-consumer-2021-07-15-2 Bound pvc-87940c81-62c8-4dde-a5f9-93a2811543fb 10Gi RWO standard-rwo 107s
demo Bound pvc-c9d2e792-0b85-474c-8c3f-80c261cb7a3f 10Gi RWO standard-rwo 9m31s
$ kubectl exec -it consumer-2021-07-15-0 -- cat /data/file.txt
Hello World!

Extra Thing

The StatefulSet "consumer-2021-07-15" is invalid: spec: Forbidden: updates to statefulset spec for fields other than 'replicas', 'template', and 'updateStrategy' are forbidden

One Last Thing

--

--

--

Broad infrastructure, development, and soft-skill background

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

What are Cloud Platforms

Learn How To Learn To Code

From How It Works to Top Best Ones: All About In-Ear Translator

Digital Healthcare Platform Website Clone.

DevSecOps

https://www.caferacks.com/devsecops/

Design Patterns — Adapter .NET

What the hell are “**kwargs”…

DevOps Lessons From the Initial Deployment

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
John Tucker

John Tucker

Broad infrastructure, development, and soft-skill background

More from Medium

First Tools for your new Hetzner Kubernetes Cluster

Security practices in Kubernetes

Getting Started With ArgoCD on your Kubernetes Cluster

Build Container Images with Jenkins and Podman — Part 2