चरण 1 - OCI CLI में लॉगिन करें
जब OCI CLI इंस्टॉल हो जाता है, तब दो प्राथमिक प्रमाणीकरण विधियाँ उपलब्ध होती हैं।
-
की पेयर आधारित प्रमाणीकरण
- CI और CD pipelines जैसे automation scenarios के लिए अनुशंसित
- दस्तावेज़ीकरण
-
टोकन आधारित प्रमाणीकरण
- लोकल डेवलपमेंट के लिए अनुशंसित
- दस्तावेज़ीकरण
अनुशंसित तरीका यह है कि लोकल डेवलपमेंट के लिए टोकन आधारित प्रमाणीकरण और CI और CD pipelines जैसे automation scenarios के लिए की पेयर आधारित प्रमाणीकरण का उपयोग किया जाए।
प्रमाणीकरण
-
टोकन-आधारित authentication के लिए OCI CLI को configure करने हेतु, नीचे दिए गए commands चलाएँ। यदि आपको कोई समस्या आती है, तो अतिरिक्त मार्गदर्शन के लिए linked documentation देखें। ध्यान दें कि
gworacleOracle Cloud में उपयोग किया गया tenant name है। -
oci session authenticatecommand चलाने के बाद, आपसे एक profile name दर्ज करने के लिए कहा जाएगा। default profile configuration में निर्दिष्ट वही profile name उपयोग करें,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
अपने session को authenticate करने के बाद, आपको नीचे दिए गए जैसा output मिलना चाहिए:
# 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 context सेट करें:
# 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 settings को आपकी Kubernetes configuration file में मर्ज कर देगा (जो आमतौर पर
~/.kube/configfile में संग्रहीत होती है)।