Set Up a Custom Domain
Serve an application on a domain that you own, for example api.yourcompany.com. A PublicIngress creates the load balancer and the domain. An HttpRoute sends traffic to your application.
By default, each route gets a long generated name:
[route-name].[ingress-name].[project-name].[env-name].[ou-name].[org-public-domain]
Set spec.domain on the PublicIngress to replace it.
Prerequisites
- A deployed application.
- A domain that your organization owns.
- The names of your
organization,organizational-unit,environmentandproject.
Steps
-
Create the
PublicIngressmanifest.apiVersion: lowops.manifests.v1
kind: PublicIngress
metadata:
name: api-gateway
project: payment-gateway
environment: production
organizational-unit: retail-banking
organization: fincorp
spec:
domain:
name: api.fincorp.com # the platform creates a managed DNS zone and certificates
iapPermissions: # optional: without it, the ingress is open to the internet
groups:
- "fincorp-employees@fincorp.com" -
Create the
HttpRoutemanifest. It sends a path to your application.apiVersion: lowops.manifests.v1
kind: HttpRoute
metadata:
name: payment-api-route
public-ingress: api-gateway # links the route to the ingress
project: payment-gateway
environment: production
organizational-unit: retail-banking
organization: fincorp
spec:
rules:
- matches:
- prefixMatch: /v1/payments
action:
destinations:
- deploymentConfig: payment-processing-api # an existing Application
port: 8080 -
Commit both manifests in one pull request and merge it.
-
Find the name servers of the new DNS zone. They are in the
computedblock of thePublicIngressmanifest after the run. -
At your domain registrar, replace the
NSrecords of the domain with those name servers. AnArecord is not enough.
If DNSSEC is on for your domain, remove the DS record at the registrar first. Wait for its TTL to expire, up to about 24 hours. If you change the name servers before that, resolvers that check DNSSEC return SERVFAIL for the whole domain. You can turn DNSSEC on again for the new zone later.
Verify
The platform cannot issue the managed certificate until the NS change spreads. That takes a few minutes to 48 hours. After that, the application answers over HTTPS on your domain.
Serve the bare domain
Routes publish at <route-name>.<domain>, so nothing answers on the bare domain. Set apex to send visitors to www:
spec:
domain:
name: fincorp.com
apex: REDIRECT_TO_WWW
The platform adds a certificate, an A record for the bare domain and a permanent (301) redirect to https://www.fincorp.com. Add a route named www.
With apex on, the platform owns the A record of the bare domain. It replaces a record that you made by hand in the managed zone. It deletes the record when you turn apex off.