<p>Many devops use mysql connect over ssh to access to production database for various reasons and queries</p>

<p>after successfull deploy mysql container to a digital ocean kubernetes cluster
im able to ssh into the pod via :</p>

<pre><code>kubectl --kubeconfig="kubeconfig.yaml" exec -it vega-mysql-5df9b745f9-c6859 -c vega-mysql -- /bin/bash
</code></pre>

<p>my question is how can i remote connect applications like : navicat - sequel pro or mysql workbench to this pod ?</p>

<p>Nitpick: Even though you can use it to start an interactive shell, <code>kubectl exec</code> is not the same as SSH. For that reason, regular MySQL clients that support SSH-tunneled connections, don't (and probably never will) support connecting to a MySQL server tunneled through <code>kubectl exec</code>.</p>

<p>Alternative solution: Use <a href="https://kubernetes.io/docs/tasks/access-application-cluster/port-forward-access-application-cluster/" rel="noreferrer"><code>kubectl port-forward</code></a> to forward the Pod's MySQL server port 3306 to your local machine:</p>

<pre><code>kubectl port-forward vega-mysql-5df9b745f9-c6859 3306:3306
</code></pre>

<p>This will instruct kubectl to act as a TCP proxy from a local port on your machine into the Pod. Then, connect to <code>127.0.0.1:3306</code> with any MySQL client of your choice:</p>

<pre><code>mysql -u youruser -p -h 127.0.0.1 
</code></pre>
