forked from ContainerSolutions/kubernetes-examples
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added an extra PersistentVolumeClaim folder and fixed suggestions fro…
…m Ian
- Loading branch information
Showing
4 changed files
with
29 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
See: https://kubernetes.io/docs/concepts/storage/persistent-volumes/#persistentvolumeclaims | ||
|
||
You can test a local `PersistentVolume` and a `PersistentVolumeClaim` with the following files. (this example was tested on a docker-desktop kubernetes cluster) | ||
|
||
1 - Create a `PersistentVolume` on your host monted on a local directory (add an `index.html` file in that directory with a hello world message) | ||
`kubectl apply -f ./PersistentVolume/spec.local/local.yaml` | ||
|
||
2 - Create the `PersitentVolumeClaim` | ||
`kubectl apply -f ./PersistentVolumeClaim/pvc.yaml` | ||
|
||
3 - Spin up a `Pod` with nginx poiting where its default root directory points to your host's directory | ||
`kubectl apply -f ./Pod/spec.volumes.persistentVolumeClaim/pod-pvc.yaml` | ||
|
||
4 - Port forward your `Pod` and access it with your browser. You should be able to see the `index.html` file from your local directory. | ||
`kubectl port-forward volume-pvc :80` | ||
|
||
|
||
Clean up | ||
``` | ||
kubectl delete -f ./Pod/spec.volumes.persistentVolumeClaim/pod-pvc.yaml | ||
kubectl delete -f ./PersistentVolumeClaim/pvc.yaml | ||
kubectl delete -f ./PersistentVolume/spec.local/local.yaml | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters