<p>I am now using traefik 2.2.1 in kubernetes cluster v1.18, now I want to expose mysql port out of kubernetes cluster,and follow by official <a href="https://docs.traefik.io/v2.2/routing/entrypoints/" rel="nofollow noreferrer">doc</a> , add start args:</p>
<pre><code>- '--entryPoints.tcpep.address=:3308'
</code></pre>
<p>and add port define:</p>
<pre><code>         ports:
            - name: tcpep
              hostPort: 3308
              containerPort: 3308
              protocol: TCP
</code></pre>
<p>this is the tcp ingress route:</p>
<pre><code>apiVersion: traefik.containo.us/v1alpha1
kind: IngressRouteTCP
metadata:
    name: report-mysql
spec:
    entryPoints:
        - tcpep
    routes:
        - match: HostSNI(`*`)
    services:
        - name: report-mysqlha
          port: 3306
</code></pre>
<p>then check the port listening in host machine:</p>
<pre><code>[dolphiin@K8SSlave3 production]$ sudo lsof -i:3308
[sudo] password for miaoyou:
lsof: no pwd entry for UID 65532
COMMAND   PID     USER   FD   TYPE     DEVICE SIZE/OFF NODE NAME
lsof: no pwd entry for UID 65532
traefik 28956    65532    8u  IPv6 2902156338      0t0  TCP *:tns-server (LISTEN)
</code></pre>
<p>scan port:</p>
<pre><code>[dolphin@K8SSlave3 production]$ sudo nmap -sS -p 3308 -v 192.168.64.251

Starting Nmap 6.40 ( http://nmap.org ) at 2020-08-28 19:19 CST
Initiating SYN Stealth Scan at 19:19
Scanning MeowK8SSlave3 (192.168.64.251) [1 port]
Discovered open port 3308/tcp on 192.168.64.251
Completed SYN Stealth Scan at 19:19, 0.21s elapsed (1 total ports)
Nmap scan report for MeowK8SSlave3 (192.168.64.251)
Host is up (0.000071s latency).
PORT     STATE SERVICE
3308/tcp open  unknown
</code></pre>
<p>but when I login MySQL:</p>
<pre><code>mycli -h 192.168.64.251 -P 3308 -u root -p OgHeee8bfw6jcadewu
</code></pre>
<p>it is stuck and no response, is the mapping port success? why I could not loggin mysql? PS:when I am using kubernetes service ip to login, it could login success.</p>
<p>What I having tried:</p>
<p>I found when I access to traefik dashboard, it give me tips(the name is different because I am trying in different kubernetes cluster in my home machine):</p>
<pre><code>the service &quot;infrastructure-mysql-673acf455cb2dab0b43a@kubernetescrd&quot; does not exist
</code></pre>
<p><a href="https://i.stack.imgur.com/nG8SK.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/nG8SK.png" alt="enter image description here" /></a></p>
<p>and I find the traefik dashboard did not having TCP services. I am trying to create a TraefikService like this:</p>
<pre><code>[root@k8smaster traefik]# cat mysql-tcp-services.yaml 
apiVersion: traefik.containo.us/v1alpha1
kind: TraefikService
metadata:
    name: mysql-service
spec:
    tcp:
        services:
           mysql:
            loadBalancer:
              servers:
              - address: &quot;10.20.58.239:3306&quot;
</code></pre>
<p>it seems not work. the dashboard still not found a TCP Service, so what should I do to fix?</p>

Dolphin
<p>config IngressRouteTCP like this:</p>
<pre><code>apiVersion: traefik.containo.us/v1alpha1
kind: IngressRouteTCP
metadata:
    name: report-mysql
spec:
    entryPoints:
        - tcpep
    routes:
        - match: HostSNI(`*`)
          services:
             - name: report-mysqlha
               port: 3306
</code></pre>
<p>works.</p>
