2.3. レジストリーのプルシークレットへの追加

OpenShift Container Platform クラスターをネットワークが制限された環境にインストールする前に、OpenShift Container Platform クラスターのプルシークレットを変更してローカルレジストリーを記述します。

前提条件

  • ネットワークが制限された環境で使用するミラーレジストリーを設定していること。

手順

bastion ホストで以下の手順を実行します。

  1. Red Hat OpenShift Cluster Manager サイトの Pull Secret ページから registry.redhat.io プルシークレットをダウンロードします。
  2. ミラーレジストリーの base64 でエンコードされたユーザー名およびパスワードまたはトークンを生成します。

    $ echo -n '<user_name>:<password>' | base64 -w0 1
    
    BGVtbYk3ZHAtqXs=
    1
    <user_name> および <password> については、レジストリーに設定したユーザー名およびパスワードを指定します。
  3. JSON 形式でプルシークレットのコピーを作成します。

    $ cat ./pull-secret.text | jq .  > <path>/<pull-secret-file>1
    1
    プルシークレットを保存するフォルダーへのパスおよび作成する JSON ファイルの名前を指定します。

    ファイルの内容は以下の例のようになります。

    {
      "auths": {
        "cloud.openshift.com": {
          "auth": "b3BlbnNo...",
          "email": "you@example.com"
        },
        "quay.io": {
          "auth": "b3BlbnNo...",
          "email": "you@example.com"
        },
        "registry.connect.redhat.com": {
          "auth": "NTE3Njg5Nj...",
          "email": "you@example.com"
        },
        "registry.redhat.io": {
          "auth": "NTE3Njg5Nj...",
          "email": "you@example.com"
        }
      }
    }
  4. 新規ファイルを編集し、レジストリーについて記述するセクションをこれに追加します。

      "auths": {
    ...
        "<local_registry_host_name>:<local_registry_host_port>": { 1
          "auth": "<credentials>", 2
          "email": "you@example.com"
      },
    ...
    1
    <local_registry_host_name> については、証明書に指定したレジストリードメイン名を指定し、<local_registry_host_port> については、ミラーレジストリーがコンテンツを送るために使用するポートを指定します。
    2
    <credentials> については、生成したミラーレジストリーの base64 でエンコードされたユーザー名およびパスワードを指定します。

    ファイルは以下の例のようになります。

    {
      "auths": {
        "cloud.openshift.com": {
          "auth": "b3BlbnNo...",
          "email": "you@example.com"
        },
        "quay.io": {
          "auth": "b3BlbnNo...",
          "email": "you@example.com"
        },
        "registry.connect.redhat.com": {
          "auth": "NTE3Njg5Nj...",
          "email": "you@example.com"
        },
        "<local_registry_host_name>:<local_registry_host_port>": {
          "auth": "<credentials>",
          "email": "you@example.com"
        },
        "registry.redhat.io": {
          "auth": "NTE3Njg5Nj...",
          "email": "you@example.com"
        }
      }
    }