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