A newer release of this product is available.
Deploy sample application
Suggest changes
Deploy sample application.
Steps
-
Mount the volume in a pod.
kubectl create -f pv-pod.yaml
These examples show basic configurations to attach the PVC to a pod:
Basic configuration:kind: Pod apiVersion: v1 metadata: name: pv-pod spec: volumes: - name: pv-storage persistentVolumeClaim: claimName: basic containers: - name: pv-container image: nginx ports: - containerPort: 80 name: "http-server" volumeMounts: - mountPath: "/my/mount/path" name: pv-storage
You can monitor the progress using kubectl get pod --watch
. -
Verify that the volume is mounted on
/my/mount/path
.kubectl exec -it task-pv-pod -- df -h /my/mount/path
Filesystem Size Used Avail Use% Mounted on 192.168.188.78:/trident_pvc_ae45ed05_3ace_4e7c_9080_d2a83ae03d06 1.1G 320K 1.0G 1% /my/mount/path
-
You can now delete the Pod. The Pod application will no longer exist, but the volume will remain.
kubectl delete pod task-pv-pod