Hello, I want to expose posgresql service to outside of my k8s cluster
I searched internet, and configed gateway and virtualservice like below:
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: public-db
spec:
hosts:
- "public-db.itps.xxx.com"
gateways:
- istio-system/default-gateway
tcp:
- match:
- port: 5432
route:
- destination:
port:
number: 5432
host: public-db-postgresql
apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
name: default-gateway
namespace: istio-system
spec:
selector:
istio: ingressgateway
servers:
- hosts:
- keycloak.itps.xxx.com
port:
name: https
number: 443
protocol: HTTPS
tls:
credentialName: lecerts
mode: SIMPLE
- hosts:
- public-db.itps.xxx.com
port:
name: pg
number: 5432
protocol: TCP
but this is not working, tiimeout when trying to connect with public-db.itps.xxx.com:5432
according to my understanding, the istio’s ingress gateway pod should listening on port 5432, which was specified by server
in gateway, however, in fact it does not open a new port at all.
what’s wrong ? please help.