<p>developing an ASP.NET Core 3.0 application, with centralized MySQL Database.</p>

<p>I am using a Connection String, which looks like this:</p>

<p><code>Server=mysql;Database=db-name;Uid=User;Pwd=Pass;SslMode=Preferred;persistsecurityinfo=false;</code></p>

<p>"mysql" is an internal DNS Record, which points to the central MySQL Server.
In Visual Studio, it works fine.</p>

<p>Now I want to deploy it to kubernetes.</p>

<p>I already did that with MSSQL successfully. I created an endpoint (ep) in kubernetes, pointing to the correct IP:</p>

<pre><code>Name:         mysql
Namespace:    my_namespace
Labels:       &lt;none&gt;
...
Subsets:
  Addresses:          192.168.6.200
  NotReadyAddresses:  &lt;none&gt;
  Ports:
    Name   Port  Protocol
    ----   ----  --------
    mysql  3306  TCP

Events:  &lt;none&gt;
</code></pre>

<p>And I created a corresponding Kubernetes service:</p>

<pre><code>Name:              mysql
Namespace:         my_namespace
Labels:            &lt;none&gt;
...
Selector:          &lt;none&gt;
Type:              ClusterIP
IP:                10.104.84.99
Port:              mysql  3306/TCP
TargetPort:        3306/TCP
Endpoints:         192.168.6.200:3306
Session Affinity:  None
Events:            &lt;none&gt;
</code></pre>

<p>All this looks like the stuff I did with MSSQL.</p>

<p>And I could confirm the working networking:</p>

<pre><code>root@kubernetes-server:/application# kv exec application-7c85b5d9d8-9vxhb -- curl mysql:3306
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:--  0:00:04 --:--:--     0J
100   115    0   115    0     0     25      0 --:--:--  0:00:04 --:--:--    25#08S01Got packets out of order
</code></pre>

<p>"Got packets out of order" is definately a response from the MySQL server.
I also could confirm that via Wireshark.</p>

<p>But the application will not run. I get the error: <code>"Unable to connect to any of the specified MySQL hosts."</code></p>

<p>Did I do something wrong?</p>

<p>Greetings, xola</p>

xola
<p>Got it.
It wasn't the Connection String.
Unfortunately, I did't see the errors prior to that error message. Since we encrypt the connection string, we have a key for decryption. The decrypt-key was not correctly set, so the application wanted to set up a connection using the encrypted, not the decrypted Connection String.</p>

<p>But thank you anyway!</p>
