2.3.5.6. namespace ラベルを使用した Ingress Controller のシャーディングの設定
名前空間ラベルを使用すると、Ingress Controller のシャーディングを設定して、名前空間セレクターによって選択された任意の名前空間内の任意のルートを Ingress Controller が処理するようにすることができます。
図2.2 名前空間ラベルを使用したイングレスのシャーディング
Ingress Controller のシャーディングは、一連の Ingress Controller 間で着信トラフィックの負荷を分散し、トラフィックを特定の Ingress Controller に分離する際に役立ちます。たとえば、Company A のトラフィックをある Ingress Controller に指定し、Company B を別の Ingress Controller に指定できます。
手順
router-internal.yamlファイルを編集します。$ cat router-internal.yaml出力例
apiVersion: operator.openshift.io/v1 kind: IngressController metadata: name: sharded namespace: openshift-ingress-operator spec: domain: <apps-sharded.basedomain.example.net> nodePlacement: nodeSelector: matchLabels: node-role.kubernetes.io/worker: "" namespaceSelector: matchLabels: type: sharded-
<apps-sharded.basedomain.example.net>: Ingress Controller で使用するドメインを指定します。このドメインは、デフォルトの Ingress Controller ドメインとは異なる必要があります。
-
Ingress Controller の
router-internal.yamlファイルを適用します。$ oc apply -f router-internal.yamlIngress Controller は、
type: shardedというラベルのある namespace セレクターによって選択される namespace のルートを選択します。router-internal.yamlで設定されたドメインを使用して、新しいルートを作成します。$ oc expose svc <service-name> --hostname <route-name>.apps-sharded.basedomain.example.net