Registration of services in the Consul via inject side-car with ExternalIP Ingress Controller

We use the consul-connect service-mesh solution in our Kubernetes cluster with the ingress Ambassador. Now services are registered in Consul SD with POD IP. If I try to access this service from the local network (outside the kubernetes cluster) then this service will be unreachable.
And this is logical since the service is registered with POD IP, and the PODS network is available only inside the Kubernetes cluster.

Based on this, I have a question:

How to register services with the IP address of the ingress controller, through which annotation can this be done?

I will explain. We want to register services with the External IP address of the ingress controller so that all incoming traffic from the local network to the kubernetes cluster is routed through ingress.

One solution for becoming a reachable registered service is to use CNI Plugin - “Calico”, but I don’t want to use it.

Hi, so just to confirm: you want to use Consul to route to the Ingress controller’s external IP?

I think the only way to do this is to create new services that route to the IP. You can’t use the service names already registered in Consul Connect because Consul needs to know the Pod IPs in order to route to them eventually. If Consul used the ingress controller IP then it would never be able to route to the Pod since it wouldn’t know its IP address.

One thing you could do that I haven’t tested is use the Service Sync feature (https://www.consul.io/docs/platform/k8s/service-sync.html). If ambassador creates a Kubernetes Service for its ingress controller, then this would be synced to Consul. Then you could use that service since its IPs will be the external IP.

  1. That’s right

I want to register the service in the consul with the External IP of my ingress controller.

I am creating an ingress resource:


kind: Ingress
apiVersion: extensions / v1beta1
metadata:
name: ping-ingress
namespace: test
spec:
rules:

After that, if I try to access IP Ingress with the Host Header “production.test.service.example.com”, then I will get a response from my service, but I would like to register this name in the Consul as well and refer to the controller IP ingress