In hybrid mode, a mutual TLS handshake (mTLS) is used for authentication so the
actual private key is never transferred on the network, and communication
between Control Plane and Data Plane nodes is secure.
Before using hybrid mode, you need a certificate/key pair.
Kong Gateway provides two modes for handling certificate/key pairs:
-
Shared mode: (Default) Use the Kong Gateway CLI to generate a certificate/key
pair, then distribute copies across nodes. The certificate/key pair is shared
by both Control Plane and Data Plane nodes.
-
PKI mode: Provide certificates signed by a central certificate authority
(CA). Kong Gateway validates both sides by checking if they are from the same CA. This
eliminates the risks associated with transporting private keys.
Warning: If you have a TLS-aware proxy between the Data Plane and Control Plane nodes, you
must use PKI mode and set cluster_server_name
to the Control Plane hostname in
kong.conf
. Do not use shared mode, as it uses a non-standard value for TLS server name
indication, and this will confuse TLS-aware proxies that rely on SNI to route
traffic.
Warning: Protect the private key. Ensure the private key file can only be accessed by Kong Gateway nodes that belong to the cluster. If the key is compromised, you must regenerate and replace certificates and keys on all Control Plane and Data Plane nodes.
- On an existing Kong Gateway instance, create a certificate/key pair:
This will generate cluster.crt
and cluster.key
files and save them to
the current directory. By default, the certificate/key pair is valid for three
years, but can be adjusted with the --days
option. See kong hybrid --help
for more usage information.
- Copy the
cluster.crt
and cluster.key
files to the same directory
on all Kong Gateway Control Plane and Data Plane nodes; e.g., /cluster/cluster
.
Set appropriate permissions on the key file so it can only be read by Kong Gateway.
With PKI mode, the Hybrid cluster can use certificates signed by a central
certificate authority (CA).
In this mode, the Control Plane and Data Plane don’t need to use the same
cluster_cert
and cluster_cert_key
. Instead, Kong Gateway validates both sides by
checking if they are from the same CA. Certificates on the Control Plane and Data Plane must contain the TLS Web Server Authentication
and TLS Web Client Authentication
as X509v3 Extended Key Usage extension, respectively.
Kong Gateway doesn’t validate the CommonName (CN) in the Data Plane certificate, it can take an arbitrary value.