Configure a Custom Domain Name for HTTPRoute¶
When you create a HTTPRoute under amazon-vpc-lattice gatewayclass, the controller creates a AWS VPC Lattice Service during reconciliation.
VPC Lattice generates a unique Fully Qualified Domain Name (FQDN) for you; however, this auto-generated domain name is not easy to remember.
If you'd prefer to use a custom domain name for a HTTPRoute, you can specify them in hostname field of HTTPRoute. Here is one example:
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
name: review
spec:
hostnames:
- review.my-test.com # this is the custom domain name
parentRefs:
- name: my-hotel
sectionName: http
rules:
- backendRefs:
- name: review2
kind: Service
port: 8090
matches:
- path:
type: PathPrefix
value: /review2
Managing DNS records using ExternalDNS¶
To register custom domain names to your DNS provider, we recommend using ExternalDNS.
The Amazon VPC Lattice Gateway API Controller supports ExternalDNS integration through CRD source - the controller will manage DNSEndpoint resource for you.
To use ExternalDNS with the Amazon VPC Lattice Gateway API Controller, you need to:
-
Install
DNSEndpointCRD. This is bundled with both Gateway API Controller Helm chart andfiles/controller-installation/deploy-*.yamlmanifest, but also can be installed manually by the following command:Note
If the
DNSEndpointCRD does not exist,DNSEndpointresource will not be created nor will be managed by the controller. -
Restart the controller if running already.
- Run ExternalDNS controller watching
crdsource. The following example command runs ExternalDNS compiled from source, using AWS Route53 provider: - Create HTTPRoutes and Services. The controller should create
DNSEndpointresource owned by the HTTPRoute you created. - ExternalDNS will watch the changes and create DNS record on the configured DNS provider.
Notes¶
- You MUST have a registered hosted zone (e.g.
my-test.com) in Route53 and complete thePrerequisitesmentioned in this section of the Amazon VPC Lattice documentation. - If you are not using ExternalDNS, you should manually associate your custom domain name with your service following this section of the Amazon VPC Lattice documentation.