13.5. 安装 External DNS Operator
创建一个新项目
$ oc new-project external-dns-operator
从 OperatorHub 安装
外部 DNS
Operator:$ cat << EOF | oc apply -f - apiVersion: operators.coreos.com/v1 kind: OperatorGroup metadata: name: external-dns-group namespace: external-dns-operator spec: targetNamespaces: - external-dns-operator --- apiVersion: operators.coreos.com/v1alpha1 kind: Subscription metadata: name: external-dns-operator namespace: external-dns-operator spec: channel: stable-v1.1 installPlanApproval: Automatic name: external-dns-operator source: redhat-operators sourceNamespace: openshift-marketplace EOF
等待
外部 DNS
Operator 正在运行:$ oc rollout status deploy external-dns-operator --timeout=300s
从 AWS IAM 用户凭证创建 secret:
$ oc -n external-dns-operator create secret generic external-dns \ --from-file "${SCRATCH}/credentials"
部署
ExternalDNS
控制器:$ cat << EOF | oc apply -f - apiVersion: externaldns.olm.openshift.io/v1beta1 kind: ExternalDNS metadata: name: ${DOMAIN} spec: domains: - filterType: Include matchType: Exact name: ${DOMAIN} provider: aws: credentials: name: external-dns type: AWS source: openshiftRouteOptions: routerName: external-dns-ingress type: OpenShiftRoute zones: - ${ZONE_ID} EOF
等待控制器运行:
$ oc rollout status deploy external-dns-${DOMAIN} --timeout=300s