I want to access external DB which is exposed on some ip: 10.48.100.124 (there is no DNS name associated with this IP) with port 3306 I have create ServiceEntry:
apiVersion: networking.istio.io/v1beta1
kind: ServiceEntry
metadata:
name: csd-database
namespace: testnam-dev
spec:
hosts:
- csd-database
addresses:
- 10.48.100.124/32
exportTo:
- "."
ports:
- number: 3306
name: tcp
protocol: TCP
location: MESH_EXTERNAL
resolution: STATIC
endpoints:
- address: 10.48.100.124
ports:
tcp: 3306
And it works ok if I try to connect via IP (10.48.100.124) inside cluster. But I want to expose this service (inside k8s/isito cluster) with DNS name so I have create VirtualService:
apiVersion: networking.istio.io/v1beta1
kind: VirtualService
metadata:
name: csd-database
namespace: testnam-dev
spec:
hosts:
- csd-database
gateways:
- ingresgateway
tcp:
- route:
- destination:
host: csd-database
But I'm not able to connect to host: csd-database Also telnet is unable to connect to csd-database on 3306 port. How I can expose ServiceEntry with DNS name inside cluster ?
DB dosn't have DNS name (externaly) it has only IP address. SO DB is accesible only on 10.48.100.124:3306
TLDR: Your
ServiceEntry
currently is configured to resolve by static ip address.Change:
to
According to istio documentation: