You are browsing unreleased documentation.
Basic configuration examples
A plugin which is not associated to any service, route, consumer, or consumer group is
considered global, and will be run on every request.
- In self-managed Kong Gateway Enterprise, the plugin applies to every entity in a given workspace.
- In self-managed Kong Gateway (OSS), the plugin applies to your entire environment.
- In Konnect, the plugin applies to every entity in a given control plane.
Read the
Plugin Reference and the Plugin Precedence
sections for more information.
The following examples provide some typical configurations for enabling
the ACME
plugin globally.
Kong Admin API
Konnect API
Kubernetes
Declarative (YAML)
Konnect Terraform
Make the following request:
curl -X POST http://localhost:8001/plugins/ \
--header "accept: application/json" \
--header "Content-Type: application/json" \
--data '
{
"name": "acme",
"config": {
"account_email": "example@example.com"
}
}
'
Make the following request, substituting your own access token, region, and control plane ID:
curl -X POST \
https://{us|eu}.api.konghq.com/v2/control-planes/{controlPlaneId}/core-entities/plugins/ \
--header "accept: application/json" \
--header "Content-Type: application/json" \
--header "Authorization: Bearer TOKEN" \
--data '{"name":"acme","config":{"account_email":"example@example.com"}}'
See the Konnect API reference to learn about region-specific URLs and personal access tokens.
Create a KongClusterPlugin
resource and label it as global:
apiVersion: configuration.konghq.com/v1
kind: KongClusterPlugin
metadata:
name: <global-acme>
annotations:
kubernetes.io/ingress.class: kong
labels:
global: "true"
config:
account_email: example@example.com
plugin: acme
Add a plugins
entry in the declarative
configuration file:
plugins:
- name: acme
config:
account_email: example@example.com
Prerequisite: Configure your Personal Access Token
terraform {
required_providers {
konnect = {
source = "kong/konnect"
}
}
}
provider "konnect" {
personal_access_token = "kpat_YOUR_TOKEN"
server_url = "https://us.api.konghq.com/"
}
Add the following to your Terraform configuration to create a Konnect Gateway Plugin:
resource "konnect_gateway_plugin_acme" "my_acme" {
enabled = true
config = {
account_email = "example@example.com"
}
control_plane_id = konnect_gateway_control_plane.my_konnect_cp.id
}