external-dns CoreDNS with minikube warning This tutorial is out of date You need to This tutorial describes how to setup ExternalDNS for usage within a cluster that makes use of and informationsource PRs to update it are welcome

Answer:
# CoreDNS with minikube

:warning: This tutorial is out of date.

:information_source: PRs to update it are welcome !

This tutorial describes how to setup ExternalDNS for usage within a [minikube](https://github.com/kubernetes/minikube) cluster that makes use of [CoreDNS](https://github.com/coredns/coredns) and [nginx ingress controller](https://github.com/kubernetes/ingress-nginx).

You need to:

* install CoreDNS with [etcd](https://github.com/etcd-io/etcd) enabled
* install external-dns with coredns as a provider
* enable ingress controller for the minikube cluster

## Creating a cluster

```shell
minikube start
```

## Installing CoreDNS with etcd enabled

Helm chart is used to install etcd and CoreDNS.

### Initializing helm chart

```shell
helm init
```

### Installing etcd

[etcd operator](https://github.com/coreos/etcd-operator) is used to manage etcd clusters.
```
helm install stable/etcd-operator --name my-etcd-op
```

etcd cluster is installed with example yaml from etcd operator website.

```shell
kubectl apply -f https://raw.githubusercontent.com/coreos/etcd-operator/HEAD/example/example-etcd-cluster.yaml
```

### Installing CoreDNS

In order to make CoreDNS work with etcd backend, values.yaml of the chart should be changed with corresponding configurations.

```
wget https://raw.githubusercontent.com/helm/charts/HEAD/stable/coredns/values.yaml
```

You need to edit/patch the file with below diff

```diff
diff --git a/values.yaml b/values.yaml
index 964e72b..e2fa934 100644
--- a/values.yaml
+++ b/values.yaml
@@ -27,12 +27,12 @@ service:

 rbac:
   # If true, create & use RBAC resources
-  create: false
+  create: true
   # Ignored if rbac.create is true
   serviceAccountName: default

 # isClusterService specifies whether chart should be deployed as cluster-service or normal k8s app.
-isClusterService: true
+isClusterService: false

 servers:
 - zones:
@@ -51,6 +51,12 @@ servers:
     parameters: 0.0.0.0:9153
   - name: proxy
     parameters: . /etc/resolv.conf
+  - name: etcd
+    parameters: example.org
+    configBlock: |-
+      stubzones
+      path /skydns
+      endpoint http://10.105.68.165:2379

 # Complete example with all the options:
 # - zones:                 # the `zones` block can be left out entirely, defaults to "."
```

**Note**:

* IP address of etcd's endpoint should be get from etcd client service. It should be "example-etcd-cluster-client" in this example. This IP address is used through this document for etcd endpoint configuration.

```shell
$ kubectl get svc example-etcd-cluster-client
NAME                          TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)    AGE
example-etcd-cluster-client   ClusterIP   10.105.68.165   <none>        2379/TCP   16m
```

* Parameters should configure your own domain. "example.org" is used in this example.

After configuration done in values.yaml, you can install coredns chart.

```shell
helm install --name my-coredns --values values.yaml stable/coredns
```

## Installing ExternalDNS

### Install external ExternalDNS

ETCD_URLS is configured to etcd client service address.
Optionally, you can configure ETCD_USERNAME and ETCD_PASSWORD for authenticating to etcd. It is also possible to connect to the etcd cluster via HTTPS using the following environment variables: ETCD_CA_FILE, ETCD_CERT_FILE, ETCD_KEY_FILE, ETCD_TLS_SERVER_NAME, ETCD_TLS_INSECURE.

#### Manifest (for clusters without RBAC enabled)

```yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: external-dns
  namespace: kube-system
spec:
  strategy:
    type: Recreate
  selector:
    matchLabels:
      app: external-dns
  template:
    metadata:
      labels:
        app: external-dns
    spec:
      containers:
      - name: external-dns
        image: registry.k8s.io/external-dns/external-dns:v0.15.0
        args:
        - --source=ingress
        - --provider=coredns
        - --log-level=debug # debug only
        env:
        - name: ETCD_URLS
          value: http://10.105.68.165:2379
```

#### Manifest (for clusters with RBAC enabled)

```yaml
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  name: external-dns
rules:
- apiGroups: [""]
  resources: ["services","endpoints","pods"]
  verbs: ["get","watch","list"]
- apiGroups: ["extensions","networking.k8s.io"]
  resources: ["ingresses"]
  verbs: ["get","watch","list"]
- apiGroups: [""]
  resources: ["nodes"]
  verbs: ["list"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  name: external-dns-viewer
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: external-dns
subjects:
- kind: ServiceAccount
  name: external-dns
  namespace: kube-system
---
apiVersion: v1
kind: ServiceAccount
metadata:
  name: external-dns
  namespace: kube-system
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: external-dns
  namespace: kube-system
spec:
  strategy:
    type: Recreate
  selector:
    matchLabels:
      app: external-dns
  template:
    metadata:
      labels:
        app: external-dns
    spec:
      serviceAccountName: external-dns
      containers:
      - name: external-dns
        image: registry.k8s.io/external-dns/external-dns:v0.15.0
        args:
        - --source=ingress
        - --provider=coredns
        - --log-level=debug # debug only
        env:
        - name: ETCD_URLS
          value: http://10.105.68.165:2379
```

## Enable the ingress controller

You can use the ingress controller in minikube cluster. It needs to enable ingress addon in the cluster.

```shell
minikube addons enable ingress
```

## Testing ingress example

```shell
$ cat ingress.yaml
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: nginx
spec:
  ingressClassName: nginx
  rules:
  - host: nginx.example.org
    http:
      paths:
      - backend:
          serviceName: nginx
          servicePort: 80

$ kubectl apply -f ingress.yaml
ingress.extensions "nginx" created
```

Wait a moment until DNS has the ingress IP. The DNS service IP is from CoreDNS service. It is "my-coredns-coredns" in this example.

```shell
$ kubectl get svc my-coredns-coredns
NAME                 TYPE        CLUSTER-IP     EXTERNAL-IP   PORT(S)   AGE
my-coredns-coredns   ClusterIP   10.100.4.143   <none>        53/UDP    12m

$ kubectl get ingress
NAME      HOSTS               ADDRESS     PORTS     AGE
nginx     nginx.example.org   10.0.2.15   80        2m

$ kubectl run -it --rm --restart=Never --image=infoblox/dnstools:latest dnstools
If you don't see a command prompt, try pressing enter.
dnstools# dig @10.100.4.143 nginx.example.org +short
10.0.2.15
dnstools#
```

CoreDNS with minikube   warning  This tutorial is out of date    information source  PRs to update it are welcome    This tutorial describes how to setup ExternalDNS for usage within a  minikube  https   github com kubernetes minikube  cluster that makes use of  CoreDNS  https   github com coredns coredns  and  nginx ingress controller  https   github com kubernetes ingress nginx    You need to     install CoreDNS with  etcd  https   github com etcd io etcd  enabled   install external dns with coredns as a provider   enable ingress controller for the minikube cluster     Creating a cluster     shell minikube start         Installing CoreDNS with etcd enabled  Helm chart is used to install etcd and CoreDNS       Initializing helm chart     shell helm init          Installing etcd   etcd operator  https   github com coreos etcd operator  is used to manage etcd clusters      helm install stable etcd operator   name my etcd op      etcd cluster is installed with example yaml from etcd operator website      shell kubectl apply  f https   raw githubusercontent com coreos etcd operator HEAD example example etcd cluster yaml          Installing CoreDNS  In order to make CoreDNS work with etcd backend  values yaml of the chart should be changed with corresponding configurations       wget https   raw githubusercontent com helm charts HEAD stable coredns values yaml      You need to edit patch the file with below diff     diff diff   git a values yaml b values yaml index 964e72b  e2fa934 100644     a values yaml     b values yaml     27 12  27 12    service    rbac       If true  create   use RBAC resources    create  false    create  true      Ignored if rbac create is true    serviceAccountName  default     isClusterService specifies whether chart should be deployed as cluster service or normal k8s app   isClusterService  true  isClusterService  false   servers     zones      51 6  51 12    servers       parameters  0 0 0 0 9153      name  proxy      parameters     etc resolv conf      name  etcd      parameters  example org      configBlock            stubzones        path  skydns        endpoint http   10 105 68 165 2379     Complete example with all the options       zones                    the  zones  block can be left out entirely  defaults to            Note       IP address of etcd s endpoint should be get from etcd client service  It should be  example etcd cluster client  in this example  This IP address is used through this document for etcd endpoint configuration      shell   kubectl get svc example etcd cluster client NAME                          TYPE        CLUSTER IP      EXTERNAL IP   PORT S     AGE example etcd cluster client   ClusterIP   10 105 68 165    none         2379 TCP   16m        Parameters should configure your own domain   example org  is used in this example   After configuration done in values yaml  you can install coredns chart      shell helm install   name my coredns   values values yaml stable coredns         Installing ExternalDNS      Install external ExternalDNS  ETCD URLS is configured to etcd client service address  Optionally  you can configure ETCD USERNAME and ETCD PASSWORD for authenticating to etcd  It is also possible to connect to the etcd cluster via HTTPS using the following environment variables  ETCD CA FILE  ETCD CERT FILE  ETCD KEY FILE  ETCD TLS SERVER NAME  ETCD TLS INSECURE        Manifest  for clusters without RBAC enabled      yaml apiVersion  apps v1 kind  Deployment metadata    name  external dns   namespace  kube system spec    strategy      type  Recreate   selector      matchLabels        app  external dns   template      metadata        labels          app  external dns     spec        containers          name  external dns         image  registry k8s io external dns external dns v0 15 0         args              source ingress             provider coredns             log level debug   debug only         env            name  ETCD URLS           value  http   10 105 68 165 2379           Manifest  for clusters with RBAC enabled      yaml     apiVersion  rbac authorization k8s io v1 kind  ClusterRole metadata    name  external dns rules    apiGroups         resources    services   endpoints   pods     verbs    get   watch   list     apiGroups    extensions   networking k8s io     resources    ingresses     verbs    get   watch   list     apiGroups         resources    nodes     verbs    list       apiVersion  rbac authorization k8s io v1 kind  ClusterRoleBinding metadata    name  external dns viewer roleRef    apiGroup  rbac authorization k8s io   kind  ClusterRole   name  external dns subjects    kind  ServiceAccount   name  external dns   namespace  kube system     apiVersion  v1 kind  ServiceAccount metadata    name  external dns   namespace  kube system     apiVersion  apps v1 kind  Deployment metadata    name  external dns   namespace  kube system spec    strategy      type  Recreate   selector      matchLabels        app  external dns   template      metadata        labels          app  external dns     spec        serviceAccountName  external dns       containers          name  external dns         image  registry k8s io external dns external dns v0 15 0         args              source ingress             provider coredns             log level debug   debug only         env            name  ETCD URLS           value  http   10 105 68 165 2379         Enable the ingress controller  You can use the ingress controller in minikube cluster  It needs to enable ingress addon in the cluster      shell minikube addons enable ingress         Testing ingress example     shell   cat ingress yaml apiVersion  networking k8s io v1 kind  Ingress metadata    name  nginx spec    ingressClassName  nginx   rules      host  nginx example org     http        paths          backend            serviceName  nginx           servicePort  80    kubectl apply  f ingress yaml ingress extensions  nginx  created      Wait a moment until DNS has the ingress IP  The DNS service IP is from CoreDNS service  It is  my coredns coredns  in this example      shell   kubectl get svc my coredns coredns NAME                 TYPE        CLUSTER IP     EXTERNAL IP   PORT S    AGE my coredns coredns   ClusterIP   10 100 4 143    none         53 UDP    12m    kubectl get ingress NAME      HOSTS               ADDRESS     PORTS     AGE nginx     nginx example org   10 0 2 15   80        2m    kubectl run  it   rm   restart Never   image infoblox dnstools latest dnstools If you don t see a command prompt  try pressing enter  dnstools  dig  10 100 4 143 nginx example org  short 10 0 2 15 dnstools


external-dns Create a DNS zone which will contain the managed DNS records Let s use Make sure to use the latest version of ExternalDNS for this tutorial Oracle Cloud Infrastructure Creating an OCI DNS Zone as a reference here Make note of the OCID of the compartment This tutorial describes how to setup ExternalDNS for usage within a Kubernetes cluster using OCI DNS

Oracle Cloud Infrastructure  This tutorial describes how to setup ExternalDNS for usage within a Kubernetes cluster using OCI DNS   Make sure to use the latest version of ExternalDNS for this tutorial      Creating an OCI DNS Zone  Create a DNS zone which will contain the managed DNS records  Let s use  example com  as a reference here   Make note of the OCID of the compartment in which you created the zone  you ll need to provide that later   For more information about OCI DNS see the documentation  here  1       Using Private OCI DNS Zones  By default  the ExternalDNS OCI provider is configured to use Global OCI DNS Zones  If you want to use Private OCI DNS Zones  add the following argument to the ExternalDNS controller         oci zone scope PRIVATE      To use both Global and Private OCI DNS Zones  set the OCI Zone Scope to be empty         oci zone scope          Deploy ExternalDNS  Connect your  kubectl  client to the cluster you want to test ExternalDNS with  The OCI provider supports two authentication options  key based and instance principals       Key based  We first need to create a config file containing the information needed to connect with the OCI API   Create a new file  oci yaml  and modify the contents to match the example below  Be sure to adjust the values to match your own credentials  and the OCID of the compartment containing the zone      yaml auth    region  us phoenix 1   tenancy  ocid1 tenancy oc1      user  ocid1 user oc1      key             BEGIN RSA PRIVATE KEY               END RSA PRIVATE KEY        fingerprint  af 81 71 8e        Omit if there is not a password for the key   passphrase  Tx1jRk    compartment  ocid1 compartment oc1         Create a secret using the config file above      shell   kubectl create secret generic external dns config   from file oci yaml          OCI IAM Instance Principal  If you re running ExternalDNS within OCI  you can use OCI IAM instance principals to authenticate with OCI   This obviates the need to create the secret with your credentials   You ll need to ensure an OCI IAM policy exists with a statement granting the  manage dns  permission on zones and records in the target compartment to the dynamic group covering your instance running ExternalDNS  E g        Allow dynamic group  dynamic group name  to manage dns in compartment id  target compartment OCID       You ll also need to add the    oci auth instance principal  flag to enable this type of authentication  Finally  you ll need to add the    oci compartment ocid ocid1 compartment oc1     flag to provide the OCID of the compartment containing the zone to be managed   For more information about OCI IAM instance principals  see the documentation  here  2   For more information about OCI IAM policy details for the DNS service  see the documentation  here  3        OCI IAM Workload Identity  If you re running ExternalDNS within an OCI Container Engine for Kubernetes  OKE  cluster  you can use OCI IAM Workload Identity to authenticate with OCI  You ll need to ensure an OCI IAM policy exists with a statement granting the  manage dns  permission on zones and records in the target compartment covering your OKE cluster running ExternalDNS  E g        Allow any user to manage dns in compartment  compartment name  where all  request principal type  workload  request principal cluster id   cluster ocid   request principal service account  external dns        You ll also need to create a new file  oci yaml  and modify the contents to match the example below  Be sure to adjust the values to match your region and the OCID of the compartment containing the zone      yaml auth    region  us phoenix 1   useWorkloadIdentity  true compartment  ocid1 compartment oc1         Create a secret using the config file above      shell   kubectl create secret generic external dns config   from file oci yaml         Manifest  for clusters with RBAC enabled   Apply the following manifest to deploy ExternalDNS      yaml apiVersion  v1 kind  ServiceAccount metadata    name  external dns     apiVersion  rbac authorization k8s io v1 kind  ClusterRole metadata    name  external dns rules    apiGroups         resources    services   endpoints   pods     verbs    get   watch   list     apiGroups    extensions   networking k8s io     resources    ingresses     verbs    get   watch   list     apiGroups         resources    nodes     verbs    list       apiVersion  rbac authorization k8s io v1 kind  ClusterRoleBinding metadata    name  external dns viewer roleRef    apiGroup  rbac authorization k8s io   kind  ClusterRole   name  external dns subjects    kind  ServiceAccount   name  external dns   namespace  default     apiVersion  apps v1 kind  Deployment metadata    name  external dns spec    strategy      type  Recreate   selector      matchLabels        app  external dns   template      metadata        labels          app  external dns     spec        serviceAccountName  external dns       containers          name  external dns         image  registry k8s io external dns external dns v0 15 0         args              source service             source ingress             provider oci             policy upsert only   prevent ExternalDNS from deleting any records  omit to enable full synchronization             txt owner id my identifier           Specifies the OCI DNS Zone scope  defaults to GLOBAL            May be GLOBAL  PRIVATE  or an empty value to specify both GLOBAL and PRIVATE OCI DNS Zones               oci zone scope GLOBAL           Specifies the zone cache duration  defaults to 0s  If set to 0s  the zone cache is disabled            Use of zone caching is recommended to reduce the amount of requests sent to OCI DNS                oci zones cache duration 0s         volumeMounts              name  config             mountPath   etc kubernetes        volumes          name  config         secret            secretName  external dns config         Verify ExternalDNS works  Service example   Create the following sample application to test that ExternalDNS works     For services ExternalDNS will look for the annotation  external dns alpha kubernetes io hostname  on the service and use the corresponding value      yaml apiVersion  v1 kind  Service metadata    name  nginx   annotations      external dns alpha kubernetes io hostname  example com spec    type  LoadBalancer   ports      port  80     name  http     targetPort  80   selector      app  nginx     apiVersion  apps v1 kind  Deployment metadata    name  nginx spec    selector      matchLabels        app  nginx   template      metadata        labels          app  nginx     spec        containers          image  nginx         name  nginx         ports            containerPort  80           name  http      Apply the manifest above and wait roughly two minutes and check that a corresponding DNS record for your service was created         kubectl apply  f nginx yaml       1   https   docs cloud oracle com iaas Content DNS Concepts dnszonemanagement htm  2   https   docs cloud oracle com iaas Content Identity Reference dnspolicyreference htm  3   https   docs cloud oracle com iaas Content Identity Tasks callingservicesfrominstances htm


external-dns AWS Cloud Map API is an alternative approach to managing DNS records directly using the Route53 API It is more suitable for a dynamic environment where service endpoints change frequently It abstracts away technical details of the DNS protocol and offers a simplified model AWS Cloud Map consists of three main API calls CreatePublicDnsNamespace automatically creates a DNS hosted zone CreateService creates a new named service inside the specified namespace This tutorial describes how to set up ExternalDNS for usage within a Kubernetes cluster with RegisterInstance DeregisterInstance can be called multiple times to create a DNS record for the specified Service AWS Cloud Map API

Answer:
# AWS Cloud Map API

This tutorial describes how to set up ExternalDNS for usage within a Kubernetes cluster with [AWS Cloud Map API](https://docs.aws.amazon.com/cloud-map/).

**AWS Cloud Map** API is an alternative approach to managing DNS records directly using the Route53 API. It is more suitable for a dynamic environment where service endpoints change frequently. It abstracts away technical details of the DNS protocol and offers a simplified model. AWS Cloud Map consists of three main API calls:

* CreatePublicDnsNamespace – automatically creates a DNS hosted zone
* CreateService – creates a new named service inside the specified namespace
* RegisterInstance/DeregisterInstance – can be called multiple times to create a DNS record for the specified *Service*

Learn more about the API in the [AWS Cloud Map API Reference](https://docs.aws.amazon.com/cloud-map/latest/api/API_Operations.html).

## IAM Permissions

To use the AWS Cloud Map API, a user must have permissions to create the DNS namespace. You need to make sure that your nodes (on which External DNS runs) have an IAM instance profile with the `AWSCloudMapFullAccess` managed policy attached, that provides following permissions:

```
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": [
        "route53:GetHostedZone",
        "route53:ListHostedZonesByName",
        "route53:CreateHostedZone",
        "route53:DeleteHostedZone",
        "route53:ChangeResourceRecordSets",
        "route53:CreateHealthCheck",
        "route53:GetHealthCheck",
        "route53:DeleteHealthCheck",
        "route53:UpdateHealthCheck",
        "ec2:DescribeVpcs",
        "ec2:DescribeRegions",
        "servicediscovery:*"
      ],
      "Resource": [
        "*"
      ]
    }
  ]
}
```

### IAM Permissions with ABAC
You can use Attribute-based access control(ABAC) for advanced deployments.

You can define AWS tags that are applied to services created by the controller. By doing so, you can have precise control over your IAM policy to limit the scope of the permissions to services managed by the controller, rather than having to grant full permissions on your entire AWS account.
To pass tags to service creation, use either CLI flags or environment variables:

*cli:* `--aws-sd-create-tag=key1=value1 --aws-sd-create-tag=key2=value2`

*environment:* `EXTERNAL_DNS_AWS_SD_CREATE_TAG=key1=value1\nkey2=value2`

Using tags, your `servicediscovery` policy can become:

```
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": [
        "servicediscovery:ListNamespaces",
        "servicediscovery:ListServices"
      ],
      "Resource": [
        "*"
      ]
    },
    {
      "Effect": "Allow",
      "Action": [
        "servicediscovery:CreateService",
        "servicediscovery:TagResource"
      ],
      "Resource": [
        "*"
      ],
      "Condition": {
        "StringEquals": {
          "aws:RequestTag/YOUR_TAG_KEY": "YOUR_TAG_VALUE"
        }
      }
    },
    {
      "Effect": "Allow",
      "Action": [
        "servicediscovery:DiscoverInstances"
      ],
      "Resource": [
        "*"
      ],
      "Condition": {
        "StringEquals": {
          "servicediscovery:NamespaceName": "YOUR_NAMESPACE_NAME"
        }
      }
    },
    {
      "Effect": "Allow",
      "Action": [
        "servicediscovery:RegisterInstance",
        "servicediscovery:DeregisterInstance",
        "servicediscovery:DeleteService",
        "servicediscovery:UpdateService"
      ],
      "Resource": [
        "*"
      ],
      "Condition": {
        "StringEquals": {
          "aws:ResourceTag/YOUR_TAG_KEY": "YOUR_TAG_VALUE"
        }
      }
    }
  ]
}
```

## Set up a namespace

Create a DNS namespace using the AWS Cloud Map API:

```console
$ aws servicediscovery create-public-dns-namespace --name "external-dns-test.my-org.com"
```

Verify that the namespace was truly created

```console
$ aws servicediscovery list-namespaces
```

## Deploy ExternalDNS

Connect your `kubectl` client to the cluster that you want to test ExternalDNS with.
Then apply the following manifest file to deploy ExternalDNS.

### Manifest (for clusters without RBAC enabled)

```yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: external-dns
spec:
  strategy:
    type: Recreate
  selector:
    matchLabels:
      app: external-dns
  template:
    metadata:
      labels:
        app: external-dns
    spec:
      containers:
      - name: external-dns
        image: registry.k8s.io/external-dns/external-dns:v0.15.0
        env:
          - name: AWS_REGION
            value: us-east-1 # put your CloudMap NameSpace region
        args:
        - --source=service
        - --source=ingress
        - --domain-filter=external-dns-test.my-org.com # Makes ExternalDNS see only the namespaces that match the specified domain. Omit the filter if you want to process all available namespaces.
        - --provider=aws-sd
        - --aws-zone-type=public # Only look at public namespaces. Valid values are public, private, or no value for both)
        - --txt-owner-id=my-identifier
```

### Manifest (for clusters with RBAC enabled)

```yaml
apiVersion: v1
kind: ServiceAccount
metadata:
  name: external-dns
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  name: external-dns
rules:
- apiGroups: [""]
  resources: ["services","endpoints","pods"]
  verbs: ["get","watch","list"]
- apiGroups: ["extensions","networking.k8s.io"]
  resources: ["ingresses"]
  verbs: ["get","watch","list"]
- apiGroups: [""]
  resources: ["nodes"]
  verbs: ["list","watch"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  name: external-dns-viewer
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: external-dns
subjects:
- kind: ServiceAccount
  name: external-dns
  namespace: default
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: external-dns
spec:
  strategy:
    type: Recreate
  selector:
    matchLabels:
      app: external-dns
  template:
    metadata:
      labels:
        app: external-dns
    spec:
      serviceAccountName: external-dns
      containers:
      - name: external-dns
        image: registry.k8s.io/external-dns/external-dns:v0.15.0
        env:
          - name: AWS_REGION
            value: us-east-1 # put your CloudMap NameSpace region
        args:
        - --source=service
        - --source=ingress
        - --domain-filter=external-dns-test.my-org.com # Makes ExternalDNS see only the namespaces that match the specified domain. Omit the filter if you want to process all available namespaces.
        - --provider=aws-sd
        - --aws-zone-type=public # Only look at public namespaces. Valid values are public, private, or no value for both)
        - --txt-owner-id=my-identifier
```

## Verify that ExternalDNS works (Service example)

Create the following sample application to test that ExternalDNS works.

> For services ExternalDNS will look for the annotation `external-dns.alpha.kubernetes.io/hostname` on the service and use the corresponding value.

```yaml
apiVersion: v1
kind: Service
metadata:
  name: nginx
  annotations:
    external-dns.alpha.kubernetes.io/hostname: nginx.external-dns-test.my-org.com
spec:
  type: LoadBalancer
  ports:
  - port: 80
    name: http
    targetPort: 80
  selector:
    app: nginx

---

apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx
spec:
  selector:
    matchLabels:
      app: nginx
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
      - image: nginx
        name: nginx
        ports:
        - containerPort: 80
          name: http
```

After one minute check that a corresponding DNS record for your service was created in your hosted zone. We recommended that you use the [Amazon Route53 console](https://console.aws.amazon.com/route53) for that purpose.

## Custom TTL

The default DNS record TTL (time to live) is 300 seconds. You can customize this value by setting the annotation `external-dns.alpha.kubernetes.io/ttl`.
For example, modify the service manifest YAML file above:

```yaml
apiVersion: v1
kind: Service
metadata:
  name: nginx
  annotations:
    external-dns.alpha.kubernetes.io/hostname: nginx.external-dns-test.my-org.com
    external-dns.alpha.kubernetes.io/ttl: "60"
spec:
    ...
```

This will set the TTL for the DNS record to 60 seconds.

## IPv6 Support

If your Kubernetes cluster is configured with IPv6 support, such as an [EKS cluster with IPv6 support](https://docs.aws.amazon.com/eks/latest/userguide/deploy-ipv6-cluster.html), ExternalDNS can
also create AAAA DNS records.

```yaml
apiVersion: v1
kind: Service
metadata:
  name: nginx
  annotations:
    external-dns.alpha.kubernetes.io/hostname: nginx.external-dns-test.my-org.com
    external-dns.alpha.kubernetes.io/ttl: "60"
spec:
  ipFamilies:
    - "IPv6"
  type: NodePort
  ports:
    - port: 80
      name: http
      targetPort: 80
  selector:
    app: nginx
```

:information_source: The AWS-SD provider does not currently support dualstack load balancers and will only create A records for these at this time. See the AWS provider and the [AWS Load Balancer Controller Tutorial](./aws-load-balancer-controller.md) for dualstack load balancer support.

## Clean up

Delete all service objects before terminating the cluster so all load balancers get cleaned up correctly.

```console
$ kubectl delete service nginx
```

Give ExternalDNS some time to clean up the DNS records for you. Then delete the remaining service and namespace.

```console
$ aws servicediscovery list-services

{
    "Services": [
        {
            "Id": "srv-6dygt5ywvyzvi3an",
            "Arn": "arn:aws:servicediscovery:us-west-2:861574988794:service/srv-6dygt5ywvyzvi3an",
            "Name": "nginx"
        }
    ]
}
```

```console
$ aws servicediscovery delete-service --id srv-6dygt5ywvyzvi3an
```

```console
$ aws servicediscovery list-namespaces
{
    "Namespaces": [
        {
            "Type": "DNS_PUBLIC",
            "Id": "ns-durf2oxu4gxcgo6z",
            "Arn": "arn:aws:servicediscovery:us-west-2:861574988794:namespace/ns-durf2oxu4gxcgo6z",
            "Name": "external-dns-test.my-org.com"
        }
    ]
}
```

```console
$ aws servicediscovery delete-namespace --id ns-durf2oxu4gxcgo6z
```

AWS Cloud Map API  This tutorial describes how to set up ExternalDNS for usage within a Kubernetes cluster with  AWS Cloud Map API  https   docs aws amazon com cloud map       AWS Cloud Map   API is an alternative approach to managing DNS records directly using the Route53 API  It is more suitable for a dynamic environment where service endpoints change frequently  It abstracts away technical details of the DNS protocol and offers a simplified model  AWS Cloud Map consists of three main API calls     CreatePublicDnsNamespace   automatically creates a DNS hosted zone   CreateService   creates a new named service inside the specified namespace   RegisterInstance DeregisterInstance   can be called multiple times to create a DNS record for the specified  Service   Learn more about the API in the  AWS Cloud Map API Reference  https   docs aws amazon com cloud map latest api API Operations html       IAM Permissions  To use the AWS Cloud Map API  a user must have permissions to create the DNS namespace  You need to make sure that your nodes  on which External DNS runs  have an IAM instance profile with the  AWSCloudMapFullAccess  managed policy attached  that provides following permissions            Version    2012 10 17      Statement                  Effect    Allow          Action              route53 GetHostedZone            route53 ListHostedZonesByName            route53 CreateHostedZone            route53 DeleteHostedZone            route53 ChangeResourceRecordSets            route53 CreateHealthCheck            route53 GetHealthCheck            route53 DeleteHealthCheck            route53 UpdateHealthCheck            ec2 DescribeVpcs            ec2 DescribeRegions            servicediscovery                    Resource                                              IAM Permissions with ABAC You can use Attribute based access control ABAC  for advanced deployments     You can define AWS tags that are applied to services created by the controller  By doing so  you can have precise control over your IAM policy to limit the scope of the permissions to services managed by the controller  rather than having to grant full permissions on your entire AWS account    To pass tags to service creation  use either CLI flags or environment variables      cli      aws sd create tag key1 value1   aws sd create tag key2 value2    environment    EXTERNAL DNS AWS SD CREATE TAG key1 value1 nkey2 value2   Using tags  your  servicediscovery  policy can become            Version    2012 10 17      Statement                  Effect    Allow          Action              servicediscovery ListNamespaces            servicediscovery ListServices                  Resource                                             Effect    Allow          Action              servicediscovery CreateService            servicediscovery TagResource                  Resource                                 Condition              StringEquals                aws RequestTag YOUR TAG KEY    YOUR TAG VALUE                                        Effect    Allow          Action              servicediscovery DiscoverInstances                  Resource                                 Condition              StringEquals                servicediscovery NamespaceName    YOUR NAMESPACE NAME                                        Effect    Allow          Action              servicediscovery RegisterInstance            servicediscovery DeregisterInstance            servicediscovery DeleteService            servicediscovery UpdateService                  Resource                                 Condition              StringEquals                aws ResourceTag YOUR TAG KEY    YOUR TAG VALUE                                        Set up a namespace  Create a DNS namespace using the AWS Cloud Map API      console   aws servicediscovery create public dns namespace   name  external dns test my org com       Verify that the namespace was truly created     console   aws servicediscovery list namespaces         Deploy ExternalDNS  Connect your  kubectl  client to the cluster that you want to test ExternalDNS with  Then apply the following manifest file to deploy ExternalDNS       Manifest  for clusters without RBAC enabled      yaml apiVersion  apps v1 kind  Deployment metadata    name  external dns spec    strategy      type  Recreate   selector      matchLabels        app  external dns   template      metadata        labels          app  external dns     spec        containers          name  external dns         image  registry k8s io external dns external dns v0 15 0         env              name  AWS REGION             value  us east 1   put your CloudMap NameSpace region         args              source service             source ingress             domain filter external dns test my org com   Makes ExternalDNS see only the namespaces that match the specified domain  Omit the filter if you want to process all available namespaces              provider aws sd             aws zone type public   Only look at public namespaces  Valid values are public  private  or no value for both              txt owner id my identifier          Manifest  for clusters with RBAC enabled      yaml apiVersion  v1 kind  ServiceAccount metadata    name  external dns     apiVersion  rbac authorization k8s io v1 kind  ClusterRole metadata    name  external dns rules    apiGroups         resources    services   endpoints   pods     verbs    get   watch   list     apiGroups    extensions   networking k8s io     resources    ingresses     verbs    get   watch   list     apiGroups         resources    nodes     verbs    list   watch       apiVersion  rbac authorization k8s io v1 kind  ClusterRoleBinding metadata    name  external dns viewer roleRef    apiGroup  rbac authorization k8s io   kind  ClusterRole   name  external dns subjects    kind  ServiceAccount   name  external dns   namespace  default     apiVersion  apps v1 kind  Deployment metadata    name  external dns spec    strategy      type  Recreate   selector      matchLabels        app  external dns   template      metadata        labels          app  external dns     spec        serviceAccountName  external dns       containers          name  external dns         image  registry k8s io external dns external dns v0 15 0         env              name  AWS REGION             value  us east 1   put your CloudMap NameSpace region         args              source service             source ingress             domain filter external dns test my org com   Makes ExternalDNS see only the namespaces that match the specified domain  Omit the filter if you want to process all available namespaces              provider aws sd             aws zone type public   Only look at public namespaces  Valid values are public  private  or no value for both              txt owner id my identifier         Verify that ExternalDNS works  Service example   Create the following sample application to test that ExternalDNS works     For services ExternalDNS will look for the annotation  external dns alpha kubernetes io hostname  on the service and use the corresponding value      yaml apiVersion  v1 kind  Service metadata    name  nginx   annotations      external dns alpha kubernetes io hostname  nginx external dns test my org com spec    type  LoadBalancer   ports      port  80     name  http     targetPort  80   selector      app  nginx       apiVersion  apps v1 kind  Deployment metadata    name  nginx spec    selector      matchLabels        app  nginx   template      metadata        labels          app  nginx     spec        containers          image  nginx         name  nginx         ports            containerPort  80           name  http      After one minute check that a corresponding DNS record for your service was created in your hosted zone  We recommended that you use the  Amazon Route53 console  https   console aws amazon com route53  for that purpose       Custom TTL  The default DNS record TTL  time to live  is 300 seconds  You can customize this value by setting the annotation  external dns alpha kubernetes io ttl   For example  modify the service manifest YAML file above      yaml apiVersion  v1 kind  Service metadata    name  nginx   annotations      external dns alpha kubernetes io hostname  nginx external dns test my org com     external dns alpha kubernetes io ttl   60  spec               This will set the TTL for the DNS record to 60 seconds      IPv6 Support  If your Kubernetes cluster is configured with IPv6 support  such as an  EKS cluster with IPv6 support  https   docs aws amazon com eks latest userguide deploy ipv6 cluster html   ExternalDNS can also create AAAA DNS records      yaml apiVersion  v1 kind  Service metadata    name  nginx   annotations      external dns alpha kubernetes io hostname  nginx external dns test my org com     external dns alpha kubernetes io ttl   60  spec    ipFamilies         IPv6    type  NodePort   ports        port  80       name  http       targetPort  80   selector      app  nginx       information source  The AWS SD provider does not currently support dualstack load balancers and will only create A records for these at this time  See the AWS provider and the  AWS Load Balancer Controller Tutorial    aws load balancer controller md  for dualstack load balancer support      Clean up  Delete all service objects before terminating the cluster so all load balancers get cleaned up correctly      console   kubectl delete service nginx      Give ExternalDNS some time to clean up the DNS records for you  Then delete the remaining service and namespace      console   aws servicediscovery list services         Services                            Id    srv 6dygt5ywvyzvi3an                Arn    arn aws servicediscovery us west 2 861574988794 service srv 6dygt5ywvyzvi3an                Name    nginx                            console   aws servicediscovery delete service   id srv 6dygt5ywvyzvi3an         console   aws servicediscovery list namespaces        Namespaces                            Type    DNS PUBLIC                Id    ns durf2oxu4gxcgo6z                Arn    arn aws servicediscovery us west 2 861574988794 namespace ns durf2oxu4gxcgo6z                Name    external dns test my org com                            console   aws servicediscovery delete namespace   id ns durf2oxu4gxcgo6z


external-dns This tutorial describes how to use ExternalDNS with the aws load balancer controller 1 Follow the to setup ExternalDNS for use in Kubernetes clusters AWS Load Balancer Controller Setting up ExternalDNS and aws load balancer controller 1 https kubernetes sigs github io aws load balancer controller running in AWS Specify the argument so that ExternalDNS will look

Answer:
# AWS Load Balancer Controller

This tutorial describes how to use ExternalDNS with the [aws-load-balancer-controller][1].

[1]: https://kubernetes-sigs.github.io/aws-load-balancer-controller

## Setting up ExternalDNS and aws-load-balancer-controller

Follow the [AWS tutorial](aws.md) to setup ExternalDNS for use in Kubernetes clusters
running in AWS. Specify the `source=ingress` argument so that ExternalDNS will look
for hostnames in Ingress objects. In addition, you may wish to limit which Ingress
objects are used as an ExternalDNS source via the `ingress-class` argument, but
this is not required.

For help setting up the AWS Load Balancer Controller, follow the [Setup Guide][2].

[2]: https://kubernetes-sigs.github.io/aws-load-balancer-controller/latest/deploy/installation/

Note that the AWS Load Balancer Controller uses the same tags for [subnet auto-discovery][3]
as Kubernetes does with the AWS cloud provider.

[3]: https://kubernetes-sigs.github.io/aws-load-balancer-controller/latest/deploy/subnet_discovery/

In the examples that follow, it is assumed that you configured the ALB Ingress
Controller with the `ingress-class=alb` argument (not to be confused with the
same argument to ExternalDNS) so that the controller will only respect Ingress
objects with the `ingressClassName` field set to "alb".

## Deploy an example application

Create the following sample "echoserver" application to demonstrate how
ExternalDNS works with ALB ingress objects.

```yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: echoserver
spec:
  replicas: 1
  selector:
    matchLabels:
      app: echoserver
  template:
    metadata:
      labels:
        app: echoserver
    spec:
      containers:
      - image: gcr.io/google_containers/echoserver:1.4
        imagePullPolicy: Always
        name: echoserver
        ports:
        - containerPort: 8080
---
apiVersion: v1
kind: Service
metadata:
  name: echoserver
spec:
  ports:
    - port: 80
      targetPort: 8080
      protocol: TCP
  type: NodePort
  selector:
    app: echoserver
```

Note that the Service object is of type `NodePort`. We don't need a Service of
type `LoadBalancer` here, since we will be using an Ingress to create an ALB.

## Ingress examples

Create the following Ingress to expose the echoserver application to the Internet.

```yaml
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  annotations:
    alb.ingress.kubernetes.io/scheme: internet-facing
  name: echoserver
spec:
  ingressClassName: alb
  rules:
  - host: echoserver.mycluster.example.org
    http: &echoserver_root
      paths:
      - path: /
        backend:
          service:
            name: echoserver
            port:
              number: 80
        pathType: Prefix
  - host: echoserver.example.org
    http: *echoserver_root
```

The above should result in the creation of an (ipv4) ALB in AWS which will forward
traffic to the echoserver application.

If the `source=ingress` argument is specified, then ExternalDNS will create DNS
records based on the hosts specified in ingress objects. The above example would
result in two alias records being created, `echoserver.mycluster.example.org` and
`echoserver.example.org`, which both alias the ALB that is associated with the
Ingress object.

Note that the above example makes use of the YAML anchor feature to avoid having
to repeat the http section for multiple hosts that use the exact same paths. If
this Ingress object will only be fronting one backend Service, we might instead
create the following:

```yaml
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  annotations:
    alb.ingress.kubernetes.io/scheme: internet-facing
    external-dns.alpha.kubernetes.io/hostname: echoserver.mycluster.example.org, echoserver.example.org
  name: echoserver
spec:
  ingressClassName: alb
  rules:
  - http:
      paths:
      - path: /
        backend:
          service:
            name: echoserver
            port:
              number: 80
        pathType: Prefix
```

In the above example we create a default path that works for any hostname, and
make use of the `external-dns.alpha.kubernetes.io/hostname` annotation to create
multiple aliases for the resulting ALB.

## Dualstack ALBs

AWS [supports][4] both IPv4 and "dualstack" (both IPv4 and IPv6) interfaces for ALBs.
The AWS Load Balancer Controller uses the `alb.ingress.kubernetes.io/ip-address-type`
annotation (which defaults to `ipv4`) to determine this. If this annotation is
set to `dualstack` then ExternalDNS will create two alias records (one A record
and one AAAA record) for each hostname associated with the Ingress object.

[4]: https://docs.aws.amazon.com/elasticloadbalancing/latest/application/application-load-balancers.html#ip-address-type

Example:

```yaml
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  annotations:
    alb.ingress.kubernetes.io/scheme: internet-facing
    alb.ingress.kubernetes.io/ip-address-type: dualstack
  name: echoserver
spec:
  ingressClassName: alb
  rules:
  - host: echoserver.example.org
    http:
      paths:
      - path: /
        backend:
          service:
            name: echoserver
            port:
              number: 80
        pathType: Prefix
```

The above Ingress object will result in the creation of an ALB with a dualstack
interface. ExternalDNS will create both an A `echoserver.example.org` record and
an AAAA record of the same name, that each are aliases for the same ALB.

AWS Load Balancer Controller  This tutorial describes how to use ExternalDNS with the  aws load balancer controller  1     1   https   kubernetes sigs github io aws load balancer controller     Setting up ExternalDNS and aws load balancer controller  Follow the  AWS tutorial  aws md  to setup ExternalDNS for use in Kubernetes clusters running in AWS  Specify the  source ingress  argument so that ExternalDNS will look for hostnames in Ingress objects  In addition  you may wish to limit which Ingress objects are used as an ExternalDNS source via the  ingress class  argument  but this is not required   For help setting up the AWS Load Balancer Controller  follow the  Setup Guide  2     2   https   kubernetes sigs github io aws load balancer controller latest deploy installation   Note that the AWS Load Balancer Controller uses the same tags for  subnet auto discovery  3  as Kubernetes does with the AWS cloud provider    3   https   kubernetes sigs github io aws load balancer controller latest deploy subnet discovery   In the examples that follow  it is assumed that you configured the ALB Ingress Controller with the  ingress class alb  argument  not to be confused with the same argument to ExternalDNS  so that the controller will only respect Ingress objects with the  ingressClassName  field set to  alb       Deploy an example application  Create the following sample  echoserver  application to demonstrate how ExternalDNS works with ALB ingress objects      yaml apiVersion  apps v1 kind  Deployment metadata    name  echoserver spec    replicas  1   selector      matchLabels        app  echoserver   template      metadata        labels          app  echoserver     spec        containers          image  gcr io google containers echoserver 1 4         imagePullPolicy  Always         name  echoserver         ports            containerPort  8080     apiVersion  v1 kind  Service metadata    name  echoserver spec    ports        port  80       targetPort  8080       protocol  TCP   type  NodePort   selector      app  echoserver      Note that the Service object is of type  NodePort   We don t need a Service of type  LoadBalancer  here  since we will be using an Ingress to create an ALB      Ingress examples  Create the following Ingress to expose the echoserver application to the Internet      yaml apiVersion  networking k8s io v1 kind  Ingress metadata    annotations      alb ingress kubernetes io scheme  internet facing   name  echoserver spec    ingressClassName  alb   rules      host  echoserver mycluster example org     http   echoserver root       paths          path            backend            service              name  echoserver             port                number  80         pathType  Prefix     host  echoserver example org     http   echoserver root      The above should result in the creation of an  ipv4  ALB in AWS which will forward traffic to the echoserver application   If the  source ingress  argument is specified  then ExternalDNS will create DNS records based on the hosts specified in ingress objects  The above example would result in two alias records being created   echoserver mycluster example org  and  echoserver example org   which both alias the ALB that is associated with the Ingress object   Note that the above example makes use of the YAML anchor feature to avoid having to repeat the http section for multiple hosts that use the exact same paths  If this Ingress object will only be fronting one backend Service  we might instead create the following      yaml apiVersion  networking k8s io v1 kind  Ingress metadata    annotations      alb ingress kubernetes io scheme  internet facing     external dns alpha kubernetes io hostname  echoserver mycluster example org  echoserver example org   name  echoserver spec    ingressClassName  alb   rules      http        paths          path            backend            service              name  echoserver             port                number  80         pathType  Prefix      In the above example we create a default path that works for any hostname  and make use of the  external dns alpha kubernetes io hostname  annotation to create multiple aliases for the resulting ALB      Dualstack ALBs  AWS  supports  4  both IPv4 and  dualstack   both IPv4 and IPv6  interfaces for ALBs  The AWS Load Balancer Controller uses the  alb ingress kubernetes io ip address type  annotation  which defaults to  ipv4   to determine this  If this annotation is set to  dualstack  then ExternalDNS will create two alias records  one A record and one AAAA record  for each hostname associated with the Ingress object    4   https   docs aws amazon com elasticloadbalancing latest application application load balancers html ip address type  Example      yaml apiVersion  networking k8s io v1 kind  Ingress metadata    annotations      alb ingress kubernetes io scheme  internet facing     alb ingress kubernetes io ip address type  dualstack   name  echoserver spec    ingressClassName  alb   rules      host  echoserver example org     http        paths          path            backend            service              name  echoserver             port                number  80         pathType  Prefix      The above Ingress object will result in the creation of an ALB with a dualstack interface  ExternalDNS will create both an A  echoserver example org  record and an AAAA record of the same name  that each are aliases for the same ALB


external-dns For this tutorial please make sure that you are using a version 0 7 2 of ExternalDNS This tutorial describes how to setup ExternalDNS for usage within a Kubernetes cluster using UltraDNS Managing DNS with UltraDNS UltraDNS If you would like to read up on the UltraDNS service you can find additional details here

Answer:
# UltraDNS

This tutorial describes how to setup ExternalDNS for usage within a Kubernetes cluster using UltraDNS.

For this tutorial, please make sure that you are using a version **> 0.7.2** of ExternalDNS.

## Managing DNS with UltraDNS

If you would like to read-up on the UltraDNS service, you can find additional details here: [Introduction to UltraDNS](https://docs.ultradns.com/)

Before proceeding, please create a new DNS Zone that you will create your records in for this tutorial process. For the examples in this tutorial, we will be using `example.com` as our Zone.

## Setting Up UltraDNS Credentials

The following environment variables will be needed to run ExternalDNS with UltraDNS.

`ULTRADNS_USERNAME`,`ULTRADNS_PASSWORD`, &`ULTRADNS_BASEURL`
`ULTRADNS_ACCOUNTNAME`(optional variable).

## Deploying ExternalDNS

Connect your `kubectl` client to the cluster you want to test ExternalDNS with.
Then, apply one of the following manifests file to deploy ExternalDNS.

- Note: We are assuming the zone is already present within UltraDNS.
- Note: While creating CNAMES as target endpoints, the `--txt-prefix` option is mandatory.
### Manifest (for clusters without RBAC enabled)

```yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: external-dns
spec:
  strategy:
    type: Recreate
  selector:
    matchLabels:
      app: external-dns
  template:
    metadata:
      labels:
        app: external-dns
    spec:
      containers:
      - name: external-dns
        image: registry.k8s.io/external-dns/external-dns:v0.15.0
        args:
        - --source=service
        - --source=ingress # ingress is also possible
        - --domain-filter=example.com # (Recommended) We recommend to use this filter as it minimize the time to propagate changes, as there are less number of zones to look into..
        - --provider=ultradns
        - --txt-prefix=txt-
        env:
        - name: ULTRADNS_USERNAME
          value: ""
        - name: ULTRADNS_PASSWORD  # The password is required to be BASE64 encrypted.
          value: ""
        - name: ULTRADNS_BASEURL
          value: "https://api.ultradns.com/"
        - name: ULTRADNS_ACCOUNTNAME
          value: ""
```

### Manifest (for clusters with RBAC enabled)

```yaml
apiVersion: v1
kind: ServiceAccount
metadata:
  name: external-dns
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  name: external-dns
rules:
- apiGroups: [""]
  resources: ["services","endpoints","pods"]
  verbs: ["get","watch","list"]
- apiGroups: ["extensions"]
  resources: ["ingresses"]
  verbs: ["get","watch","list"]
- apiGroups: [""]
  resources: ["nodes"]
  verbs: ["list","watch"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  name: external-dns-viewer
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: external-dns
subjects:
- kind: ServiceAccount
  name: external-dns
  namespace: default
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: external-dns
spec:
  strategy:
    type: Recreate
  selector:
    matchLabels:
      app: external-dns
  template:
    metadata:
      labels:
        app: external-dns
    spec:
      serviceAccountName: external-dns
      containers:
      - name: external-dns
        image: registry.k8s.io/external-dns/external-dns:v0.15.0
        args:
        - --source=service
        - --source=ingress
        - --domain-filter=example.com #(Recommended) We recommend to use this filter as it minimize the time to propagate changes, as there are less number of zones to look into..
        - --provider=ultradns
        - --txt-prefix=txt-
        env:
        - name: ULTRADNS_USERNAME
          value: ""
        - name: ULTRADNS_PASSWORD # The password is required to be BASE64 encrypted.
          value: ""
        - name: ULTRADNS_BASEURL
          value: "https://api.ultradns.com/"
        - name: ULTRADNS_ACCOUNTNAME
          value: ""
```

## Deploying an Nginx Service

Create a service file called 'nginx.yaml' with the following contents:

```yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx
spec:
  selector:
    matchLabels:
      app: nginx
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
      - image: nginx
        name: nginx
        ports:
        - containerPort: 80
---
apiVersion: v1
kind: Service
metadata:
  name: nginx
  annotations:
    external-dns.alpha.kubernetes.io/hostname: my-app.example.com.
spec:
  selector:
    app: nginx
  type: LoadBalancer
  ports:
    - protocol: TCP
      port: 80
      targetPort: 80
```

Please note the annotation on the service. Use the same hostname as the UltraDNS zone created above.

ExternalDNS uses this annotation to determine what services should be registered with DNS. Removing the annotation will cause ExternalDNS to remove the corresponding DNS records.

## Creating the Deployment and Service:

```console
$ kubectl create -f nginx.yaml
$ kubectl create -f external-dns.yaml
```

Depending on where you run your service from, it can take a few minutes for your cloud provider to create an external IP for the service.

Once the service has an external IP assigned, ExternalDNS will notice the new service IP address and will synchronize the UltraDNS records.

## Verifying UltraDNS Records

Please verify on the [UltraDNS UI](https://portal.ultradns.com/login) that the records are created under the zone "example.com".

For more information on UltraDNS UI, refer to (https://docs.ultradns.com/Content/MSP_User_Guide/Content/User%20Guides/MSP_User_Guide/Navigation/Moving%20Around%20the%20UI.htm#_Toc2780722).

Select the zone that was created above (or select the appropriate zone if a different zone was used.)

The external IP address will be displayed as a CNAME record for your zone.

## Cleaning Up the Deployment and Service

Now that we have verified that ExternalDNS will automatically manage your UltraDNS records, you can delete example zones that you created in this tutorial:

```
$ kubectl delete service -f nginx.yaml
$ kubectl delete service -f externaldns.yaml
```
## Examples to Manage your Records
### Creating Multiple A Records Target
- First, you want to create a service file called 'apple-banana-echo.yaml'
```yaml
---
kind: Pod
apiVersion: v1
metadata:
  name: example-app
  labels:
    app: apple
spec:
  containers:
    - name: example-app
      image: hashicorp/http-echo
      args:
        - "-text=apple"
---
kind: Service
apiVersion: v1
metadata:
  name: example-service
spec:
  selector:
    app: apple
  ports:
    - port: 5678 # Default port for image
```
- Then, create service file called 'expose-apple-banana-app.yaml' to expose the services. For more information to deploy ingress controller, refer to (https://kubernetes.github.io/ingress-nginx/deploy/)
```yaml
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: example-ingress
  annotations:
    ingress.kubernetes.io/rewrite-target: /
    ingress.kubernetes.io/scheme: internet-facing
    external-dns.alpha.kubernetes.io/hostname: apple.example.com.
    external-dns.alpha.kubernetes.io/target: 10.10.10.1,10.10.10.23
spec:
  rules:
  - http:
      paths:
        - path: /apple
          pathType: Prefix
          backend:
            service:
              name: example-service
              port:
                number: 5678
```
- Then, create the deployment and service:
```console
$ kubectl create -f apple-banana-echo.yaml
$ kubectl create -f expose-apple-banana-app.yaml
$ kubectl create -f external-dns.yaml
```
- Depending on where you run your service from, it can take a few minutes for your cloud provider to create an external IP for the service.
- Please verify on the [UltraDNS UI](https://portal.ultradns.com/login) that the records have been created under the zone "example.com".
- Finally, you will need to clean up the deployment and service. Please verify on the UI afterwards that the records have been deleted from the zone "example.com":
```console
$ kubectl delete -f apple-banana-echo.yaml
$ kubectl delete -f expose-apple-banana-app.yaml
$ kubectl delete -f external-dns.yaml
```
### Creating CNAME Record
- Please note, that prior to deploying the external-dns service, you will need to add the option –txt-prefix=txt- into external-dns.yaml. If this not provided, your records will not be created.
-  First, create a service file called 'apple-banana-echo.yaml'
    - _Config File Example – kubernetes cluster is on-premise not on cloud_
    ```yaml
    ---
    kind: Pod
    apiVersion: v1
    metadata:
      name: example-app
      labels:
        app: apple
    spec:
      containers:
        - name: example-app
          image: hashicorp/http-echo
          args:
            - "-text=apple"
    ---
    kind: Service
    apiVersion: v1
    metadata:
      name: example-service
    spec:
      selector:
        app: apple
      ports:
        - port: 5678 # Default port for image
    ---
    apiVersion: networking.k8s.io/v1
    kind: Ingress
    metadata:
      name: example-ingress
      annotations:
        ingress.kubernetes.io/rewrite-target: /
        ingress.kubernetes.io/scheme: internet-facing
        external-dns.alpha.kubernetes.io/hostname: apple.example.com.
        external-dns.alpha.kubernetes.io/target: apple.cname.com.
    spec:
      rules:
      - http:
          paths:
            - path: /apple
              backend:
                service:
                  name: example-service
                  port:
                    number: 5678
    ```
    - _Config File Example – Kubernetes cluster service from different cloud vendors_
    ```yaml
    ---
    kind: Pod
    apiVersion: v1
    metadata:
      name: example-app
      labels:
        app: apple
    spec:
      containers:
        - name: example-app
          image: hashicorp/http-echo
          args:
            - "-text=apple"
    ---
    kind: Service
    apiVersion: v1
    metadata:
      name: example-service
      annotations:
        external-dns.alpha.kubernetes.io/hostname: my-app.example.com.
    spec:
      selector:
        app: apple
      type: LoadBalancer
      ports:
        - protocol: TCP
          port: 5678
          targetPort: 5678
    ```
- Then, create the deployment and service:
```console
$ kubectl create -f apple-banana-echo.yaml
$ kubectl create -f external-dns.yaml
```
- Depending on where you run your service from, it can take a few minutes for your cloud provider to create an external IP for the service.
- Please verify on the [UltraDNS UI](https://portal.ultradns.com/login), that the records have been created under the zone "example.com".
- Finally, you will need to clean up the deployment and service. Please verify on the UI afterwards that the records have been deleted from the zone "example.com":
```console
$ kubectl delete -f apple-banana-echo.yaml
$ kubectl delete -f external-dns.yaml
```
### Creating Multiple Types Of Records
- Please note, that prior to deploying the external-dns service, you will need to add the option –txt-prefix=txt- into external-dns.yaml. Since you will also be created a CNAME record, If this not provided, your records will not be created.
-  First, create a service file called 'apple-banana-echo.yaml'
    - _Config File Example – kubernetes cluster is on-premise not on cloud_
    ```yaml
    ---
    kind: Pod
    apiVersion: v1
    metadata:
      name: example-app
      labels:
        app: apple
    spec:
      containers:
        - name: example-app
          image: hashicorp/http-echo
          args:
            - "-text=apple"
    ---
    kind: Service
    apiVersion: v1
    metadata:
      name: example-service
    spec:
      selector:
        app: apple
      ports:
        - port: 5678 # Default port for image
    ---
    kind: Pod
    apiVersion: v1
    metadata:
      name: example-app1
      labels:
        app: apple1
    spec:
      containers:
        - name: example-app1
          image: hashicorp/http-echo
          args:
            - "-text=apple"
    ---
    kind: Service
    apiVersion: v1
    metadata:
      name: example-service1
    spec:
      selector:
        app: apple1
      ports:
        - port: 5679 # Default port for image
    ---
    kind: Pod
    apiVersion: v1
    metadata:
      name: example-app2
      labels:
        app: apple2
    spec:
      containers:
        - name: example-app2
          image: hashicorp/http-echo
          args:
            - "-text=apple"
    ---
    kind: Service
    apiVersion: v1
    metadata:
      name: example-service2
    spec:
      selector:
        app: apple2
      ports:
        - port: 5680 # Default port for image
    ---
    apiVersion: networking.k8s.io/v1
    kind: Ingress
    metadata:
      name: example-ingress
      annotations:
        ingress.kubernetes.io/rewrite-target: /
        ingress.kubernetes.io/scheme: internet-facing
        external-dns.alpha.kubernetes.io/hostname: apple.example.com.
        external-dns.alpha.kubernetes.io/target: apple.cname.com.
    spec:
      rules:
      - http:
          paths:
            - path: /apple
              backend:
                service:
                  name: example-service
                  port:
                    number: 5678
    ---
    apiVersion: networking.k8s.io/v1
    kind: Ingress
    metadata:
      name: example-ingress1
      annotations:
        ingress.kubernetes.io/rewrite-target: /
        ingress.kubernetes.io/scheme: internet-facing
        external-dns.alpha.kubernetes.io/hostname: apple-banana.example.com.
        external-dns.alpha.kubernetes.io/target: 10.10.10.3
    spec:
      rules:
      - http:
          paths:
            - path: /apple
              backend:
                service:
                  name: example-service1
                  port:
                    number: 5679
    ---
    apiVersion: networking.k8s.io/v1
    kind: Ingress
    metadata:
      name: example-ingress2
      annotations:
        ingress.kubernetes.io/rewrite-target: /
        ingress.kubernetes.io/scheme: internet-facing
        external-dns.alpha.kubernetes.io/hostname: banana.example.com.
        external-dns.alpha.kubernetes.io/target: 10.10.10.3,10.10.10.20
    spec:
      rules:
      - http:
          paths:
            - path: /apple
              backend:
                service:
                  name: example-service2
                  port:
                    number: 5680
    ```
    - _Config File Example – Kubernetes cluster service from different cloud vendors_
    ```yaml
    ---
    apiVersion: apps/v1
    kind: Deployment
    metadata:
      name: nginx
    spec:
      selector:
        matchLabels:
          app: nginx
      template:
        metadata:
          labels:
            app: nginx
        spec:
          containers:
          - image: nginx
            name: nginx
            ports:
            - containerPort: 80
    ---
    apiVersion: v1
    kind: Service
    metadata:
      name: nginx
      annotations:
        external-dns.alpha.kubernetes.io/hostname: my-app.example.com.
    spec:
      selector:
        app: nginx
      type: LoadBalancer
      ports:
        - protocol: TCP
          port: 80
          targetPort: 80
    ---
    kind: Pod
    apiVersion: v1
    metadata:
      name: example-app
      labels:
        app: apple
    spec:
      containers:
        - name: example-app
          image: hashicorp/http-echo
          args:
            - "-text=apple"
    ---
    kind: Service
    apiVersion: v1
    metadata:
      name: example-service
    spec:
      selector:
        app: apple
      ports:
        - port: 5678 # Default port for image
    ---
    kind: Pod
    apiVersion: v1
    metadata:
      name: example-app1
      labels:
        app: apple1
    spec:
      containers:
        - name: example-app1
          image: hashicorp/http-echo
          args:
            - "-text=apple"
    ---
    apiVersion: extensions/v1beta1
    kind: Service
    apiVersion: v1
    metadata:
      name: example-service1
    spec:
      selector:
        app: apple1
      ports:
        - port: 5679 # Default port for image
    ---
    apiVersion: networking.k8s.io/v1
    kind: Ingress
    metadata:
      name: example-ingress
      annotations:
        ingress.kubernetes.io/rewrite-target: /
        ingress.kubernetes.io/scheme: internet-facing
        external-dns.alpha.kubernetes.io/hostname: apple.example.com.
        external-dns.alpha.kubernetes.io/target: 10.10.10.3,10.10.10.25
    spec:
      rules:
      - http:
          paths:
            - path: /apple
              backend:
                service:
                  name: example-service
                  port:
                    number: 5678
    ---
    apiVersion: networking.k8s.io/v1
    kind: Ingress
    metadata:
      name: example-ingress1
      annotations:
        ingress.kubernetes.io/rewrite-target: /
        ingress.kubernetes.io/scheme: internet-facing
        external-dns.alpha.kubernetes.io/hostname: apple-banana.example.com.
        external-dns.alpha.kubernetes.io/target: 10.10.10.3
    spec:
      rules:
      - http:
          paths:
            - path: /apple
              backend:
                service:
                  name: example-service1
                  port:
                    number: 5679
    ```
- Then, create the deployment and service:
```console
$ kubectl create -f apple-banana-echo.yaml
$ kubectl create -f external-dns.yaml
```
- Depending on where you run your service from, it can take a few minutes for your cloud provider to create an external IP for the service.
- Please verify on the [UltraDNS UI](https://portal.ultradns.com/login), that the records have been created under the zone "example.com".
- Finally, you will need to clean up the deployment and service. Please verify on the UI afterwards that the records have been deleted from the zone "example.com":
```console
$ kubectl delete -f apple-banana-echo.yaml
$ kubectl delete -f external-dns.yaml```

UltraDNS  This tutorial describes how to setup ExternalDNS for usage within a Kubernetes cluster using UltraDNS   For this tutorial  please make sure that you are using a version     0 7 2   of ExternalDNS      Managing DNS with UltraDNS  If you would like to read up on the UltraDNS service  you can find additional details here   Introduction to UltraDNS  https   docs ultradns com    Before proceeding  please create a new DNS Zone that you will create your records in for this tutorial process  For the examples in this tutorial  we will be using  example com  as our Zone      Setting Up UltraDNS Credentials  The following environment variables will be needed to run ExternalDNS with UltraDNS    ULTRADNS USERNAME   ULTRADNS PASSWORD     ULTRADNS BASEURL   ULTRADNS ACCOUNTNAME  optional variable       Deploying ExternalDNS  Connect your  kubectl  client to the cluster you want to test ExternalDNS with  Then  apply one of the following manifests file to deploy ExternalDNS     Note  We are assuming the zone is already present within UltraDNS    Note  While creating CNAMES as target endpoints  the    txt prefix  option is mandatory      Manifest  for clusters without RBAC enabled      yaml apiVersion  apps v1 kind  Deployment metadata    name  external dns spec    strategy      type  Recreate   selector      matchLabels        app  external dns   template      metadata        labels          app  external dns     spec        containers          name  external dns         image  registry k8s io external dns external dns v0 15 0         args              source service              source ingress   ingress is also possible             domain filter example com    Recommended  We recommend to use this filter as it minimize the time to propagate changes  as there are less number of zones to look into               provider ultradns             txt prefix txt          env            name  ULTRADNS USERNAME           value               name  ULTRADNS PASSWORD    The password is required to be BASE64 encrypted            value               name  ULTRADNS BASEURL           value   https   api ultradns com             name  ULTRADNS ACCOUNTNAME           value              Manifest  for clusters with RBAC enabled      yaml apiVersion  v1 kind  ServiceAccount metadata    name  external dns     apiVersion  rbac authorization k8s io v1 kind  ClusterRole metadata    name  external dns rules    apiGroups         resources    services   endpoints   pods     verbs    get   watch   list     apiGroups    extensions     resources    ingresses     verbs    get   watch   list     apiGroups         resources    nodes     verbs    list   watch       apiVersion  rbac authorization k8s io v1 kind  ClusterRoleBinding metadata    name  external dns viewer roleRef    apiGroup  rbac authorization k8s io   kind  ClusterRole   name  external dns subjects    kind  ServiceAccount   name  external dns   namespace  default     apiVersion  apps v1 kind  Deployment metadata    name  external dns spec    strategy      type  Recreate   selector      matchLabels        app  external dns   template      metadata        labels          app  external dns     spec        serviceAccountName  external dns       containers          name  external dns         image  registry k8s io external dns external dns v0 15 0         args              source service              source ingress             domain filter example com   Recommended  We recommend to use this filter as it minimize the time to propagate changes  as there are less number of zones to look into               provider ultradns             txt prefix txt          env            name  ULTRADNS USERNAME           value               name  ULTRADNS PASSWORD   The password is required to be BASE64 encrypted            value               name  ULTRADNS BASEURL           value   https   api ultradns com             name  ULTRADNS ACCOUNTNAME           value             Deploying an Nginx Service  Create a service file called  nginx yaml  with the following contents      yaml apiVersion  apps v1 kind  Deployment metadata    name  nginx spec    selector      matchLabels        app  nginx   template      metadata        labels          app  nginx     spec        containers          image  nginx         name  nginx         ports            containerPort  80     apiVersion  v1 kind  Service metadata    name  nginx   annotations      external dns alpha kubernetes io hostname  my app example com  spec    selector      app  nginx   type  LoadBalancer   ports        protocol  TCP       port  80       targetPort  80      Please note the annotation on the service  Use the same hostname as the UltraDNS zone created above   ExternalDNS uses this annotation to determine what services should be registered with DNS  Removing the annotation will cause ExternalDNS to remove the corresponding DNS records      Creating the Deployment and Service      console   kubectl create  f nginx yaml   kubectl create  f external dns yaml      Depending on where you run your service from  it can take a few minutes for your cloud provider to create an external IP for the service   Once the service has an external IP assigned  ExternalDNS will notice the new service IP address and will synchronize the UltraDNS records      Verifying UltraDNS Records  Please verify on the  UltraDNS UI  https   portal ultradns com login  that the records are created under the zone  example com    For more information on UltraDNS UI  refer to  https   docs ultradns com Content MSP User Guide Content User 20Guides MSP User Guide Navigation Moving 20Around 20the 20UI htm  Toc2780722    Select the zone that was created above  or select the appropriate zone if a different zone was used    The external IP address will be displayed as a CNAME record for your zone      Cleaning Up the Deployment and Service  Now that we have verified that ExternalDNS will automatically manage your UltraDNS records  you can delete example zones that you created in this tutorial         kubectl delete service  f nginx yaml   kubectl delete service  f externaldns yaml        Examples to Manage your Records     Creating Multiple A Records Target   First  you want to create a service file called  apple banana echo yaml      yaml     kind  Pod apiVersion  v1 metadata    name  example app   labels      app  apple spec    containers        name  example app       image  hashicorp http echo       args              text apple      kind  Service apiVersion  v1 metadata    name  example service spec    selector      app  apple   ports        port  5678   Default port for image       Then  create service file called  expose apple banana app yaml  to expose the services  For more information to deploy ingress controller  refer to  https   kubernetes github io ingress nginx deploy      yaml apiVersion  networking k8s io v1 kind  Ingress metadata    name  example ingress   annotations      ingress kubernetes io rewrite target        ingress kubernetes io scheme  internet facing     external dns alpha kubernetes io hostname  apple example com      external dns alpha kubernetes io target  10 10 10 1 10 10 10 23 spec    rules      http        paths            path   apple           pathType  Prefix           backend              service                name  example service               port                  number  5678       Then  create the deployment and service     console   kubectl create  f apple banana echo yaml   kubectl create  f expose apple banana app yaml   kubectl create  f external dns yaml       Depending on where you run your service from  it can take a few minutes for your cloud provider to create an external IP for the service    Please verify on the  UltraDNS UI  https   portal ultradns com login  that the records have been created under the zone  example com     Finally  you will need to clean up the deployment and service  Please verify on the UI afterwards that the records have been deleted from the zone  example com      console   kubectl delete  f apple banana echo yaml   kubectl delete  f expose apple banana app yaml   kubectl delete  f external dns yaml         Creating CNAME Record   Please note  that prior to deploying the external dns service  you will need to add the option  txt prefix txt  into external dns yaml  If this not provided  your records will not be created     First  create a service file called  apple banana echo yaml         Config File Example   kubernetes cluster is on premise not on cloud         yaml             kind  Pod     apiVersion  v1     metadata        name  example app       labels          app  apple     spec        containers            name  example app           image  hashicorp http echo           args                  text apple              kind  Service     apiVersion  v1     metadata        name  example service     spec        selector          app  apple       ports            port  5678   Default port for image             apiVersion  networking k8s io v1     kind  Ingress     metadata        name  example ingress       annotations          ingress kubernetes io rewrite target            ingress kubernetes io scheme  internet facing         external dns alpha kubernetes io hostname  apple example com          external dns alpha kubernetes io target  apple cname com      spec        rules          http            paths                path   apple               backend                  service                    name  example service                   port                      number  5678                Config File Example   Kubernetes cluster service from different cloud vendors         yaml             kind  Pod     apiVersion  v1     metadata        name  example app       labels          app  apple     spec        containers            name  example app           image  hashicorp http echo           args                  text apple              kind  Service     apiVersion  v1     metadata        name  example service       annotations          external dns alpha kubernetes io hostname  my app example com      spec        selector          app  apple       type  LoadBalancer       ports            protocol  TCP           port  5678           targetPort  5678           Then  create the deployment and service     console   kubectl create  f apple banana echo yaml   kubectl create  f external dns yaml       Depending on where you run your service from  it can take a few minutes for your cloud provider to create an external IP for the service    Please verify on the  UltraDNS UI  https   portal ultradns com login   that the records have been created under the zone  example com     Finally  you will need to clean up the deployment and service  Please verify on the UI afterwards that the records have been deleted from the zone  example com      console   kubectl delete  f apple banana echo yaml   kubectl delete  f external dns yaml         Creating Multiple Types Of Records   Please note  that prior to deploying the external dns service  you will need to add the option  txt prefix txt  into external dns yaml  Since you will also be created a CNAME record  If this not provided  your records will not be created     First  create a service file called  apple banana echo yaml         Config File Example   kubernetes cluster is on premise not on cloud         yaml             kind  Pod     apiVersion  v1     metadata        name  example app       labels          app  apple     spec        containers            name  example app           image  hashicorp http echo           args                  text apple              kind  Service     apiVersion  v1     metadata        name  example service     spec        selector          app  apple       ports            port  5678   Default port for image             kind  Pod     apiVersion  v1     metadata        name  example app1       labels          app  apple1     spec        containers            name  example app1           image  hashicorp http echo           args                  text apple              kind  Service     apiVersion  v1     metadata        name  example service1     spec        selector          app  apple1       ports            port  5679   Default port for image             kind  Pod     apiVersion  v1     metadata        name  example app2       labels          app  apple2     spec        containers            name  example app2           image  hashicorp http echo           args                  text apple              kind  Service     apiVersion  v1     metadata        name  example service2     spec        selector          app  apple2       ports            port  5680   Default port for image             apiVersion  networking k8s io v1     kind  Ingress     metadata        name  example ingress       annotations          ingress kubernetes io rewrite target            ingress kubernetes io scheme  internet facing         external dns alpha kubernetes io hostname  apple example com          external dns alpha kubernetes io target  apple cname com      spec        rules          http            paths                path   apple               backend                  service                    name  example service                   port                      number  5678             apiVersion  networking k8s io v1     kind  Ingress     metadata        name  example ingress1       annotations          ingress kubernetes io rewrite target            ingress kubernetes io scheme  internet facing         external dns alpha kubernetes io hostname  apple banana example com          external dns alpha kubernetes io target  10 10 10 3     spec        rules          http            paths                path   apple               backend                  service                    name  example service1                   port                      number  5679             apiVersion  networking k8s io v1     kind  Ingress     metadata        name  example ingress2       annotations          ingress kubernetes io rewrite target            ingress kubernetes io scheme  internet facing         external dns alpha kubernetes io hostname  banana example com          external dns alpha kubernetes io target  10 10 10 3 10 10 10 20     spec        rules          http            paths                path   apple               backend                  service                    name  example service2                   port                      number  5680                Config File Example   Kubernetes cluster service from different cloud vendors         yaml             apiVersion  apps v1     kind  Deployment     metadata        name  nginx     spec        selector          matchLabels            app  nginx       template          metadata            labels              app  nginx         spec            containers              image  nginx             name  nginx             ports                containerPort  80             apiVersion  v1     kind  Service     metadata        name  nginx       annotations          external dns alpha kubernetes io hostname  my app example com      spec        selector          app  nginx       type  LoadBalancer       ports            protocol  TCP           port  80           targetPort  80             kind  Pod     apiVersion  v1     metadata        name  example app       labels          app  apple     spec        containers            name  example app           image  hashicorp http echo           args                  text apple              kind  Service     apiVersion  v1     metadata        name  example service     spec        selector          app  apple       ports            port  5678   Default port for image             kind  Pod     apiVersion  v1     metadata        name  example app1       labels          app  apple1     spec        containers            name  example app1           image  hashicorp http echo           args                  text apple              apiVersion  extensions v1beta1     kind  Service     apiVersion  v1     metadata        name  example service1     spec        selector          app  apple1       ports            port  5679   Default port for image             apiVersion  networking k8s io v1     kind  Ingress     metadata        name  example ingress       annotations          ingress kubernetes io rewrite target            ingress kubernetes io scheme  internet facing         external dns alpha kubernetes io hostname  apple example com          external dns alpha kubernetes io target  10 10 10 3 10 10 10 25     spec        rules          http            paths                path   apple               backend                  service                    name  example service                   port                      number  5678             apiVersion  networking k8s io v1     kind  Ingress     metadata        name  example ingress1       annotations          ingress kubernetes io rewrite target            ingress kubernetes io scheme  internet facing         external dns alpha kubernetes io hostname  apple banana example com          external dns alpha kubernetes io target  10 10 10 3     spec        rules          http            paths                path   apple               backend                  service                    name  example service1                   port                      number  5679           Then  create the deployment and service     console   kubectl create  f apple banana echo yaml   kubectl create  f external dns yaml       Depending on where you run your service from  it can take a few minutes for your cloud provider to create an external IP for the service    Please verify on the  UltraDNS UI  https   portal ultradns com login   that the records have been created under the zone  example com     Finally  you will need to clean up the deployment and service  Please verify on the UI afterwards that the records have been deleted from the zone  example com      console    kubectl delete  f apple banana echo yaml   kubectl delete  f external dns yaml