Skip to content

Commit eb5c573

Browse files
Bharath KaimalBharath Kaimal
authored andcommitted
updates to kubernetes-statepersistence
1 parent 5fc925f commit eb5c573

File tree

3 files changed

+56
-53
lines changed

3 files changed

+56
-53
lines changed
Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
# State Persistence
22

3-
State persistence in the context of Kubernetes/OpenShift refers to the ability to maintain and retain the state or data of applications even when they are stopped, restarted, or moved between nodes. This is achieved through the use of volumes, persistent volumes (PVs), and persistent volume claims (PVCs). Volumes provide a way to store and access data in a container, while PVs serve as the underlying storage resources provisioned by the cluster. PVCs act as requests made by applications for specific storage resources from the available PVs. By utilizing PVs and PVCs, applications can ensure that their state is preserved and accessible across pod restarts and migrations, enabling reliable and consistent data storage and retrieval throughout the cluster.
3+
State persistence in the context of Kubernetes/OpenShift refers to the ability to maintain and retain the state or data of applications even when they are stopped, restarted, or moved between nodes.
44

5-
## Resources
5+
This is achieved through the use of volumes, persistent volumes (PVs), and persistent volume claims (PVCs). **Volumes** provide a way to store and access data in a container, while **PVs** serve as the underlying storage resources provisioned by the cluster. **PVCs** act as requests made by applications for specific storage resources from the available PVs. By utilizing PVs and PVCs, applications can ensure that their state is preserved and accessible across pod restarts and migrations, enabling reliable and consistent data storage and retrieval throughout the cluster.
66

7+
## Resources
78

