10.2. 애플리케이션을 사용하여 Multicloud Object Gateway에 액세스
AWS S3을 대상으로 하는 모든 애플리케이션 또는 AWS S3 Software Development Kit(SDK)를 사용하는 코드를 사용하여 오브젝트 서비스에 액세스할 수 있습니다. 애플리케이션은 MCG 끝점, 액세스 키 및 시크릿 액세스 키를 지정해야 합니다. 터미널 또는 MCG CLI를 사용하여 이 정보를 검색할 수 있습니다.
사전 요구 사항
- 실행 중인 OpenShift Container Storage Platform
더 쉽게 관리 할 수 있도록 MCG 명령줄 인터페이스를 다운로드하십시오.
# subscription-manager repos --enable=rh-ocs-4-for-rhel-8-x86_64-rpms # yum install mcg
참고서브스크립션 관리자를 사용하여 리포지토리를 활성화하기 위한 적절한 아키텍처를 지정합니다. 예를 들면 다음과 같습니다.
- IBM Power Systems의 경우 다음 명령을 사용합니다.
# subscription-manager repos --enable=rh-ocs-4-for-rhel-8-ppc64le-rpms
- IBM Z 인프라의 경우 다음 명령을 사용합니다.
# subscription-manager repos --enable=rh-ocs-4-for-rhel-8-s390x-rpms
- 참고
아키텍처에 따라 올바른 제품 변형을 선택합니다.
다음 두 가지 방법으로 관련 끝점, 액세스 키 및 시크릿 액세스 키에 액세스할 수 있습니다.
- 10.2.1절. “터미널에서 Multicloud Object Gateway에 액세스”
10.2.2절. “MCG 명령줄 인터페이스에서 Multicloud Object Gateway에 액세스”
- 가상 호스팅 스타일을 사용하여 MCG 버킷 액세스
예 10.1. 예제
클라이언트 애플리케이션이 https://<bucket-name>.s3-openshift-storage.apps.mycluster-cluster.qe.rh-ocs.com에 액세스하려고 하는 경우
여기서
<bucket-name>
은 MCG 버킷의 이름입니다.예: https://mcg-test-bucket.s3-openshift-storage.apps.mycluster-cluster.qe.rh-ocs.com
mcg-test-bucket.s3-openshift-storage.apps.mycluster-cluster.qe.rh-ocs.com
에서 S3 서비스를 가리키려면 DNS 항목이 필요합니다.
클라이언트 애플리케이션이 가상 호스팅 스타일을 사용하여 MCG 버킷을 가리키도록 DNS 항목이 있는지 확인합니다.
10.2.1. 터미널에서 Multicloud Object Gateway에 액세스
절차
describe
명령을 실행하여 액세스 키(AWS_ACCESS_KEY_ID 값) 및 시크릿 액세스 키(AWS_SECRET_ACCESS_KEY
값)를 포함하여 MCG 끝점에 대한 정보를 봅니다.
# oc describe noobaa -n openshift-storage
출력은 다음과 유사합니다.
Name: noobaa Namespace: openshift-storage Labels: <none> Annotations: <none> API Version: noobaa.io/v1alpha1 Kind: NooBaa Metadata: Creation Timestamp: 2019-07-29T16:22:06Z Generation: 1 Resource Version: 6718822 Self Link: /apis/noobaa.io/v1alpha1/namespaces/openshift-storage/noobaas/noobaa UID: 019cfb4a-b21d-11e9-9a02-06c8de012f9e Spec: Status: Accounts: Admin: Secret Ref: Name: noobaa-admin Namespace: openshift-storage Actual Image: noobaa/noobaa-core:4.0 Observed Generation: 1 Phase: Ready Readme: Welcome to NooBaa! ----------------- Welcome to NooBaa! ----------------- NooBaa Core Version: NooBaa Operator Version: Lets get started: 1. Connect to Management console: Read your mgmt console login information (email & password) from secret: "noobaa-admin". kubectl get secret noobaa-admin -n openshift-storage -o json | jq '.data|map_values(@base64d)' Open the management console service - take External IP/DNS or Node Port or use port forwarding: kubectl port-forward -n openshift-storage service/noobaa-mgmt 11443:443 & open https://localhost:11443 2. Test S3 client: kubectl port-forward -n openshift-storage service/s3 10443:443 & 1 NOOBAA_ACCESS_KEY=$(kubectl get secret noobaa-admin -n openshift-storage -o json | jq -r '.data.AWS_ACCESS_KEY_ID|@base64d') 2 NOOBAA_SECRET_KEY=$(kubectl get secret noobaa-admin -n openshift-storage -o json | jq -r '.data.AWS_SECRET_ACCESS_KEY|@base64d') alias s3='AWS_ACCESS_KEY_ID=$NOOBAA_ACCESS_KEY AWS_SECRET_ACCESS_KEY=$NOOBAA_SECRET_KEY aws --endpoint https://localhost:10443 --no-verify-ssl s3' s3 ls Services: Service Mgmt: External DNS: https://noobaa-mgmt-openshift-storage.apps.mycluster-cluster.qe.rh-ocs.com https://a3406079515be11eaa3b70683061451e-1194613580.us-east-2.elb.amazonaws.com:443 Internal DNS: https://noobaa-mgmt.openshift-storage.svc:443 Internal IP: https://172.30.235.12:443 Node Ports: https://10.0.142.103:31385 Pod Ports: https://10.131.0.19:8443 serviceS3: External DNS: 3 https://s3-openshift-storage.apps.mycluster-cluster.qe.rh-ocs.com https://a340f4e1315be11eaa3b70683061451e-943168195.us-east-2.elb.amazonaws.com:443 Internal DNS: https://s3.openshift-storage.svc:443 Internal IP: https://172.30.86.41:443 Node Ports: https://10.0.142.103:31011 Pod Ports: https://10.131.0.19:6443
oc describe noobaa
명령의 출력에는 사용 가능한 내부 및 외부 DNS 이름이 나열됩니다. 내부 DNS를 사용하는 경우 트래픽은 사용 가능합니다. 외부 DNS는 Load Balancing을 사용하여 트래픽을 처리하므로 시간당 비용이 있습니다.