Hi guys,
I am deploying TiDB with TLS enabled for PD components in a Kubernetes cluster using cert-manager to generate certificates. However, PD logs show errors such as:
tls: bad certificate
tls: first record does not look like a TLS handshake
transport: authentication handshake failed: client certificate authentication failed
I am struggling to get the TLS certs properly validated between TiDB and PD, and my cluster is stuck with failed connections.
What I have done so far:
Created a Certificate resource with cert-manager to issue certificates for TiDB PD servers and clients.
Used cert-allowed-cn = [“tidb-server”] in PD config to specify allowed client CN.
Enable tls in cluster config
Configured SANs for the certificate to include relevant Kubernetes service DNS names.
Mounted certificates into PD and TiDB pods and configured their TLS options accordingly.
PD server TLS config snippet (in config file or Helm values):
[security]
ca-path = “/var/lib/tls/ca.crt”
cert-path = “/var/lib/tls/tidb-server.crt”
key-path = “/var/lib/tls/tidb-server.key”
Errors in PD logs:
[WARN] [config_logging.go:170] [“rejected connection on client endpoint”] [remote-addr=10.42.6.51:39266] [server-name=global-pd.tidb-cluster] [error=“remote error: tls: bad certificate”]
[WARN] [config_logging.go:170] [“rejected connection on client endpoint”] [remote-addr=10.42.6.37:37590] [server-name=] [error=“tls: first record does not look like a TLS handshake”]
[FATAL] [“run server failed”] [error=“transport: authentication handshake failed: client certificate authentication failed”]
Questions:
Am I correctly configuring SANs for the PD server certificates?
Is using “tidb-server” as commonName and cert-allowed-cn sufficient for client cert verification?
Could the errors mean that some clients connect without TLS? How can I identify and fix this?
What are the common pitfalls when setting up TLS with cert-manager for TiDB PD?
How to verify certs inside the pods properly?
Additional info:
Kubernetes version: 1.30
cert-manager version: 1.17.2
TiDB Operator / TiDB version: 8.5
Cluster issuer type: self-signed
Thanks in advance for your help!