Kong Gateway is designed around an extensible plugin architecture and comes with a wide variety of plugins already bundled inside it. These plugins can be used to modify the request or impose restrictions on the traffic.
Once this resource is created, the resource needs to be associated with an Ingress, Service, HTTPRoute, KongConsumer or KongConsumerGroup resource in Kubernetes.
This diagram shows how you can link a KongPlugin resource to an Ingress, Service, or KongConsumer.
flowchart TD
subgraph Link to consumer
direction TB
E(apiVersion: configuration.konghq.com/v1
kind: KongPlugin
metadata:
name: custom-api-limit
plugin: rate-limiting
config:
minute: 10):::left
F(apiVersion: configuration.konghq.com
kind: KongConsumer
metadata:
name: demo-api
annotations:
konghq.com/plugins: custom-api-limit
username: special-client):::left
end
subgraph Link to Ingress and service
direction TB
A(apiVersion: configuration.konghq.com/v1
kind: KongPlugin
metadata:
name: reports-api-limit
plugin: rate-limiting
config:
minute: 5):::left
B(apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: demo-api
annotations:
konghq.com/plugins: reports-api-limit):::left
C(apiVersion: v1
kind: Service
metadata:
name: billing-api
annotations:
konghq.com/plugins: billing-auth):::left
D(apiVersion: configuration.konghq.com/v1
kind: KongPlugin
metadata:
name: billing-auth
plugin: basic auth):::left
end
A --> |execute the plugin for any request that matches a rule in the following ingress resource|B
B --> C
D --> |execute the plugin for any request that is forwarded to the billing-api service in k8s|C
E --> |Associated using konghq.com/plugins annotation|F