---
schema_version: "1"
id: 31a93d87be587594456f0e92bb7a3d8d638c65730cb3b2efea9233f77d42b177
title: Provide a Domain Name for an Application on Your Kubernetes Cluster
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/gateway/latest/gateway-k8-external-dns.md
canonical_url: https://docs.mulesoft.com/gateway/latest/gateway-k8-external-dns
source_site: docs.mulesoft.com
content_type: documentation
content_hash: bd1b55acc0a68f52b83b5536d9b6edf832c4292a8a469fa91768cc4948b14d05
description: MuleSoft Documentation Site
release: "1.14"
latest: true
---
---
product: Omni Gateway
version: 1.14
is-latest-version: true
---

# Provide a Domain Name for an Application on Your Kubernetes Cluster

> For the full documentation index, see: https://docs.mulesoft.com/llms.txt

Use ExternalDNS to expose an application or service on your Kubernetes cluster through a domain name
instead of a difficult-to-understand external IP or random host name.

[ExternalDNS](https://github.com/kubernetes-sigs/external-dns/blob/master/README.md) is an open
source project that supports DNS configurations on many DNS providers. The tool is _not_ a DNS
server or provider. Instead, ExternalDNS discovers Kubernetes resources through public DNS servers
and configures the resources for supported DNS providers.

This guide uses ExternalDNS to configure domain names in an AWS Route 53 provider, which is one of
the stable providers supported by ExternalDNS.

## Before You Begin

Ensure that the following prerequisites are in place:

- A Kubernetes cluster on AWS

- An Omni Gateway deployment to an AWS cluster or a registered Omni Gateway instance (gateway)

  For gateway registration and deployment processes, see
  [Setting Up Self-Managed Omni Gateway](https://docs.mulesoft.com/gateway/latest/gateway-set-up) or
  [Getting Started with Self-Managed Omni Gateway in a Kubernetes Cluster](https://docs.mulesoft.com/gateway/latest/gateway-k8-getting-started).

- An AWS Identity and Access Management (IAM) policy that allows ExternalDNS to update Amazon Route
  53 Resource Record Sets and Hosted Zones

  To use another target or create the IAM Policy with these permissions, see the
  [ExternalDNS documentation](https://github.com/kubernetes-sigs/external-dns/blob/master/docs/tutorials/aws.md).

## Add ExternalDNS to Your Cluster

Add ExternalDNS (`external-dns`) to your cluster by creating and deploying a YAML configuration file
with the following content to your cluster:

1.  Create a YAML file with the following settings.

    ```yaml
    apiVersion: apps/v1
    kind: Deployment
    metadata:
      name: external-dns
      labels:
        app.kubernetes.io/name: external-dns
    spec:
      strategy:
        type: Recreate
      selector:
        matchLabels:
          app.kubernetes.io/name: external-dns
      template:
        metadata:
          labels:
            app.kubernetes.io/name: external-dns
        spec:
          containers:
            - name: external-dns
              image: registry.k8s.io/external-dns/external-dns:v0.13.1
              args:
                - --source=service
                - --source=ingress
                - --domain-filter=<your-domain> # makes only hosted zones visible
                - --provider=aws
                - --policy=upsert-only # prevents record deletion
                - --aws-zone-type=public # public zones only
                - --registry=txt
                - --txt-owner-id=my-hostedzone-identifier
              env:
                - name: AWS_DEFAULT_REGION
                  value: <aws-region> # sets the EKS region
          # # Uncomment the following settings when using static credentials
          #       - name: AWS_SHARED_CREDENTIALS_FILE
          #        value: /.aws/credentials
          #     volumeMounts:
          #       - name: aws-credentials
          #         mountPath: /.aws
          #         readOnly: true
          # volumes:
          #   - name: aws-credentials
          #     secret:
          #       secretName: external-dns
    ```

2.  In your new YAML file, set the following options, as needed, for your deployment:

    - `args` options:

      - `- --domain-filter=<your-domain>`: Make hosted zones that match your domain visible to
        ExternalDNS. Omit this option to process all available hosted zones.

        The option is critical for making `external-dns` work as intended.

      - `- --policy=upsert-only`: Prevent ExternalDNS from deleting any records. Omit this option to
        enable full synchronization.

      - `- --aws-zone-type=public`: Make only public hosted zones visible. Valid values are
        `public`, `private`, or no value for both types of zones.

    - `env` option `value: <aws-region>`: Set the region in which your EKS cluster is installed, for
      example, `us-east-1`.

3.  If you are using static credentials, remove the comments (`#`) from the lines that contain
    hidden `env` and `volumes` configurations.

4.  Apply the configuration to your cluster by using the following command from a terminal window:

    ```kubctl
    kubectl create --filename <external-dns-yaml> --namespace <your-namespace>
    ```

## Set DNS Names through Your Helm Chart for Omni Gateway

Use the `extraAnnotations` parameter with `helm upgrade` to set the domain names. This parameter is
described in the
[Helm chart for Omni Gateway (flex-gateway)](https://artifacthub.io/packages/helm/flex-gateway/flex-gateway).

1.  Create a YAML configuration file to specify an ExternalDNS key and a comma-separated set of
    domain values.

    Replace the placeholder values `<domain-0>,…​,<domain-N>` with your domains:

    extraAnnotations: external-dns.alpha.kubernetes.io/hostname: <domain-0>,...,<domain-N>

2.  Use the `-f` option to pass your configuration file to the `helm upgrade` command.

    The command options to use depend on whether your registered gateway is deployed to a cluster:

    1.  If you are deploying Omni Gateway to the cluster for the first time, run the following
        command, replacing the placeholder values with the path to your gateway’s registration YAML
        file (by default, `registration.yaml`) and your domain names:

        ```helm
        helm -n gateway upgrade \
        -i --create-namespace \
        --wait ingress flex-gateway/flex-gateway \
        --set-file registration.content=<path-to-registration> \
        -f <your-YAML-config-file>
        ```

    2.  If you are updating a running gateway with the annotation, run the following command:

        ```helm
        helm -n gateway upgrade \
        --wait ingress flex-gateway/flex-gateway \
        --reuse-values \
        -f <your-YAML-config-file>
        ```
