Skip to content

TLS / mTLS

Nantian Gateway supports TLS for three communication channels: the admin HTTP API, the gRPC xDS stream between control plane and data plane, and the xDS transport from the data plane side. Each channel is configured independently.

The control plane exposes two TLS-capable servers: the admin HTTP server and the gRPC xDS server.

Secures the admin HTTP API with server-side TLS:

ParameterTypeDefaultDescription
adminTLS.enabledboolfalseEnable TLS on the admin HTTP server
adminTLS.certPathstring""Path to the server certificate file (PEM)
adminTLS.keyPathstring""Path to the server private key file (PEM)

When enabled, the admin server serves HTTPS instead of HTTP. The certificate and key must be valid PEM-encoded files readable by the control plane process. In Kubernetes, mount these from a Secret volume.

Secures the gRPC xDS stream with optional mutual TLS:

ParameterTypeDefaultDescription
grpcTLS.enabledboolfalseEnable TLS on the gRPC server
grpcTLS.certPathstring""Path to the server certificate file (PEM)
grpcTLS.keyPathstring""Path to the server private key file (PEM)
grpcTLS.clientCAPathstring""Path to the CA certificate for verifying client certificates
grpcTLS.requireClientCertboolfalseRequire and verify client certificates (mTLS)

Setting requireClientCert to true enables mutual TLS. Every data plane that connects must present a certificate signed by the CA specified in clientCAPath. Without mTLS, any client that can reach the gRPC port can receive configuration snapshots.

The data plane has two TLS-related configuration sections: the proxy runtime (client-facing TLS) and the xDS transport (control plane connection).

These settings control TLS behavior for traffic passing through the data plane:

ParameterTypeDefaultDescription
tls.minVersionstring"1.2"Minimum TLS version accepted ("1.2" or "1.3")
tls.maxVersionstring"1.3"Maximum TLS version offered
tls.cipherSuites[]string[]Allowed cipher suites (empty = defaults)
tls.sessionCacheSizeint2048TLS session cache entries for resumption
tls.sessionCacheLifetimeduration"10m"Lifetime of cached TLS sessions

Configures how the data plane connects to the control plane’s gRPC server:

ParameterTypeDefaultDescription
xds.tls.enabledboolfalseEnable TLS for the xDS connection
xds.tls.serverNamestring""Expected server name for certificate validation
xds.tls.caCertPathstring""Path to the CA certificate for verifying the server
xds.tls.clientCertPathstring""Path to the client certificate (for mTLS)
xds.tls.clientKeyPathstring""Path to the client private key (for mTLS)

When both clientCertPath and clientKeyPath are set, the data plane presents a client certificate to the control plane, satisfying the mTLS requirement when requireClientCert is enabled on the gRPC server.

The following configuration enables mTLS on the gRPC stream and TLS on the admin API:

# Control plane
grpcTLS:
enabled: true
certPath: /etc/certs/grpc/tls.crt
keyPath: /etc/certs/grpc/tls.key
clientCAPath: /etc/certs/grpc/ca.crt
requireClientCert: true
adminTLS:
enabled: true
certPath: /etc/certs/admin/tls.crt
keyPath: /etc/certs/admin/tls.key
# Data plane
xds:
tls:
enabled: true
serverName: nantian-gw-controlplane.nantian-gw.svc
caCertPath: /etc/certs/xds/ca.crt
clientCertPath: /etc/certs/xds/tls.crt
clientKeyPath: /etc/certs/xds/tls.key

Certificates can be provisioned through several approaches:

  • cert-manager — automatically issues and rotates certificates using the Kubernetes cert-manager operator
  • Manual provisioning — generate certificates with tools like openssl or cfssl and mount them as Kubernetes Secrets
  • Vault — integrate with HashiCorp Vault for centralized certificate management

For production deployments, cert-manager is recommended. It handles certificate issuance, renewal, and rotation without manual intervention.