Configure Magic DNS Service

This guide explains how set up a Magic DNS using a service like nip.io to access your cluster if you do not already have a domain name set up. This enables you to access inference services using a domain name, without the need for port-forwarding.

Before You Start

  • You must have admin access to the Kubernetes cluster
  • Alternative magic DNS solutions include: localtls, sslip.io, and logal.gd.

How to Configure Magic DNS

Quick Command

You can run the following command to quickly configure the magic DNS service in one step. This command creates a ConfigMap in the knative-serving namespace with the external IP address of your cluster:

kubectl create configmap config-domain \
--namespace knative-serving \
--from-literal <CLUSTER-EXTERNAL-IP>.nip.io="" \
--dry-run=client -o yaml | kubectl replace -f -

Step-by-Step Guide

You can also follow these steps to configure the magic DNS service:

  1. Determine the external IP address of your cluster:
    kubectl get svc -n istio-system istio-ingressgateway
    NAME                   TYPE           CLUSTER-IP      EXTERNAL-IP     PORT(S)                                      AGE
    istio-ingressgateway   LoadBalancer   10.122.10.169   104.198.70.37   15021:32440/TCP,80:30423/TCP,443:30462/TCP   6h59m
  2. Edit the cluster domain name:
    kubectl edit cm config-domain --namespace knative-serving
  3. Change example.com to <SVC_EXTERNAL_IP>.nip.io:
    apiVersion: v1
    data:
      <SVC_EXTERNAL_IP>.nip.io: ""
    kind: ConfigMap

How to Access an Inference Service

You can now access an inference service using the endpoint value in the aioli deployment show <DEPLOYMENT_NAME> output:

...
state:
  endpoint: http://<deployment-name>.default.104.198.70.37.nip.io
  nativeAppName: <deployment-name>-predictor-00001
  status: Ready
  trafficPercentage: 100
status: Ready