kuberneteskubectlkubernetes-ingresskubernetes-pod

Hostname in Ingress yml kubernetes cluster


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).


Solution

  • 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.