Skip to content

Domain Setup

Tim-Smans edited this page May 23, 2025 · 1 revision

Linking a Domain to External Kubernetes IP

This page explains how to connect your custom domain (e.g., tracker.mydomain.com) to the external IP address of your Kubernetes Ingress LoadBalancer. This makes your backend or frontend accessible over the internet using a friendly URL.


Requirements

  • A registered domain name (e.g., from Namecheap, OVH, Google Domains, etc.).
  • Access to your domain's DNS settings.
  • The external IP address of your Kubernetes Ingress (typically on GKE).
  • An Ingress controller (e.g., NGINX or GKE default).

Step 1: Get the External IP Address

Run this command to retrieve the external IP of your Ingress resource:

kubectl get svc -n ingress-nginx

Example output:

NAME                                               TYPE           CLUSTER-IP     EXTERNAL-IP    PORT(S)                      AGE
nginx-ingress-ingress-nginx-controller             LoadBalancer   10.52.10.238   34.88.154.35   80:30274/TCP,443:31253/TCP   9d
nginx-ingress-ingress-nginx-controller-admission   ClusterIP      10.52.5.44     <none>         443/TCP                      9d

Copy the IP address, for example: 34.88.154.35


Step 2: Add an A Record in DNS

  1. Log into your domain provider's dashboard.
  2. Go to DNS settings for your domain.
  3. Add a new A record like this:
Type Name (Host) Value (IP) TTL
A tracker 34.88.154.35 Default

This will point tracker.mydomain.com to your Ingress IP.

If you want to point the root domain (e.g., mydomain.com), set the Name/Host field to @.


Step 3: Update Ingress Host

Make sure your Kubernetes Ingress YAML (In Terraform) includes the domain:

spec:
  rules:
    - host: tracker.mydomain.com
      http:
        paths:
          - path: /
            pathType: Prefix
            backend:
              service:
                name: your-service-name
                port:
                  number: 80

Then make sure you apply the terraform update.

terraform apply

Clone this wiki locally