Search code examples
kubernetesopenshiftkubernetes-ingressnginx-ingress

exposing TCP service using nginx ingress controller operator on openshift


We have nginx ingress controller installed on openshift using certified operator from openshift market place. We are trying to expose TCP service and trying to follow below document.

https://kubernetes.github.io/ingress-nginx/user-guide/exposing-tcp-udp-services/

But flag --tcp-services-configmap unable to add it do deployment either nginx ingress controller, when I add it to deployment it is not persisting because deployment is controlled by nginx ingress controller operator. I am not finding option to add flag --tcp-services-configmap in nginx ingress controller, is there any other way I can add this flag to nginx ingress controller? Or any other way to expose TCP service using nginx ingress controller which is installed using operator.

Any inputs will be greatly appreciated.


Solution

  • For operator based nginx ingress controller exposing app over TCP below link will help to expose the app.

    https://docs.nginx.com/nginx-ingress-controller/configuration/transportserver-resource/

    1. Modify the nginx ingress controller service to allow port 2222

    2. Create globalconfiguration. Example: globalconfiguration.yaml

    apiVersion: k8s.nginx.org/v1alpha1
    kind: GlobalConfiguration
    metadata:
      name: nginx-ingress-config
      namespace: kube-system
    spec:
      listeners:
      - name: ssh-tcp
        port: 2222
        protocol: TCP
    

    3. Create transportserver Example: transportserver-ssh-tcp.yaml

    apiVersion: k8s.nginx.org/v1alpha1
    kind: TransportServer
    metadata:
      name: ssh-tcp
    spec:
      listener:
        name: ssh-tcp
        protocol: TCP
      upstreams:
      - name: ssh-app
        service: ssh-server
        port: 22
      action:
        pass: ssh-app