<p>I built a spring boot project and deployed it with <code>Kubernetes Deployment</code>，and its configuration file is as follows：</p>

<pre><code>server:
  port: 80
spring:
  application:
    name: demo-kube-svca
  datasource:
    driver-class-name: com.mysql.cj.jdbc.Driver
    url: jdbc:mysql://mysql.dev.svc.cluster.local/kube
    username: root
    password: 123456
</code></pre>

<p>My mysql database is simple to deploy with docker:</p>

<pre><code>Docker run -d \
-p 3306:3306 \
-e MYSQL_ROOT_PASSWORD=123456 \
--name=mysql \
--privileged=true \
Mysql: 8.0
</code></pre>

<p>Finally, I want to import the MySQL service into Service Mesh with <code>ServiceEntry</code>.</p>

<pre><code>apiVersion: networking.istio.io/v1alpha3
Kind: ServiceEntry
Metadata:
   Name: mysql-external
Spec:
   Hosts:
     - mysql.dev.svc.cluster.local
   Addresses:
     - 192.168.0.123/32
   Ports:
     - number: 3306
       Name: mysql
       Protocol: tcp
   Location: MESH_EXTERNAL
</code></pre>

<p>However, when I use the program to access the database, the error is reported in the log:</p>

<pre><code>Caused by: java.net.UnknownHostException: mysql.dev.svc.cluster.local: Name does not resolve
</code></pre>

<p>I refer to the official documentation: <a href="https://istio.io/blog/2018/egress-tcp/" rel="nofollow noreferrer">https://istio.io/blog/2018/egress-tcp/</a>,
I think it may be a problem with my configuration, but I don't know what to do, can you help me?</p>

Duke Lu
<p><code>ServiceEntry</code> only open firewall in sidecar proxy for you - still you need mysql deployed on Kubernetes to use mysql.dev.svc.cluster.local svc or if you have mysql deployed under IP 192.168.0.123 please use it instead of host.</p>

<p>Edit:</p>

<p>If you need to cover 192.168.0.123 IP address with a service inside Kubernetes you should use <a href="https://kubernetes.io/docs/concepts/services-networking/service/#externalname" rel="nofollow noreferrer">external service</a> - as I wrote Istio's ServiceEntry only configure firewall.</p>
