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.19.11. egress IP アドレスの割り当て
クラスター管理者は、namespace または namespace の特定の Pod からクラスターを出るトラフィックに egress IP アドレスを割り当てることができます。
19.11.1. egress IP アドレスの namespace への割り当て
1 つ以上の egress IP アドレスを namespace または namespace の特定の Pod に割り当てることができます。
前提条件
-
OpenShift CLI (
oc
) がインストールされている。 - クラスター管理者としてクラスターにログインします。
- egress IP アドレスをホストするように 1 つ以上のノードを設定します。
手順
EgressIP
オブジェクトを作成します。-
<egressips_name>.yaml
ファイルを作成します。<egressips_name>
はオブジェクトの名前になります。 作成したファイルで、以下の例のように
EgressIPs
オブジェクトを定義します。apiVersion: k8s.ovn.org/v1 kind: EgressIP metadata: name: egress-project1 spec: egressIPs: - 192.168.127.10 - 192.168.127.11 namespaceSelector: matchLabels: env: qa
apiVersion: k8s.ovn.org/v1 kind: EgressIP metadata: name: egress-project1 spec: egressIPs: - 192.168.127.10 - 192.168.127.11 namespaceSelector: matchLabels: env: qa
Copy to Clipboard Copied!
-
オブジェクトを作成するには、以下のコマンドを入力します。
oc apply -f <egressips_name>.yaml
$ oc apply -f <egressips_name>.yaml
1 Copy to Clipboard Copied! - 1
<egressips_name>
をオブジェクトの名前に置き換えます。
出力例
egressips.k8s.ovn.org/<egressips_name> created
egressips.k8s.ovn.org/<egressips_name> created
Copy to Clipboard Copied! -
オプション: 後に変更できるように
<egressips_name>.yaml
ファイルを保存します。 egress IP アドレスを必要とする namespace にラベルを追加します。手順 1 で定義した
Egress IP
オブジェクトの namespace にラベルを追加するには、以下のコマンドを実行します。oc label ns <namespace> env=qa
$ oc label ns <namespace> env=qa
1 Copy to Clipboard Copied! - 1
<namespace>
は、egress IP アドレスを必要とする namespace に置き換えてください。