8-
[Volumes :fontawesome-solid-globe:](https://kubernetes.io/docs/concepts/storage/volumes/){ .md-button target="_blank"}
9+
[Volumes :fontawesome-solid-database:](https://kubernetes.io/docs/concepts/storage/volumes/){ .md-button target="\_blank"}
910

10-
[Persistent Volumes :fontawesome-solid-globe:](https://kubernetes.io/docs/concepts/storage/persistent-volumes/){ .md-button target="_blank"}
11+
[Persistent Volumes :fontawesome-solid-database:](https://kubernetes.io/docs/concepts/storage/persistent-volumes/){ .md-button target="\_blank"}
1112

12-
[Persistent Volume Claims :fontawesome-solid-globe:](https://kubernetes.io/docs/concepts/storage/persistent-volumes/#persistentvolumeclaims){ .md-button target="_blank"}
13+
[Persistent Volume Claims :fontawesome-solid-database:](https://kubernetes.io/docs/concepts/storage/persistent-volumes/#persistentvolumeclaims){ .md-button target="\_blank"}
1314

1415
## References
1516

@@ -25,16 +26,15 @@ spec:
2526
requests:
2627
storage: 1Gi
2728
```
28-
In this example, we define a PVC named my-pvc with the following specifications:
2929
30-
accessModes specify that the volume can be mounted as read-write by a single node at a time (ReadWriteOnce).
31-
resources.requests.storage specifies the requested storage size for the PVC (1Gi).
30+
In this example, we define a PVC named _my-pvc_ with the following specifications:
3231
32+
- _accessModes_ specify that the volume can be mounted as read-write by a single node at a time ("ReadWriteOnce")
33+
- _resources.requests.storage_ specifies the requested storage size for the PVC ("1Gi")
3334
3435
## Activities
3536
36-
| Task | Description | Link |
37-
| --------------------------------| ------------------ |:----------- |
38-
| *** Try It Yourself *** | |
37+
| Task | Description | Link |
38+
| ----------------------------- | ------------------------------------------------------------ | :-------------------------------------------------------------------- |
39+
| **_Try It Yourself_** | |
3940
| Setting up Persistent Volumes | Create a Persistent Volume that's accessible from a SQL Pod. | [Setting up Persistent Volumes](../../labs/kubernetes/lab10/index.md) |
40-

docs/openshift/state-persistence/pv-pvc.md

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -12,24 +12,23 @@ Pods access storage by using the claim as a volume. Claims must exist in the sam
1212

1313
PersistentVolumes binds are exclusive, and since PersistentVolumeClaims are namespaced objects, mounting claims with “Many” modes (ROX, RWX) is only possible within one namespace.
1414

15-
16-
1715
## Resources
16+
1817
=== "OpenShift"
1918

20-
[Persistent Storage :fontawesome-solid-globe:](https://docs.openshift.com/container-platform/4.13/storage/understanding-persistent-storage.html){ .md-button target="_blank"}
19+
[Persistent Storage :fontawesome-solid-database:](https://docs.openshift.com/container-platform/4.13/storage/understanding-persistent-storage.html){ .md-button target="_blank"}
2120

22-
[Persistent Volume Types :fontawesome-solid-globe:](https://docs.openshift.com/container-platform/4.13/storage/understanding-persistent-storage.html#types-of-persistent-volumes_understanding-persistent-storage){ .md-button target="_blank"}
21+
[Persistent Volume Types :fontawesome-solid-database:](https://docs.openshift.com/container-platform/4.13/storage/understanding-persistent-storage.html#types-of-persistent-volumes_understanding-persistent-storage){ .md-button target="_blank"}
2322

24-
[Expanding Peristent Volumes :fontawesome-solid-globe:](https://docs.openshift.com/container-platform/4.13/storage/expanding-persistent-volumes.html){ .md-button target="_blank"}
23+
[Expanding Peristent Volumes :fontawesome-solid-database:](https://docs.openshift.com/container-platform/4.13/storage/expanding-persistent-volumes.html){ .md-button target="_blank"}
2524

2625
=== "Kubernetes"
2726

28-
[Persistent Volumes :fontawesome-solid-globe:](https://kubernetes.io/docs/concepts/storage/persistent-volumes/){ .md-button target="_blank"}
27+
[Persistent Volumes :fontawesome-solid-database:](https://kubernetes.io/docs/concepts/storage/persistent-volumes/){ .md-button target="_blank"}
2928

30-
[Writing Portable Configurations :fontawesome-solid-globe:](https://kubernetes.io/docs/concepts/storage/persistent-volumes/#writing-portable-configuration){ .md-button target="_blank"}
29+
[Writing Portable Configurations :fontawesome-solid-database:](https://kubernetes.io/docs/concepts/storage/persistent-volumes/#writing-portable-configuration){ .md-button target="_blank"}
3130

32-
[Configuring Persistent Volume Storage :fontawesome-solid-globe:](https://kubernetes.io/docs/tasks/configure-pod-container/configure-persistent-volume-storage/){ .md-button target="_blank"}
31+
[Configuring Persistent Volume Storage :fontawesome-solid-database:](https://kubernetes.io/docs/tasks/configure-pod-container/configure-persistent-volume-storage/){ .md-button target="_blank"}
3332

3433
## References
3534

@@ -69,16 +68,21 @@ metadata:
6968
name: my-pod
7069
spec:
7170
containers:
72-
- name: nginx
73-
image: busybox
74-
command: ['sh', '-c', 'echo $(date):$HOSTNAME Hello Kubernetes! >> /mnt/data/message.txt && sleep 3600']
75-
volumeMounts:
76-
- mountPath: "/mnt/data"
77-
name: my-data
71+
- name: nginx
72+
image: busybox
73+
command:
74+
[
75+
"sh",
76+
"-c",
77+
"echo $(date):$HOSTNAME Hello Kubernetes! >> /mnt/data/message.txt && sleep 3600",
78+
]
79+
volumeMounts:
80+
- mountPath: "/mnt/data"
81+
name: my-data
7882
volumes:
79-
- name: my-data
80-
persistentVolumeClaim:
81-
claimName: my-pvc
83+
- name: my-data
84+
persistentVolumeClaim:
85+
claimName: my-pvc
8286
```
8387
8488
=== "OpenShift"
@@ -103,4 +107,4 @@ spec:
103107

104108
``` Bash title="Get the Persistent Volume Claims"
105109
kubectl get pvc
106-
```
110+
```

docs/openshift/state-persistence/volumes.md

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,11 @@ A Kubernetes volume, on the other hand, has an explicit lifetime - the same as t
1010

1111
=== "OpenShift"
1212

13-
[Volume Lifecycle :fontawesome-solid-globe:](https://docs.openshift.com/container-platform/4.13/storage/understanding-persistent-storage.html#lifecycle-volume-claim_understanding-persistent-storage){ .md-button target="_blank"}
13+
[Volume Lifecycle :fontawesome-solid-database:](https://docs.openshift.com/container-platform/4.13/storage/understanding-persistent-storage.html#lifecycle-volume-claim_understanding-persistent-storage){ .md-button target="_blank"}
1414

1515
=== "Kubernetes"
1616

17-
[Volumes :fontawesome-solid-globe:](https://kubernetes.io/docs/concepts/storage/volumes/){ .md-button target="_blank"}
18-
17+
[Volumes :fontawesome-solid-database:](https://kubernetes.io/docs/concepts/storage/volumes/){ .md-button target="_blank"}
1918

2019
## References
2120

@@ -26,15 +25,15 @@ metadata:
2625
name: my-pod
2726
spec:
2827
containers:
29-
- image: busybox
30-
command: ['sh', '-c', 'echo Hello Kubernetes! && sleep 3600']
31-
name: busybox
32-
volumeMounts:
33-
- mountPath: /cache
34-
name: cache-volume
28+
- image: busybox
29+
command: ["sh", "-c", "echo Hello Kubernetes! && sleep 3600"]
30+
name: busybox
31+
volumeMounts:
32+
- mountPath: /cache
33+
name: cache-volume
3534
volumes:
36-
- name: cache-volume
37-
emptyDir: {}
35+
- name: cache-volume
36+
emptyDir: {}
3837
```
3938
4039
```yaml
@@ -44,16 +43,16 @@ metadata:
4443
name: test-pd
4544
spec:
4645
containers:
47-
- image: bitnami/nginx
48-
name: test-container
49-
volumeMounts:
50-
- mountPath: /test-pd
51-
name: test-volume
46+
- image: bitnami/nginx
47+
name: test-container
48+
volumeMounts:
49+
- mountPath: /test-pd
50+
name: test-volume
5251
volumes:
53-
- name: test-volume
54-
hostPath:
55-
# directory location on host
56-
path: /data
57-
# this field is optional
58-
type: Directory
59-
```
52+
- name: test-volume
53+
hostPath:
54+
# directory location on host
55+
path: /data
56+
# this field is optional
57+
type: Directory
58+
```

0 commit comments

Comments
 (0)