アプリケーション

OpenShift Dedicated 4

アプリケーション用の OpenShift Dedicated の設定

Red Hat OpenShift Documentation Team

概要

このドキュメントでは、アプリケーションのデプロイメント用に OpenShift Dedicated を設定する方法を説明します。カスタムワイルドカードドメインの設定も含まれます。

第1章 デプロイメント

1.1. アプリケーションのカスタムドメイン

注記

OpenShift Dedicated 4.14 以降、カスタムドメイン Operator は非推奨になりました。OpenShift Dedicated 4.14 で Ingress を管理するには、Ingress Operator を使用します。OpenShift Dedicated 4.13 以前のバージョンでは機能に変更はありません。

アプリケーションのカスタムドメインを設定できます。カスタムドメインは、OpenShift Dedicated アプリケーションで使用できる特定のワイルドカードドメインです。

1.1.1. アプリケーションのカスタムドメインの設定

トップレベルのドメイン (TLD) は、OpenShift Dedicated クラスターを運用しているお客様が所有しています。カスタムドメイン Operator は、2 日目の操作としてカスタム証明書を使用して新規イングレスコントローラーを設定します。次に、このイングレスコントローラーのパブリック DNS レコードを外部 DNS で使用して、カスタムドメインで使用するワイルドカード CNAME レコードを作成できます。

注記

Red Hat は API ドメインを制御するため、カスタム API ドメインはサポートされません。ただし、お客様はアプリケーションドメインを変更することができます。プライベート IngressController があるプライベートカスタムドメインの場合は、CustomDomain CR で .spec.scopeInternal に設定します。

前提条件

  • dedicated-admin 権限を持つユーザーアカウント
  • *.apps.<company_name>.io などの一意のドメインまたはワイルドカードドメイン
  • CN=*.apps.<company_name>.io などのカスタム証明書またはワイルドカードカスタム証明書
  • 最新バージョンの oc CLI がインストールされているクラスターへのアクセス
重要

CustomDomain CR の metadata/name: セクションで、予約された名前 default または apps* (appsapps2 など) を使用しないでください。

手順

  1. 秘密鍵および公開証明書から新しい TLS シークレットを作成します。ここで、fullchain.pem および privkey.pem は、公開または秘密のワイルドカード証明書です。

    $ oc create secret tls <name>-tls --cert=fullchain.pem --key=privkey.pem -n <my_project>

  2. 新規の CustomDomain カスタムリソース (CR) を作成します。

    例: <company_name>-custom-domain.yaml

    apiVersion: managed.openshift.io/v1alpha1
    kind: CustomDomain
    metadata:
      name: <company_name>
    spec:
      domain: apps.<company_name>.io 1
      scope: External
      loadBalancerType: Classic 2
      certificate:
        name: <name>-tls 3
        namespace: <my_project>
      routeSelector: 4
        matchLabels:
         route: acme
      namespaceSelector: 5
        matchLabels:
         type: sharded

    1
    カスタムドメイン
    2
    カスタムドメインのロードバランサーのタイプ。このタイプは、ネットワークロードバランサーを使用する場合は、デフォルトの classic または NLB にすることができます。
    3
    前の手順で作成されたシークレット
    4
    オプション: CustomDomain イングレスによって提供されるルートのセットをフィルタリングします。値が指定されていない場合、デフォルトはフィルタリングなしです。
    5
    オプション: CustomDomain イングレスによって提供される namespace のセットをフィルタリングします。値が指定されていない場合、デフォルトはフィルタリングなしです。
  3. CR を適用します。

    $ oc apply -f <company_name>-custom-domain.yaml

  4. 新規に作成された CR のステータスを取得します。

    $ oc get customdomains

    出力例

    NAME               ENDPOINT                                                    DOMAIN                       STATUS
    <company_name>     xxrywp.<company_name>.cluster-01.opln.s1.openshiftapps.com  *.apps.<company_name>.io     Ready

  5. エンドポイントの値を使用して、新規のワイルドカード CNAME レコードセットを、Route53、Azure DNS、Google DNS などの管理 DNS プロバイダーに追加します。

    *.apps.<company_name>.io -> xxrywp.<company_name>.cluster-01.opln.s1.openshiftapps.com

  6. 新規アプリケーションを作成し、これを公開します。

    $ oc new-app --docker-image=docker.io/openshift/hello-openshift -n my-project

    $ oc create route <route_name> --service=hello-openshift hello-openshift-tls --hostname hello-openshift-tls-my-project.apps.<company_name>.io -n my-project
    $ oc get route -n my-project
    $ curl https://hello-openshift-tls-my-project.apps.<company_name>.io
    Hello OpenShift!

1.1.2. カスタムドメインの証明書の更新

oc CLI ツールを使用して、Custom Domains Operator (CDO) で証明書を更新できます。

前提条件

  • 最新バージョンの oc CLI ツールがインストールされている。

手順

  1. 新しいシークレットを作成します。

    $ oc create secret tls <secret-new> --cert=fullchain.pem --key=privkey.pem -n <my_project>
  2. CustomDomain CR にパッチを適用します。

    $ oc patch customdomain <company_name> --type='merge' -p '{"spec":{"certificate":{"name":"<secret-new>"}}}'
  3. 古いシークレットを削除します。

    $ oc delete secret <secret-old> -n <my_project>

トラブルシューティング

法律上の通知

Copyright © 2024 Red Hat, Inc.
The text of and illustrations in this document are licensed by Red Hat under a Creative Commons Attribution–Share Alike 3.0 Unported license ("CC-BY-SA"). An explanation of CC-BY-SA is available at http://creativecommons.org/licenses/by-sa/3.0/. In accordance with CC-BY-SA, if you distribute this document or an adaptation of it, you must provide the URL for the original version.
Red Hat, as the licensor of this document, waives the right to enforce, and agrees not to assert, Section 4d of CC-BY-SA to the fullest extent permitted by applicable law.
Red Hat, Red Hat Enterprise Linux, the Shadowman logo, the Red Hat logo, JBoss, OpenShift, Fedora, the Infinity logo, and RHCE are trademarks of Red Hat, Inc., registered in the United States and other countries.
Linux® is the registered trademark of Linus Torvalds in the United States and other countries.
Java® is a registered trademark of Oracle and/or its affiliates.
XFS® is a trademark of Silicon Graphics International Corp. or its subsidiaries in the United States and/or other countries.
MySQL® is a registered trademark of MySQL AB in the United States, the European Union and other countries.
Node.js® is an official trademark of Joyent. Red Hat is not formally related to or endorsed by the official Joyent Node.js open source or commercial project.
The OpenStack® Word Mark and OpenStack logo are either registered trademarks/service marks or trademarks/service marks of the OpenStack Foundation, in the United States and other countries and are used with the OpenStack Foundation's permission. We are not affiliated with, endorsed or sponsored by the OpenStack Foundation, or the OpenStack community.
All other trademarks are the property of their respective owners.