Hostname in Ingress yml kubernetes cluster

Viewed 2784

I am using kubernetes cluster provided from infra team(not minikube), I have created traefik ingress controller with all the configuration, ingress container, our applications are running in the cluster. now i want to access the application using domain name or ip address, for this, i have created a Ingress resource as below

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: traefik-web-ui
  namespace: kube-system
spec:
  rules:
  - host: dummy.domain.com
    http:
     paths:
     - path: /
      backend:
         serviceName: app-web-ui
         servicePort: web

What i am not getting here is the host name, since the applications are running in cluster, should this host name be the cluster master node name? what should be the hostname or ip address in the actual prod environment.

Note: we are not using any cloud providers, its just plain docker with kubernetes cluster environment(cluster is configured in Mirantis kubernetes and client is Windows).

3 Answers

If you using any Load balancer behind the ingress or any ingress controller with a load Balancer you have to use the Load balancer IP everywhere.

So you have to map the Loadbalancer IP into the DNS for dummy.domain.com, or else if you are not using the load balancer you have to use the Master IP.

You are testing from the local machine you can add the entry of domain and IP in etc/host file and check.

The Ingress object configures the ingress controller to route any request for dummy.domain.com to the application you just deployed. You will need to update the /etc/hosts file on your host machine to map dummy.domain.com to the ingress controller VM’s IP address for example 2192.168.50.212, this address is the master ip address.

For more details visit this tutorial: Run the HAProxy Kubernetes Ingress Controller Outside of Your Kubernetes Cluster

I was able to solve this issue by requesting new domain name(dns entry) from Infra team, for this domain name i have mapped the Master nodes Ip address of the cluster, we have 3 manager nodes, so i have mapped the domain name(dummy.domain.com) with 3 manger nodes Ip address.

After this i was able to access the application with DNS name and the node port(Node port is mentioned in service.yml of app-web-ui application).

https://dummy.domain.com:3429

Related