Database backed

Database backed deployments are when Kong Ingress Controller is used to update a Lua control plane that is attached to a PostgreSQL database. Kong Gateway may be deployed in either Traditional or Hybrid mode.

Both Gateway Discovery and Sidecar deployments can be used alongside a database. If you’re starting a greenfield project today we recommend using Gateway Discovery.

Database backed deployments should only be used in a small set of circumstances. We recommend using Gateway Discovery unless you’ve been otherwise advised by a member of the Kong team.

Traditional mode

Traditional mode is when every Kong Gateway instance acts as both a Control Plane and a Data Plane. All nodes connect to the database and load the latest configuration at a regular interval.

 
flowchart LR

A[ API Server]
KIC1[ KIC 
(Active)]
KIC2[ KIC
(Standby)]
KIC3[ KIC
(Standby)]
DP1[ Data Plane]
DP2[ Data Plane]
DP3[ Data Plane]
DP4[ Data Plane]

A-.KIC watches 
API server.- KIC1

subgraph B[" "]
  KIC1
  KIC2
  KIC3
  note[Deployment with
leader election]
end

subgraph C[" "]
DB
DP1
DP2
DP3
DP4
end

KIC1 --> DP1
DP1 --> DB[(Config 
database)]
DB --> DP2 & DP3 & DP4

style B stroke-dasharray: 5 5
style C stroke:none,fill:none
style note stroke:none,fill:none
  

Figure 1: Kong Ingress Controller sends configuration to a random Kong Gateway instance, which writes the configuration to the database. All other nodes read the configuration from the database.

Hybrid mode

Database backed Hybrid mode is similar to Traditional mode, but instead of every node reading from the database a single Control Plane is responsible for managing the configuration and distributing it to all active Data Planes.

In Hybrid mode, Kong Ingress Controller uses Gateway Discovery to find the Control Plane and send Kong Gateway configuration to the Admin API. This configuration is persisted to the PostgreSQL database and transmitted to the Data Planes using the Kong Gateway CP/DP protocol.

 
flowchart LR

A[ API Server]
KIC1[ KIC 
(Active)]
KIC2[ KIC
(Standby)]
KIC3[ KIC
(Standby)]
CP[ Control Plane]
DP1[ Data Plane]
DP2[ Data Plane]
DP3[ Data Plane]
DB[(Config 
database)]

A-.KIC watches 
API server.-KIC1

subgraph B[" "]
  KIC1
  KIC2
  KIC3
  note[Deployment with
leader election]
end

subgraph C[" "]
  DP1
  DP2
  DP3
end

KIC1 --> CP
CP --> DP1 & DP2 & DP3
CP --> DB

style B stroke-dasharray: 5 5
style C stroke-dasharray: 5 5
style note stroke:none,fill:none

  

_Figure 2: Kong Ingress Controller sends configuration to a Control Plane, which distributes configuration to all Data Planes and writes the configuration to the database.

Something wrong?

Help us make these docs great!

Kong Developer docs are open source. If you find these useful and want to make them better, contribute today!