How to use nginx ingress TCP service on different namespace
You can refer to the following document to expose tcp and udp services.
https://github.com/kubernetes/ingress-nginx/blob/master/docs/user-guide/exposing-tcp-udp-services.md
In my cluster, the ingress controller is installed on ingress-nginx namespace. You can get the tcp service from configmap.
kubectl get cm -n ingress-nginx tcp-services -o yaml
Basically, you just specify the service for your two databases.
data:
"3306": NamespaceA/mysql:3306
"5432": NamespaceB/postgress:5432
anish
Founder of 8gwifi.org Container Service My Crypto tool https://8gwifi.org My 8 Book Grab 8 book for Just $9 About Me Father,Brother&Developer Willing to contribute/Learn. Active member of Stackoverflow Devops Engineer & Security Advocate Matured in handling security related stuff like performing a white-hat hacking A community oriented developer, away from politics
Updated on June 04, 2022Comments
-
anish almost 2 years
I have deployed two namespace in the kubernetes cluster. The namespace A host mysql and namespace B run postgress and expose their service deployment on these ports
Namespace(A) - mysql - port (3306) Namespace(B) - postgress - port (5432)
I need to use nginx-ingress kubernetes cluster to route the traffic based, here is the sample YAML file for the ingress
apiVersion: extensions/v1beta1 kind: Ingress metadata: name: mysql-ingress annotations: kubernetes.io/ingress.class: nginx spec: rules: - host: mysql-ingress http: paths: - path: /mysql backend: serviceName: mysql servicePort: 3306
This YAML file is more suitable for HTTP kind of service, How to achieve the TCP service using nginx-ingress
-
mjwrazor almost 4 yearsDo you have to append the name,port,target port onto the ingress controller like shown in that documentation? If so what is a good way to do that, or best practice.
-
AndreyS about 3 years@hang du can you please assist me on this issue? It looks similar.. Thank you.. stackoverflow.com/questions/66190275/…