Configure Ingress to the Admin Console on an Existing Cluster

I’ve installed the admin console to an existing Kubernetes cluster, and can access it via the port-forward that is created by the kubectl kots admin-console cli command. This works for the initial setup, but I would like to provide more permanent access to the admin console so that I don’t have to start a port-forward each time. How should I go about this?

You can leverage Kubernetes Ingress to route traffic from outside of the cluster to services within the cluster.

Here’s an example of how you might do that for the admin console:

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: kotsadm
spec:
  rules:
  - host: 'admin.example.com'
    http:
      paths:
      - path: /
        pathType: Prefix
        backend:
          service:
            name: kotsadm
            port:
              number: 3000

This configuration uses name based virtual hosting to route HTTP traffic bound for admin.example.com to the kotsadm service that is running within the cluster.

Note, admin.example.com must resolve to the load balancer IP address for users accessing the admin console.

If you need to test the ingress configuration prior to setting up DNS, you can run:

curl --resolve admin.example.com:80:<load-balancer-ip> http://admin.example.com/
1 Like