Exercise 8.3: Creating a Persistent Volume Claim (PVC)
CP 노드에 연결된 터미널로 이동
생성된 PVC가 있는지 확인
kubectl get pvc
PVC 생성
cat <<EOF | kubectl create -f - apiVersion: v1 kind: PersistentVolumeClaim metadata: name: pvc-one spec: accessModes: - ReadWriteMany resources: requests: storage: 200Mi EOF
생성된 PVC 확인
kubectl get pvc pvc-one
이전 실습에서 생성된 PV 확인
kubectl get pv nfs
Deployment 생성
cat <<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 EOF
생성된 Pod 확인
kubectl get pod -l run=nginx
생성된 Pod 상세 내용 확인
kubectl describe pod POD_NAME
OR
kubectl describe pod $(kubectl get pod -l run=nginx -o=jsonpath='{.items[0].metadata.name}')
Pod가 생성되지 않을 경우에는 이유를 찾아서 고치세요
PVC 상태 확인
kubectl get pvc pvc-one
Last updated