diff --git a/docs/openshift/state-persistence/index.md b/docs/openshift/state-persistence/index.md index 80fd0cb..ce47e81 100644 --- a/docs/openshift/state-persistence/index.md +++ b/docs/openshift/state-persistence/index.md @@ -1,15 +1,16 @@ # State Persistence -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. +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. -## Resources +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. +## Resources -[Volumes :fontawesome-solid-globe:](https://kubernetes.io/docs/concepts/storage/volumes/){ .md-button target="_blank"} +[Volumes :fontawesome-solid-database:](https://kubernetes.io/docs/concepts/storage/volumes/){ .md-button target="\_blank"} -[Persistent Volumes :fontawesome-solid-globe:](https://kubernetes.io/docs/concepts/storage/persistent-volumes/){ .md-button target="_blank"} +[Persistent Volumes :fontawesome-solid-database:](https://kubernetes.io/docs/concepts/storage/persistent-volumes/){ .md-button target="\_blank"} -[Persistent Volume Claims :fontawesome-solid-globe:](https://kubernetes.io/docs/concepts/storage/persistent-volumes/#persistentvolumeclaims){ .md-button target="_blank"} +[Persistent Volume Claims :fontawesome-solid-database:](https://kubernetes.io/docs/concepts/storage/persistent-volumes/#persistentvolumeclaims){ .md-button target="\_blank"} ## References @@ -25,16 +26,15 @@ spec: requests: storage: 1Gi ``` -In this example, we define a PVC named my-pvc with the following specifications: -accessModes specify that the volume can be mounted as read-write by a single node at a time (ReadWriteOnce). -resources.requests.storage specifies the requested storage size for the PVC (1Gi). +In this example, we define a PVC named _my-pvc_ with the following specifications: +- _accessModes_ specify that the volume can be mounted as read-write by a single node at a time ("ReadWriteOnce") +- _resources.requests.storage_ specifies the requested storage size for the PVC ("1Gi") ## Activities -| Task | Description | Link | -| --------------------------------| ------------------ |:----------- | -| *** Try It Yourself *** | | +| Task | Description | Link | +| ----------------------------- | ------------------------------------------------------------ | :-------------------------------------------------------------------- | +| **_Try It Yourself_** | | | Setting up Persistent Volumes | Create a Persistent Volume that's accessible from a SQL Pod. | [Setting up Persistent Volumes](../../labs/kubernetes/lab10/index.md) | - diff --git a/docs/openshift/state-persistence/pv-pvc.md b/docs/openshift/state-persistence/pv-pvc.md index 9aefec3..5e249ea 100644 --- a/docs/openshift/state-persistence/pv-pvc.md +++ b/docs/openshift/state-persistence/pv-pvc.md @@ -12,24 +12,23 @@ Pods access storage by using the claim as a volume. Claims must exist in the sam PersistentVolumes binds are exclusive, and since PersistentVolumeClaims are namespaced objects, mounting claims with “Many” modes (ROX, RWX) is only possible within one namespace. - - ## Resources + === "OpenShift" - [Persistent Storage :fontawesome-solid-globe:](https://docs.openshift.com/container-platform/4.13/storage/understanding-persistent-storage.html){ .md-button target="_blank"} + [Persistent Storage :fontawesome-solid-database:](https://docs.openshift.com/container-platform/4.13/storage/understanding-persistent-storage.html){ .md-button target="_blank"} - [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"} + [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"} - [Expanding Peristent Volumes :fontawesome-solid-globe:](https://docs.openshift.com/container-platform/4.13/storage/expanding-persistent-volumes.html){ .md-button target="_blank"} + [Expanding Peristent Volumes :fontawesome-solid-database:](https://docs.openshift.com/container-platform/4.13/storage/expanding-persistent-volumes.html){ .md-button target="_blank"} === "Kubernetes" - [Persistent Volumes :fontawesome-solid-globe:](https://kubernetes.io/docs/concepts/storage/persistent-volumes/){ .md-button target="_blank"} + [Persistent Volumes :fontawesome-solid-database:](https://kubernetes.io/docs/concepts/storage/persistent-volumes/){ .md-button target="_blank"} - [Writing Portable Configurations :fontawesome-solid-globe:](https://kubernetes.io/docs/concepts/storage/persistent-volumes/#writing-portable-configuration){ .md-button target="_blank"} + [Writing Portable Configurations :fontawesome-solid-database:](https://kubernetes.io/docs/concepts/storage/persistent-volumes/#writing-portable-configuration){ .md-button target="_blank"} - [Configuring Persistent Volume Storage :fontawesome-solid-globe:](https://kubernetes.io/docs/tasks/configure-pod-container/configure-persistent-volume-storage/){ .md-button target="_blank"} + [Configuring Persistent Volume Storage :fontawesome-solid-database:](https://kubernetes.io/docs/tasks/configure-pod-container/configure-persistent-volume-storage/){ .md-button target="_blank"} ## References @@ -69,16 +68,21 @@ metadata: name: my-pod spec: containers: - - name: nginx - image: busybox - command: ['sh', '-c', 'echo $(date):$HOSTNAME Hello Kubernetes! >> /mnt/data/message.txt && sleep 3600'] - volumeMounts: - - mountPath: "/mnt/data" - name: my-data + - name: nginx + image: busybox + command: + [ + "sh", + "-c", + "echo $(date):$HOSTNAME Hello Kubernetes! >> /mnt/data/message.txt && sleep 3600", + ] + volumeMounts: + - mountPath: "/mnt/data" + name: my-data volumes: - - name: my-data - persistentVolumeClaim: - claimName: my-pvc + - name: my-data + persistentVolumeClaim: + claimName: my-pvc ``` === "OpenShift" @@ -103,4 +107,4 @@ spec: ``` Bash title="Get the Persistent Volume Claims" kubectl get pvc - ``` \ No newline at end of file + ``` diff --git a/docs/openshift/state-persistence/volumes.md b/docs/openshift/state-persistence/volumes.md index 086aafa..a64b8a2 100644 --- a/docs/openshift/state-persistence/volumes.md +++ b/docs/openshift/state-persistence/volumes.md @@ -10,12 +10,11 @@ A Kubernetes volume, on the other hand, has an explicit lifetime - the same as t === "OpenShift" - [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"} + [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"} === "Kubernetes" - [Volumes :fontawesome-solid-globe:](https://kubernetes.io/docs/concepts/storage/volumes/){ .md-button target="_blank"} - + [Volumes :fontawesome-solid-database:](https://kubernetes.io/docs/concepts/storage/volumes/){ .md-button target="_blank"} ## References @@ -26,15 +25,15 @@ metadata: name: my-pod spec: containers: - - image: busybox - command: ['sh', '-c', 'echo Hello Kubernetes! && sleep 3600'] - name: busybox - volumeMounts: - - mountPath: /cache - name: cache-volume + - image: busybox + command: ["sh", "-c", "echo Hello Kubernetes! && sleep 3600"] + name: busybox + volumeMounts: + - mountPath: /cache + name: cache-volume volumes: - - name: cache-volume - emptyDir: {} + - name: cache-volume + emptyDir: {} ``` ```yaml @@ -44,16 +43,16 @@ metadata: name: test-pd spec: containers: - - image: bitnami/nginx - name: test-container - volumeMounts: - - mountPath: /test-pd - name: test-volume + - image: bitnami/nginx + name: test-container + volumeMounts: + - mountPath: /test-pd + name: test-volume volumes: - - name: test-volume - hostPath: - # directory location on host - path: /data - # this field is optional - type: Directory -``` \ No newline at end of file + - name: test-volume + hostPath: + # directory location on host + path: /data + # this field is optional + type: Directory +```