title: Why ingress-nginx controller tcp-services not working?
body: <p>I'm trying to expose a RabbitMQ ssl port via <a href="https://kubernetes.github.io/ingress-nginx/user-guide/exposing-tcp-udp-services/" rel="nofollow noreferrer">ingress-nginx tcp-services</a> like so:</p>
  
  <pre><code>$ cat rabbit-expose-amqps.yaml
  apiVersion: v1
  kind: ConfigMap
  metadata:
    name: tcp-services
    namespace: ingress-nginx
  data:
    5671: "dev/rabbitmq-rabbitmq-ha:5671"
  </code></pre>
  
  <p>(the RabbitMQ service already listens on this port) but and any attempt to perform <code>openssl s_client -connect my-external-host:5671</code> times out, and, of course, any attempt to connect to <code>amqps://my-extrenal-host:5671</code> using amqplib times out as well. The management UI does work, though, so I know the external IP is correct.</p>
  
  <p>It seems that nginx.conf in my ingress-nginx pod gets updated, but something is strange (I think): it DOES configure a listener on port 5671, but the upstream still says "placeholder" with 0.0.0.1:1234 address. I even recycled the pod, just in case, still the same conf file:</p>
  
  <pre><code>stream {
      upstream upstream_balancer {
              server 0.0.0.1:1234; # placeholder
  
              balancer_by_lua_block {
                      tcp_udp_balancer.balance()
              }
      }
      ...
      # TCP services
      server {
          preread_by_lua_block {
              ngx.var.proxy_upstream_name="tcp-dev-rabbitmq-rabbitmq-ha-5671";
          }
          listen                  5671;
          proxy_timeout           600s;
          proxy_pass              upstream_balancer;
  
      }
  }
  </code></pre>
  
  <p>How do I get the tcp-services applied correctly?</p>