Report this

What is the reason for this report?

Can Ingress Proxy be enabled and disabled for individual ports?

Posted on December 18, 2019

I know it is possible to enable Proxy protocol for Ingress (also by service annotation): service.beta.kubernetes.io/do-loadbalancer-enable-proxy-protocol: “true”

That works great with Proxy aware services like my web applications running on port 80 (http) and 443 (https)

However, for services like SQL Server running on tcp port 1433, connecting to that service works when proxy protocol is disabled, and doesn’t work when proxy protocol is enabled.

Is there a way to enable and disable Ingress Proxy for individual ports, e.g. to be enabled for ports 80/433 and to be disabled for other tcp ports (e.g. port 1433)?

My only solution now is to have two-ingress-services and two official IP-addresses and that will of course also cost the double a month.

Here is how I setup Ingress using helm chart:

helm install ingress-nginx --namespace ingress-nginx stable/nginx-ingress -f nginx-ingress-controller-config.yaml

nginx-ingress-controller-config.yaml:

controller:
  config:
    use-forwarded-headers: "true"
    compute-full-forwarded-for: "true"
    use-proxy-protocol: "true"
  service:
    annotations:
      service.beta.kubernetes.io/do-loadbalancer-enable-proxy-protocol: "true" 
    nodePorts:
      tcp:
        1433: 32496 # Any random port 30000-32767
tcp:
  1433: "sqlserver/mssql:1433" #namespace/service-name:port


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Hi there,

Unfortunately, proxy protocol as far as I’m aware is an all or nothing thing on the DO load balancer’s so if both of your apps can’t use a single configuration, you would need two loadbalancers.

Regards,

John Kwiatkoski

Hi!

If you are using tcp-services and LB proxy protocol

you can just add :PROXY in your configMap

tcp: 1433: “sqlserver/mssql:1433:PROXY”

and reboot nginx controller

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.