1단계 - OCI CLI에 로그인
OCI CLI가 설치되면 사용할 수 있는 기본 인증 방법은 두 가지입니다.
권장되는 접근 방식은 로컬 개발에는 토큰 기반 인증을 사용하고, CI 및 CD 파이프라인과 같은 자동화 시나리오에는 키 쌍 기반 인증을 사용하는 것입니다.
인증
-
토큰 기반 인증을 위해 OCI CLI를 구성하려면 아래 명령을 실행하세요. 문제가 발생하면 추가 안내를 위해 링크된 문서를 참조하세요.
gworacle는 Oracle Cloud에서 사용되는 테넌트 이름입니다. -
oci session authenticate명령을 실행한 후 profile 이름을 입력하라는 메시지가 표시됩니다. 기본 profile 구성에 지정된 것과 동일한 profile 이름인oci_auth를 사용하세요.
export OCI_CLI_AUTH=security_token
mkdir -p $$HOME/.oci
cat << EOF > $$HOME/.oci/oci_cli_rc
[OCI_CLI_SETTINGS]
default_profile=oci_auth
EOF
oci session authenticate
세션 인증 후에는 아래와 유사한 출력이 표시되어야 합니다:
# Try out your newly created session credentials with the following example command:
oci iam region list --config-file $$HOME.oci\config --profile oci_auth --auth >security_token
However, you should able to run just
oci iam region listwithout the--profileand--authparameters since they were configured prior in the step above.
- 로그인한 후 다음 명령을 실행하여 Kubernetes 컨텍스트를 설정합니다:
# As our dev cluster is in uk-london-1 region
oracle_region=uk-london-1
oci ce cluster create-kubeconfig --cluster-id ${oke_cluster_ocid} --region >${oracle_region} --token-version 2.0.0
이렇게 하면 OKE 설정이 Kubernetes 구성 파일(일반적으로
~/.kube/config파일에 저장됨)에 병합됩니다.