Share Your AWS re:Post Experience - Quick 3 Question Survey and Earn a re:Post Badge
Help us improve AWS re:Post! We're interested in understanding how you use re:Post and its impact on your AWS journey. Please take a moment to complete our brief 3-question survey
암호화된 Amazon EFS 파일 시스템을 Amazon EKS의 포드에 마운트하려면 어떻게 해야 하나요?
암호화된 Amazon Elastic File System(Amazon EFS) 파일 시스템을 Amazon Elastic Kubernetes Service(Amazon EKS) 의 포드에 마운트하려고 합니다.
간략한 설명
TLS로 전송 중이거나 저장 중인 데이터를 암호화할 수 있습니다.
참고: AWS Command Line Interface(AWS CLI) 명령 실행 시 오류가 발생하는 경우, AWS CLI 오류 문제 해결을 참고하세요. 또한 최신 AWS CLI 버전을 사용하고 있는지 확인하세요.
해결 방법
TLS로 전송 중인 데이터 암호화
TLS로 전송 중인 데이터를 암호화하려면 다음 단계를 완료하세요.
-
Amazon EKS 클러스터용 Amazon EFS 컨테이너 스토리지 인터페이스(CSI) 드라이버를 배포합니다.
-
클러스터를 암호화하지 않고 Amazon EFS 파일 시스템을 생성합니다.
참고: 파일 시스템을 생성할 때 EKS 노드가 위치한 모든 가용 영역에서 Amazon EFS에 대한 마운트 대상을 생성합니다. -
GitHub 리포지토리를 로컬 시스템에 복제합니다.
git clone https://github.com/kubernetes-sigs/aws-efs-csi-driver.git
-
encryption_in_transit 예제 디렉터리로 이동합니다.
cd aws-efs-csi-driver/examples/kubernetes/encryption_in_transit/
-
Amazon EFS 파일 시스템 ID를 검색합니다.
aws efs describe-file-systems --query "FileSystems[*].FileSystemId" --output text
-
/examples/kubernetes/encryption_in_transit/specs/ 디렉터리에 있는 pv.yaml 파일로 이동합니다. 그런 다음 VolumeHandle 값을 마운트하려는 Amazon EFS 파일 시스템의 FileSystemId로 바꿉니다. 예를 들면, 다음과 같습니다.
apiVersion: v1 kind: PersistentVolume metadata: name: efs-pv spec: capacity: storage: 5Gi volumeMode: Filesystem accessModes: - ReadWriteOnce persistentVolumeReclaimPolicy: Retain storageClassName: efs-sc csi: driver: efs.csi.aws.com volumeHandle: [FileSystemId] volumeAttributes: encryptInTransit: "true"
참고: volumeAttributes: encryptInTransit 마운트 옵션은 전송 중 암호화를 활성화합니다.
-
/examples/kubernetes/encryption_in_transit/specs/ 디렉터리에서 스토리지 클래스, 영구 볼륨 클레임, 영구 볼륨, 포드를 배포합니다.
kubectl apply -f specs/storageclass.yaml kubectl apply -f specs/pv.yaml kubectl apply -f specs/claim.yaml kubectl apply -f specs/pod.yaml
-
포드가 실행 상태인지 확인합니다.
kubectl get pods
-
기본 네임스페이스의 영구 볼륨을 나열합니다.
kubectl get pv
-
영구 볼륨에 대해 설명합니다.
kubectl describe pv efs-pv
참고: Amazon EFS 파일 시스템 ID는 VolumeHandle로 표시됩니다. 데이터가 Amazon EFS 파일 시스템에 기록되었는지 확인합니다.
kubectl exec -ti efs-app -- tail -f /data/out.txt
저장 데이터 암호화
저장 데이터를 암호화하려면 다음 단계를 완료하세요.
-
아마존 EKS 클러스터용 Amazon EFS CSI 드라이버를 배포합니다.
-
Amazon EKS 클러스터에 대해 저장 시 암호화를 켜서 Amazon EFS 파일 시스템을 생성합니다.
-
다음 GitHub 리포지토리를 로컬 시스템에 복제합니다.
git clone https://github.com/kubernetes-sigs/aws-efs-csi-driver.git
-
multiple_pods 예제 디렉터리로 이동합니다.
cd aws-efs-csi-driver/examples/kubernetes/multiple_pods/
-
Amazon EFS 파일 시스템 ID를 검색합니다.
aws efs describe-file-systems
출력 예시:
{ "FileSystems": [ { "SizeInBytes": { "Timestamp": , "Value": }, "ThroughputMode": "", "CreationToken": "", "Encrypted": true, "CreationTime": , "PerformanceMode": "", "FileSystemId": "[FileSystemId]", "NumberOfMountTargets": , "LifeCycleState": "available", "KmsKeyId": "arn:aws:kms:ap-southeast-1:<account_id>:key/854df848-fdd1-46e3-ab97-b4875c4190e6", "OwnerId": "" }, ] }
-
/examples/kubernetes/multiple_pods/specs/ 디렉터리에 있는 pv.yaml 파일로 이동합니다. 그런 다음 volumeHandle 값을 마운트하려는 Amazon EFS 파일 시스템의 FileSystemId로 바꿉니다. 예를 들면, 다음과 같습니다.
apiVersion: v1 kind: PersistentVolume metadata: name: efs-pv spec: capacity: storage: 5Gi volumeMode: Filesystem accessModes: - ReadWriteMany persistentVolumeReclaimPolicy: Retain storageClassName: efs-sc csi: driver: efs.csi.aws.com volumeHandle: [FileSystemId]
-
/examples/kubernetes/multiple\ _pods/specs/ 디렉터리에서 스토리지 클래스, 영우 볼륨 클레임, 영구 볼륨 및 포드를 배포합니다.
kubectl apply -f specs/storageclass.yaml kubectl apply -f specs/pv.yaml kubectl apply -f specs/claim.yaml kubectl apply -f specs/pod1.yaml kubectl apply -f specs/pod2.yaml
-
포드가 실행 상태인지 확인합니다.
kubectl get pods
-
기본 네임스페이스의 영구 볼륨을 나열합니다.
kubectl get pv
-
영구 볼륨에 대해 설명합니다.
kubectl describe pv efs-pv
- 데이터가 Amazon EFS 파일 시스템에 기록되었는지 확인합니다.
kubectl exec -ti app1 -- tail /data/out1.txt kubectl exec -ti app2 -- tail /data/out1.txt

관련 콘텐츠
- 질문됨 2년 전lg...
- 질문됨 7달 전lg...
- 질문됨 4달 전lg...
- AWS 공식업데이트됨 9달 전
- AWS 공식업데이트됨 2년 전