1

Is that possible to define an ingress (ingresses.networking.k8s.io) forwarding requests to a concrete static IP-address in a private network?

I have a service that isn't running on a K8S cluster, but it resides in a private network, and all K8S pods have access to this network. There are many auxiliary services in this network, I don't want to deploy these services in a K8S cluster due to certain reasons. And I'd like to have some of these services exposed via ingress-nginx, but at this time I don't see a way to define the backend as a static IP-address.

Is that possible?

Thanks!

Volodymyr Melnyk
  • 537
  • 5
  • 18
  • Hi! So you wan to use an external service as Ingress backend? I need to know if I understand you correctly. – Wytrzymały Wiktor Aug 14 '19 at 11:32
  • Thanks for your interest, @OhHiMark. It's not fully "external", it's an auxiliary service that runs as a "pet" in an internal network. All the pods in the K8S clusters could reach this network and communicate with this service. Of course, I can assign a public IP-address to this service and the pods could reach it via the Internet, but I'd like to avoid assigning a public IP-address and would like to make it reachable via ingress. – Volodymyr Melnyk Aug 14 '19 at 11:41
  • 1
    Could you please see [this](https://appscode.com/products/voyager/10.0.0/guides/ingress/http/external-svc/) and let me know if something like that fits you? – Wytrzymały Wiktor Aug 14 '19 at 12:01
  • Yes, absolutely! I forgot about endpoints, I should use them in this scheme. Thank you very much! – Volodymyr Melnyk Aug 14 '19 at 15:02
  • Great! I will post this as an answer in a few moments. Please accept it so the others could also benefit from it. – Wytrzymały Wiktor Aug 16 '19 at 07:21

2 Answers2

3

You can use external service as Ingress backend.

You can introduce any external IP address as a Kubernetes service by creating a matching Service and Endpoint object. Then you can use this service as a backend for your Ingress rules.

More details can be found here.

1

Note: You cannot edit an existing ingress-nginx load balancer service, but you can pass the external IP you want it to use when installing it. Keep in mind, you need to have that external IP set up ahead of time in your cloud environment.

Here is the command that worked for me when performing a helm installation:

helm upgrade --install ingress-nginx ingress-nginx \
  --repo https://kubernetes.github.io/ingress-nginx \
  --namespace ingress-nginx --create-namespace \
  --debug \
  --set controller.service.loadBalancerIP=<YOUR_STATIC_IP>

More info: