19.7. 在 Infoblox 上创建 DNS 记录

您可以使用 External DNS Operator 在 Infoblox 上创建 DNS 记录。

19.7.1. 在 Infoblox 上的公共 DNS 区域中创建 DNS 记录

您可以使用 External DNS Operator 在 Infoblox 上的公共 DNS 区域上创建 DNS 记录。

先决条件

  • 您可以访问 OpenShift CLI(oc)。
  • 您可以访问 Infoblox UI。

流程

  1. 运行以下命令,使用 Infoblox 凭证创建 secret 对象:

    $ oc -n external-dns-operator create secret generic infoblox-credentials --from-literal=EXTERNAL_DNS_INFOBLOX_WAPI_USERNAME=<infoblox_username> --from-literal=EXTERNAL_DNS_INFOBLOX_WAPI_PASSWORD=<infoblox_password>
  2. 运行以下命令来获取路由列表:

    $ oc get routes --all-namespaces | grep console

    输出示例

    openshift-console          console             console-openshift-console.apps.test.example.com                       console             https   reencrypt/Redirect     None
    openshift-console          downloads           downloads-openshift-console.apps.test.example.com                     downloads           http    edge/Redirect          None

  3. 创建一个 YAML 文件,如 external-dns-sample-infoblox.yaml,该文件定义 ExternalDNS 对象:

    external-dns-sample-infoblox.yaml 文件示例

    apiVersion: externaldns.olm.openshift.io/v1beta1
    kind: ExternalDNS
    metadata:
      name: sample-infoblox 1
    spec:
      provider:
        type: Infoblox 2
        infoblox:
          credentials:
            name: infoblox-credentials
          gridHost: ${INFOBLOX_GRID_PUBLIC_IP}
          wapiPort: 443
          wapiVersion: "2.3.1"
      domains:
      - filterType: Include
        matchType: Exact
        name: test.example.com
      source:
        type: OpenShiftRoute 3
        openshiftRouteOptions:
          routerName: default 4

    1
    指定外部 DNS 名称。
    2
    定义提供程序类型。
    3
    您可以定义 DNS 记录源的选项。
    4
    如果源类型是 OpenShiftRoute,您可以传递 OpenShift Ingress Controller 名称。外部 DNS 在创建 CNAME 记录时,选择该路由器的规范主机名作为目标。
  4. 运行以下命令,在 Infoblox 上创建 ExternalDNS 资源:

    $ oc create -f external-dns-sample-infoblox.yaml
  5. 通过 Infoblox UI,检查为 console 路由创建的 DNS 记录:

    1. Data ManagementDNSZones
    2. 选择区域名称。