Can't connect service with Postgres through mesh

Hi!

I've a Postgres database deployed in my Kubernetes cluster and I'm trying to connect my services with it using Traefik Mesh.

I have the following Postgres services:

---
apiVersion: v1
kind: Service
metadata:
  name: postgresql-headless
  namespace: postgresql
  labels:
    app.kubernetes.io/name: postgresql
    app.kubernetes.io/version: 1.0.0
    app.kubernetes.io/component: infrastructure
    app.kubernetes.io/part-of: databases
    service.alpha.kubernetes.io/tolerate-unready-endpoints: "true"
spec:
  type: ClusterIP
  clusterIP: None
  publishNotReadyAddresses: true
  ports:
    - name: tcp-postgresql
      port: 5432
      targetPort: tcp-postgresql
  selector:
    app.kubernetes.io/name: postgresql
---
# Source: postgresql/templates/svc.yaml
apiVersion: v1
kind: Service
metadata:
  name: postgresql
  namespace: postgresql
  labels:
    app.kubernetes.io/name: postgresql
    app.kubernetes.io/version: 1.0.0
    app.kubernetes.io/component: infrastructure
    app.kubernetes.io/part-of: databases
spec:
  type: ClusterIP
  ports:
    - name: tcp-postgresql
      port: 5432
      targetPort: tcp-postgresql
  selector:
    app.kubernetes.io/name: postgresql
    role: master

And the following pod deploying (a custom application that I have):

---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: business-app
  labels:
    app.kubernetes.io/name: business-app
    app.kubernetes.io/version: 1.0.0
    app.kubernetes.io/component: business
    app.kubernetes.io/part-of: application-layer
spec:
  replicas: 1
  selector:
    matchLabels:
      app.kubernetes.io/name: business-app
  template:
    metadata:
      labels:
        app.kubernetes.io/name: business-app
        app.kubernetes.io/version: 1.0.0
        app.kubernetes.io/component: business
        app.kubernetes.io/part-of: application-layer
    spec:
      containers:
        - name: business-app
          image: 904333181156.dkr.ecr.sa-east-1.amazonaws.com/business:$ECR_TAG
          env:
            - name: TYPEORM_HOST
              value: '172.20.139.201'
            ...
          ports:
            - containerPort: 80

If I use the cluster IP of Postgres service (like above) it works as expected, but as soon as I change it to postgresql.posgresql.traefik.mesh it simply stops working.

The strange thing is that I can curl to Postgres service inside my pod, but here is the log I receive at Postgres's pod:

2020-12-10 23:31:05.093 GMT [7600] FATAL:  no PostgreSQL user name specified in startup packet

Is this a bug? Or am I doing something wrong?

Hi @delucca and thanks for your interest in Traefik Mesh,

As Traefik Mesh is using Traefik for proxies I think that you are having the following issue: SMTP-STARTTLS proxying with STARTTLS handled by Traefik · Issue #7366 · traefik/traefik · GitHub