Exercise 8.3: Creating a Persistent Volume Claim (PVC)
kubectl get pvccat <<EOF | kubectl create -f - apiVersion: v1 kind: PersistentVolumeClaim metadata: name: pvc-one spec: accessModes: - ReadWriteMany resources: requests: storage: 200Mi EOFkubectl get pvc pvc-onekubectl get pv nfscat <<EOF | kubectl create -f - apiVersion: apps/v1 kind: Deployment metadata: labels: run: nginx name: nginx-nfs spec: selector: matchLabels: run: nginx template: metadata: labels: run: nginx spec: containers: - image: nginx imagePullPolicy: Always name: nginx volumeMounts: - name: nfs-vol mountPath: /opt ports: - containerPort: 80 protocol: TCP volumes: - name: nfs-vol persistentVolumeClaim: claimName: pvc-one EOFkubectl get pod -l run=nginxkubectl describe pod POD_NAMEkubectl describe pod $(kubectl get pod -l run=nginx -o=jsonpath='{.items[0].metadata.name}')kubectl get pvc pvc-one
Last updated