kong.cluster

Uses: Kong Gateway

Cluster-level utilities.

kong.cluster.get_id()

Returns the unique ID for this Kong cluster. If Kong is running in DB-less mode without a cluster ID explicitly defined, then this method returns nil.

For hybrid mode, all control planes and data planes belonging to the same cluster return the same cluster ID. For traditional database-based deployments, all Kong nodes pointing to the same database also return the same cluster ID.

Returns

  1. string|nil: The v4 UUID used by this cluster as its ID.

  2. string|nil: An error message.

Usage

local id, err = kong.cluster.get_id()
if err then
  -- handle error
end

if not id then
  -- no cluster ID is available
end

-- use id here
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!