I am trying to create a tcp service like this in kubernetes cluster followed by official docs :
apiVersion: traefik.containo.us/v1alpha1
kind: TraefikService
metadata:
name: app-mysql
spec:
tcp:
services:
my-service:
loadBalancer:
servers:
- address: '<private-ip-server-1>:<private-port-server-1>'
- address: '<private-ip-server-2>:<private-port-server-2>'
and I only see the traefik service in lens, in the traefik dashboard found nothing:
What should I do to create a TCP Service in traefik 2.2.1?
Assuming you'd like to talk to TCP services running in Kubernetes. For TCP you don't need really need a TraefikService
, you can just use an IngressRouteTCP
resource.
You can see in the docs that the IngressRouteTCP
can talk directly to a K8s service.
Similarly to the example you can have something like this:
apiVersion: traefik.containo.us/v1alpha1
kind: IngressRouteUDP
metadata:
name: my-ingress-udp-route
namespace: default
spec:
entryPoints:
- myentrypoint
routes:
- match: HostSNI(`mysql.example.com`)
services:
- name: app-mysql 👈 K8s Service
port: 3306
Notes:
TraefikService
can be used for in regular IngressRoute
resources, and not supported in TCP/UDP case today)
Not sure how you plan to load balance a MySQL service though, as this typically happens at the application level or you need a particular proxy that handles your reads/writes and data consistency)
✌️
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.