I would to expose a database in Kubernetes which uses a proprietary TCP protocol BOLT of port 4317/TCP. So I created a Gateway like this
apiVersion: gateway.networking.k8s.io/v1
kind: Gateway
metadata:
name: neo4j
namespace: persistence
spec:
gatewayClassName: traefik
listeners:
- allowedRoutes:
namespaces:
from: Same
name: bolt
port: 7687
protocol: TCP
and a TCPRoute like this
apiVersion: gateway.networking.k8s.io/v1alpha2
kind: TCPRoute
metadata:
name: neo4j-bolt
namespace: persistence
spec:
parentRefs:
- group: gateway.networking.k8s.io
kind: Gateway
name: neo4j
sectionName: bolt
rules:
- backendRefs:
- group: ""
kind: Service
name: neo4j
namespace: persistence
port: 7687
weight: 1
It did not work first, then I realized that traefik is actually not listening itself on port 4317 on the external load balancer, so I added the following configuration to the Helm chart:
ports:
bolt:
port: 7687
expose:
default: true
This is working. My question is: Is this the way to go or is there an automation that I am missing?
Regards,
DK