10.7.7. Microsoft Azure DNS の明示的な認証情報を使用した ACME 発行者の設定
cert-manager Operator for Red Hat OpenShift を使用して ACME 発行者を設定し、Microsoft Azure で明示的な認証情報を使用して DNS-01 チャレンジを解決できます。この手順では、Let’s Encrypt を ACME CA サーバーとして使用し、Azure DNS で DNS-01 チャレンジを解決する方法を示します。
前提条件
Azure DNS に必要なロールでサービスプリンシパルを設定している。詳細は、アップストリームの cert-manager ドキュメントの Azure DNS を参照してください。
注記Microsoft Azure で実行されていない OpenShift Container Platform クラスターについては、以下の手順を実行できます。
手順
オプション: DNS-01 セルフチェックのネームサーバー設定をオーバーライドします。
この手順は、ターゲットのパブリックホストゾーンがクラスターのデフォルトのプライベートホストゾーンに重複する場合のみ、必要です。
次のコマンドを実行して、
CertManagerリソースを編集します。$ oc edit certmanager cluster次のオーバーライド引数を指定して、
spec.controllerConfigセクションを追加します。apiVersion: operator.openshift.io/v1alpha1 kind: CertManager metadata: name: cluster ... spec: ... controllerConfig: overrideArgs: - '--dns01-recursive-nameservers-only' - '--dns01-recursive-nameservers=1.1.1.1:53'各項目の説明:
--dns01-recursive-nameservers-only- そのドメインに関連付けられている権威ネームサーバーを確認する代わりに、再帰的なネームサーバーを指定します。
--dns01-recursive-nameservers=1.1.1.1:53-
DNS-01 自己チェックのためにクエリーを実行する
<host>:<port>ネームサーバーのコンマ区切りリストを指定します。パブリックゾーンとプライベートゾーンの重複を避けるには、1.1.1.1:53値を使用する必要があります。
- 変更を適用するためにファイルを保存します。
オプション: 発行者の namespace を作成します。
$ oc new-project my-issuer-namespace次のコマンドを実行して、Azure 認証情報を保存するシークレットを作成します。
$ oc create secret generic <secret_name> --from-literal=<azure_secret_access_key_name>=<azure_secret_access_key_value> \ -n my-issuer-namespace-
<secret_name>は、シークレット名に置き換えます。 -
<azure_secret_access_key_name>は、Azure シークレットアクセスキーの名前に置き換えます。 -
<azure_secret_access_key_value>は、Azure 秘密鍵に置き換えます。
-
発行者を作成します。
Issuerオブジェクトを定義する YAML ファイル (例:issuer.yaml) を作成します。apiVersion: cert-manager.io/v1 kind: Issuer metadata: name: <acme-dns01-azuredns-issuer> namespace: <issuer_namespace> spec: acme: preferredChain: "" privateKeySecretRef: name: <secret_private_key> server: <server> solvers: - dns01: azureDNS: clientID: <azure_client_id> clientSecretSecretRef: name: <secret_name> key: <azure_secret_access_key_name> subscriptionID: <azure_subscription_id> tenantID: <azure_tenant_id> resourceGroupName: <azure_dns_zone_resource_group> hostedZoneName: <azure_dns_zone> environment: AzurePublicCloud各項目の説明:
<acme-dns01-azuredns-issuer>- 発行者の名前を指定します。
< 発行者名スペース >- 発行者ネームスペースを指定します。
< 秘密鍵 >- ACME アカウントの秘密鍵を保存するシークレットの名前を指定します。
<server>-
ACME サーバーの
ディレクトリーエンドポイントにアクセスするための URL を指定します。この例では、Let’s Encrypt のステージング環境を使用します。 <azure_client_id>- Azure クライアント ID を指定します。
<secret_name>- クライアントシークレットの名前を指定します。
<azure_secret_access_key_name>- クライアント秘密鍵の名前を指定します。
<azure_subscription_id>- Azure サブスクリプション ID を指定します。
<azure_tenant_id>- Azure テナント ID を指定します。
<azure_dns_zone_resource_group>- Azure DNS ゾーンリソースグループの名前を指定します。
<azure_dns_zone>- Azure DNS ゾーンの名前を指定します。
次のコマンドを実行して、
Issuerオブジェクトを作成します。$ oc create -f issuer.yaml