4.2.2. Helm チャートリポジトリーを追加するための認証情報および CA 証明書の作成
一部の Helm チャートリポジトリーに接続するには、認証情報とカスタム認証局 (CA) 証明書が必要です。Web コンソールと CLI を使用して認証情報と証明書を追加することができます。
手順
認証情報と証明書を設定し、CLI を使用して Helm チャートリポジトリーを追加します。
openshift-config
namespace で、PEM でエンコードされた形式のカスタム CA 証明書でConfigMap
を作成し、これを設定マップ内のca-bundle.crt
キーに保存します。$ oc create configmap helm-ca-cert \ --from-file=ca-bundle.crt=/path/to/certs/ca.crt \ -n openshift-config
openshift-config
namespace で、クライアント TLS 設定を追加するためにSecret
オブジェクトを作成します。$ oc create secret generic helm-tls-configs \ --from-file=tls.crt=/path/to/certs/client.crt \ --from-file=tls.key=/path/to/certs//client.key \ -n openshift-config
クライアント証明書とキーは PEM でエンコードされた形式であり、それぞれ
tls.crt
およびtls.key
キーに保存される必要があります。以下のように Helm リポジトリーを追加します。
$ cat <<EOF | oc apply -f - apiVersion: helm.openshift.io/v1beta1 kind: HelmChartRepository metadata: name: <helm-repository> spec: name: <helm-repository> connectionConfig: url: <URL for the Helm repository> tlsConfig: name: helm-tls-configs ca: name: helm-ca-cert EOF
ConfigMap
およびSecret
は、tlsConfig
およびca
フィールドを使用して HelmChartRepository CR で使用されます。これらの証明書は、Helm リポジトリー URL への接続に使用されます。デフォルトでは、認証されたユーザーはすべて設定済みのチャートにアクセスできます。ただし、証明書が必要なチャートリポジトリーの場合は、以下のように
openshift-config
namespace でhelm-ca-cert
設定マップおよびhelm-tls-configs
シークレットへの読み取りアクセスを提供する必要があります。$ cat <<EOF | kubectl apply -f - apiVersion: rbac.authorization.k8s.io/v1 kind: Role metadata: namespace: openshift-config name: helm-chartrepos-tls-conf-viewer rules: - apiGroups: [""] resources: ["configmaps"] resourceNames: ["helm-ca-cert"] verbs: ["get"] - apiGroups: [""] resources: ["secrets"] resourceNames: ["helm-tls-configs"] verbs: ["get"] --- kind: RoleBinding apiVersion: rbac.authorization.k8s.io/v1 metadata: namespace: openshift-config name: helm-chartrepos-tls-conf-viewer subjects: - kind: Group apiGroup: rbac.authorization.k8s.io name: 'system:authenticated' roleRef: apiGroup: rbac.authorization.k8s.io kind: Role name: helm-chartrepos-tls-conf-viewer EOF