OTCS 데이터를 위한 NFS 마운트 절차 정리
실제는 NFS PVC만 생성하고 myvaluse2.yaml에 추가함
1. NFS PVC 생성
1) PVC YAML 작성
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: otmm-nfs-pvc # PVC 이름 (원하는 이름)
namespace: ecm # 네임스페이스
spec:
accessModes:
- ReadWriteMany
resources:
requests:
storage: 20Gi # 필요 용량
storageClassName: otmm-nfs # NFS StorageClass 이름 (환경에 맞게)
2) PVC 생성
kubectl apply -f otmm-nfs-pvc.yaml -n ecm
2. 내 Pod가 어떤 리소스(StatefulSet/Deployment)에서 만들어졌는지 찾기
1) 관심 있는 Pod 이름 확인
예: otcs-frontend-0
2) 소속 리소스 찾기
kubectl get pod otcs-frontend-0 -n ecm -o yaml | grep ownerReferences -A 10
"kind": "StatefulSet"또는"kind": "Deployment""name": "otcs-frontend"등이 보이면, 그 리소스가 생성자임
3. 해당 리소스(StatefulSet/Deployment) YAML 추출
kubectl get statefulset otcs-frontend -n ecm -o yaml > external-storage_tmp.yaml
# 또는 Deployment라면
kubectl get deployment <이름> -n <네임스페이스> -o yaml > external-storage.yaml
4. PVC 마운트 정보 추가
1) volumeMounts 에 추가 (컨테이너 아래)
- mountPath: /mnt/extshared
name: extshared-storage
2) volumes 에 추가 (spec.template.spec.volumes 아래)
- name: extshared-storage
persistentVolumeClaim:
claimName: otmm-nfs-pvc # PVC 이름에 맞게
5. 적용
kubectl apply -f external-storage.yaml -n ecm
- 적용 시 기존 Pod가 자동으로 재생성됨 (롤링 업데이트)
6. 컨테이너에서 마운트 확인
# NFS 마운트 확인
kubectl exec -it otcs-frontend-0 -n ecm -c otcs-frontend-container -- ls -la /mnt/extshared
- 정상적으로 마운트됐으면 폴더/파일 목록이 보임
7. Configuration Path 등록
Content Server에서 Configuration Path 등록 Pod에 마운트한 경로(/mnt/extshared)를 등록
참고. 생성된 storageclass 확인 및 삭제
kubectl get storageclass kubectl delete storageclass otmm-nfs kubectl delete pvc otmm-nfs-pvc -n ecm kubectl delete pvc otmm-nfs-pvc -n default
💡 추가 참고
- PVC 이름, StorageClass, 네임스페이스 등은 환경에 맞게 변경
- Helm Chart 사용 시에는 values.yaml 또는 템플릿에서 volumeMounts/volumes를 수정해야 함
-
Pod가 여러 개일 경우, 모든 Pod가 동일하게 마운트됨
-
단계 (현재): kubectl patch로 사전 테스트
cat <<EOF > nfs-patch.yaml
spec:
template:
spec:
containers:
- name: cs-server
volumeMounts:
- name: extshared-storage
mountPath: /mnt/extshared
volumes:
- name: extshared-storage
persistentVolumeClaim:
claimName: otmm-nfs-pvc
EOF
cat <<EOF > volumemount-patch.yaml
spec:
template:
spec:
containers:
- name: otcs-frontend-container
volumeMounts:
- name: extshared-storage
mountPath: /mnt/extshared
EOF
kubectl patch statefulset otcs-frontend -n ecm --patch-file nfs-patch.yaml
kubectl patch statefulset otcs-frontend -n ecm --patch-file volumemount-patch.yaml
-
단계: 테스트 성공 후 myvalues2.yaml에 정식 반영
-
단계: helm upgrade로 차트 기반 재배포 검증
이렇게 하면 Infrastructure as Code 방식으로 모든 설정이 차트에 포함