Red Hat Training

A Red Hat training course is available for OpenShift Container Platform

5.3. 複数マスターの例

複数マスター、複数 etcd ホスト、複数ノードを含む環境を設定できます。高可用性 (HA) 対応複数マスター を設定すると、クラスターに単一障害点が設定されないようにすることができます。

注記

インストール後の単一マスタークラスターから複数マスターへの移行はサポートされていません。

複数マスターを設定する際には、クラスターインストールプロセスで ネイティブ 高可用性 (HA) メソッドがサポートされます。この方法は、OpenShift Container Platform に組み込まれているネイティブ HA マスター機能を活用するもので、 任意のロードバランシングソリューションと組み合わせことができます。

ホストがインベントリーファイルの [lb] セクションに定義されている場合、Ansible はロードバランシングソリューションとして HAProxy を自動的にインストールし、設定します。ホストが定義されていない場合、ユーザーが選択した外部のロードバランシングソリューションを事前に定義しており、マスター API (ポート 8443) をすべてのマスターホストで分散することが想定されます。

注記

この HAProxy ロードバランサーは、API サーバーの HA モードを実証することを意図したものであり、実稼働環境での使用には推奨されません。クラウドプロバイダーにデプロイする場合は、クラウドネイティブの TCP ベースのロードバランサーをデプロイするか、または高可用性ロードバランサーを提供するための他の手順を実行することを推奨します。

HAProxy ロードバランサーは、トラフィックを API サーバーへの負荷分散のためにのみ使用され、ユーザーアプリケーショントラフィックを負荷分散しません。

外部のロードバランシングソリューションを使用する場合は、以下が必要になります。

  • SSL パススルー対応に設定された、事前に作成されたロードバランサーの仮想 IP (VIP)
  • openshift_master_api_port 値 (デフォルトは 8443) で指定されたポートでリッスンし、そのポートですべてのマスターホストにプロキシー送信する VIP。
  • DNS に登録されている VIP のドメイン名。

    • このドメイン名は、OpenShift Container Platform インストーラーで openshift_master_cluster_public_hostnameopenshift_master_cluster_hostname の両方の値になります。

詳細については、External Load Balancer Integrations example in Github を参照してください。高可用性マスターアーキテクチャーの詳細については、Kubernetes Infrastructure を参照してください。

注記

現時点で、クラスターインストールプロセスはアクティブ/パッシブ設定の複数の HAProxy ロードバランサーをサポートしていません。インストール後の修正については、ロードバランサー管理ドキュメント を参照してください。

複数マスターを設定するには、複数 etcd を持つ複数マスター を参照してください。

5.3.1. 外部のクラスター化された etcd を含む、ネイティブ HA を使用した複数マスター

以下の表は、 ネイティブ HA 方法を使用する 3 つの マスター、1 つの HAProxy ロードバランサー、3 つの etcd ホスト、ユーザーアプリケーションをホストする 2 つのノード専用インフラストラクチャー をホストする node-role.kubernetes.io/infra=true ラベル付きの 2 つのノードの環境の例を示しています。

ホスト名インストールするインフラストラクチャー/ロール

master1.example.com

マスター (クラスター化、ネイティブ HA を使用) およびノード

master2.example.com

master3.example.com

lb.example.com

API マスターエンドポイントの負荷分散のみの HAProxy

etcd1.example.com

etcd

etcd2.example.com

etcd3.example.com

node1.example.com

コンピュートノード

node2.example.com

infra-node1.example.com

専用インフラストラクチャーノード

infra-node2.example.com

これらのサンプルホストは、以下のサンプルインベントリーファイルの [masters][etcd][lb] および [nodes] セクションに記載されています。

HAProxy インベントリーファイルを使用する複数マスター

# Create an OSEv3 group that contains the master, nodes, etcd, and lb groups.
# The lb group lets Ansible configure HAProxy as the load balancing solution.
# Comment lb out if your load balancer is pre-configured.
[OSEv3:children]
masters
nodes
etcd
lb

# Set variables common for all OSEv3 hosts
[OSEv3:vars]
ansible_ssh_user=root
openshift_deployment_type=openshift-enterprise

# uncomment the following to enable htpasswd authentication; defaults to DenyAllPasswordIdentityProvider
#openshift_master_identity_providers=[{'name': 'htpasswd_auth', 'login': 'true', 'challenge': 'true', 'kind': 'HTPasswdPasswordIdentityProvider'}]

# Native high availbility cluster method with optional load balancer.
# If no lb group is defined installer assumes that a load balancer has
# been preconfigured. For installation the value of
# openshift_master_cluster_hostname must resolve to the load balancer
# or to one or all of the masters defined in the inventory if no load
# balancer is present.
openshift_master_cluster_method=native
openshift_master_cluster_hostname=openshift-internal.example.com
openshift_master_cluster_public_hostname=openshift-cluster.example.com

# apply updated node defaults
openshift_node_groups=[{'name': 'node-config-all-in-one', 'labels': ['node-role.kubernetes.io/master=true', 'node-role.kubernetes.io/infra=true', 'node-role.kubernetes.io/compute=true'], 'edits':}]

# host group for masters
[masters]
master1.example.com
master2.example.com
master3.example.com

# host group for etcd
[etcd]
etcd1.example.com
etcd2.example.com
etcd3.example.com

# Specify load balancer host
[lb]
lb.example.com

# host group for nodes, includes region info
[nodes]
master[1:3].example.com openshift_node_group_name='node-config-master'
node1.example.com openshift_node_group_name='node-config-compute'
node2.example.com openshift_node_group_name='node-config-compute'
infra-node1.example.com openshift_node_group_name='node-config-infra'
infra-node2.example.com openshift_node_group_name='node-config-infra'

重要

ノードホストラベルの設定 を参照し、OpenShift Container Platform 3.9 以降のデフォルトノードセレクター要件とノードラベルに関する考慮事項を確認してください。

この例を使用するには、お使いの環境と仕様に合わせてファイルを変更し、これを /etc/ansible/hosts として保存します。