This topic describes how GKE on AWS interacts with Domain Name
Services (DNS) on both your AWS Virtual Private Cloud (VPC) and clusters.

## AWS VPC DNS

This section describes how you can configure an AWS Virtual Private Cloud (VPC)
for GKE on AWS.

### Configuring VPC DNS

GKE on AWS supports a variety of DNS configurations in your AWS VPC.
You configure your VPC's DNS settings when you
[Create a DHCP options set](https://docs.aws.amazon.com/vpc/latest/userguide/VPC_DHCP_Options.html#CreatingaDHCPOptionSet).
For more information, see
[DNS support for your VPC](https://docs.aws.amazon.com/vpc/latest/userguide/vpc-dns.html).

You can configure the following options:

DNS Hostnames
:   This sets whether EC2 instances with public IP addresses get corresponding
    public DNS hostnames. You set this value using the `enableDNSHostnames`
    field in your VPC's DHCP option set. For more information, see
    [VPC DNS Hostnames](https://docs.aws.amazon.com/vpc/latest/userguide/vpc-dns.html#vpc-dns-hostnames)
    and
    [DHCP options sets for your VPC](https://docs.aws.amazon.com/vpc/latest/userguide/VPC_DHCP_Options.html).

EC2 DNS Hostnames
:   This sets whether EC2 instances receive a default DNS hostname or a custom
    DNS hostname.

DNS server
:   Whether your VPC's DHCP options set uses either the AWS Route53 DNS server
    (with the `AmazonProvidedDNS` option), or a hosted DNS server.

#### Supported VPC DNS configurations

The following table includes DNS configurations supported by
GKE on AWS:

| Enable DNS hostnames | EC2 DNS hostnames | DNS server | Supported? |
|---|---|---|---|
| `true` | Default | AWS Route53 | Yes |
| `false` | Default | AWS Route53 | Yes |
| `true` | Custom | AWS Route53 | Yes |
| `false` | Custom | AWS Route53 | Yes |
| `true` | Custom | Hosted | Yes |
| `false` | Custom | Hosted | Yes |
| `true` | Default | Hosted | No |
| `false` | Default | Hosted | No |

## Service discovery

Service discovery is the process where workloads discover services without
knowing their IP address. This section describes how
GKE on AWS implements service discovery and managed DNS.

Kubernetes automatically generates service names that use the following
[specification](https://github.com/kubernetes/dns/blob/master/docs/specification.md):

`service.namespace.svc.zone`

Where:

- `service`: your service's name
- `namespace`: your service's Namespace
- `zone`: your service's AWS zone

Workloads also access external services--- for example `example.net`---
using DNS names. For more information on the behavior of DNS in Kubernetes, see
[DNS for Services and Pods](https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/).

### CoreDNS

GKE on AWS uses
[CoreDNS](https://kubernetes.io/blog/2018/07/10/coredns-ga-for-kubernetes-cluster-dns/)
to resolve DNS names within clusters. CoreDNS runs as a redundant, scaled
[Deployment](https://kubernetes.io/docs/concepts/workloads/controllers/deployment/)
in the `kube-system`
namespace. The CoreDNS deployment has a
[Service](https://docs.cloud.google.com/kubernetes-engine/docs/concepts/service.md.txt) that groups the CoreDNS Pods
and gives them a single IP address. The CoreDNS Deployment scales with the
cluster's size and usage.

### NodeLocal DNSCache

GKE on AWS uses
[NodeLocal DNSCache](https://kubernetes.io/docs/tasks/administer-cluster/nodelocaldns/)
to improve DNS lookup performance. NodeLocal DNSCache runs as a
[DaemonSet](https://kubernetes.io/docs/concepts/workloads/controllers/daemonset/)
on each node in your cluster. When a Pod makes a DNS request, the request first
goes to the DNS cache on the same node. If the cache can't resolve the DNS
request, the cache forwards the request to either:

- CoreDNS for an internal name--- for example `foo.bar.svc.cluster.local`
- The [Amazon DNS server](https://docs.aws.amazon.com/vpc/latest/userguide/vpc-dns.html#vpc-dns-support), for an external name--- for example `example.net`

### Calico

GKE on AWS uses Calico to establish
[BGP](https://wikipedia.org/wiki/Border_Gateway_Protocol) routing
between cluster nodes.

> [!NOTE]
> **Note:** For Calico to function correctly, GKE on AWS deploys Pods such as `calico-node` to your nodes. These Pods have elevated [RBAC permissions](https://kubernetes.io/docs/reference/access-authn-authz/authorization/#determine-the-request-verb), such as the ability to update or patch all Pods and nodes. These permissions are required to interpret Kubernetes objects and program network topologies based on your configuration.

## What's next

- Read about AWS [DNS support for your VPC](https://docs.aws.amazon.com/vpc/latest/userguide/vpc-dns.html).
- For an overview of how DNS is used in Kubernetes clusters, see [DNS for Services and Pods](https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/).