This documentation is for a release that is no longer maintained
See documentation for the latest supported version 3 or the latest supported version 4.2.6.5. 2 つのコンポーネントのリンク
クラスターで実行されるコンポーネントは、対話するために接続される必要があります。OpenShift Container Platform は、リンクの仕組みを提供し、プログラムからクライアントへの通信バインディングを公開します。
手順
クラスターで実行されるすべてのコンポーネントの一覧を表示します。
odo list
$ odo listCopy to Clipboard Copied! Toggle word wrap Toggle overflow 出力例
OpenShift Components: APP NAME PROJECT TYPE SOURCETYPE STATE app backend testpro openjdk18 binary Pushed app frontend testpro nodejs local Pushed
OpenShift Components: APP NAME PROJECT TYPE SOURCETYPE STATE app backend testpro openjdk18 binary Pushed app frontend testpro nodejs local PushedCopy to Clipboard Copied! Toggle word wrap Toggle overflow 現在のフロントエンドコンポーネントをバックエンドにリンクします。
odo link backend --port 8080
$ odo link backend --port 8080Copy to Clipboard Copied! Toggle word wrap Toggle overflow 出力例
✓ Component backend has been successfully linked from the component frontend Following environment variables were added to frontend component: - COMPONENT_BACKEND_HOST - COMPONENT_BACKEND_PORT
✓ Component backend has been successfully linked from the component frontend Following environment variables were added to frontend component: - COMPONENT_BACKEND_HOST - COMPONENT_BACKEND_PORTCopy to Clipboard Copied! Toggle word wrap Toggle overflow バックエンドコンポーネントの設定情報がフロントエンドコンポーネントに追加され、フロントエンドコンポーネントが再起動します。