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.7.2. Ingress Controller シャーディングのルート作成
ルートを使用すると、URL でアプリケーションをホストできます。この場合、ホスト名は設定されず、ルートは代わりにサブドメインを使用します。サブドメインを指定すると、ルートを公開する Ingress Controller のドメインが自動的に使用されます。ルートが複数の Ingress Controller によって公開されている状況では、ルートは複数の URL でホストされます。
以下の手順では、例として hello-openshift
アプリケーションを使用して、Ingress Controller シャーディングのルートを作成する方法について説明します。
Ingress Controller のシャード化は、一連の Ingress Controller 間で着信トラフィックの負荷を分散し、トラフィックを特定の Ingress Controller に分離する際に役立ちます。たとえば、Company A のトラフィックをある Ingress Controller に指定し、Company B を別の Ingress Controller に指定できます。
前提条件
-
OpenShift CLI (
oc
) がインストールされている。 - プロジェクト管理者としてログインしている。
- あるポートを公開する Web アプリケーションと、そのポートでトラフィックをリッスンする HTTP または TCP エンドポイントがある。
- シャーディング用に Ingress Controller を設定している。
手順
次のコマンドを実行して、
hello-openshift
というプロジェクトを作成します。oc new-project hello-openshift
$ oc new-project hello-openshift
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 以下のコマンドを実行してプロジェクトに Pod を作成します。
oc create -f https://raw.githubusercontent.com/openshift/origin/master/examples/hello-openshift/hello-pod.json
$ oc create -f https://raw.githubusercontent.com/openshift/origin/master/examples/hello-openshift/hello-pod.json
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 以下のコマンドを実行して、
hello-openshift
というサービスを作成します。oc expose pod/hello-openshift
$ oc expose pod/hello-openshift
Copy to Clipboard Copied! Toggle word wrap Toggle overflow hello-openshift-route.yaml
というルート定義を作成します。シャーディング用に作成されたルートの YAML 定義:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 次のコマンドを実行し、
hello-openshift-route.yaml
を使用してhello-openshift
アプリケーションへのルートを作成します。oc -n hello-openshift create -f hello-openshift-route.yaml
$ oc -n hello-openshift create -f hello-openshift-route.yaml
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
検証
次のコマンドを使用して、ルートのステータスを取得します。
oc -n hello-openshift get routes/hello-openshift-edge -o yaml
$ oc -n hello-openshift get routes/hello-openshift-edge -o yaml
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 結果の
Route
リソースは次のようになります。出力例
Copy to Clipboard Copied! Toggle word wrap Toggle overflow