Enable the Amberflo plugin
Enable the Amberflo.io metering plugin.
Environment variables
-
API_KEY
: Your Amberflo API key
Add this section to your declarative configuration file:
_format_version: "3.0"
plugins:
- name: amberflo
config:
apiKey: ${{ env "DECK_API_KEY" }}
meterApiName: kong-api-calls
customerHeader: x-consumer-username
methodDimension: method
hostDimension: host
routeDimension: route
serviceDimension: service
Make the following request:
curl -i -X POST http://localhost:8001/plugins/ \
--header "Accept: application/json" \
--header "Content-Type: application/json" \
--data '
{
"name": "amberflo",
"config": {
"apiKey": "'$API_KEY'",
"meterApiName": "kong-api-calls",
"customerHeader": "x-consumer-username",
"methodDimension": "method",
"hostDimension": "host",
"routeDimension": "route",
"serviceDimension": "service"
}
}
'
echo "
apiVersion: configuration.konghq.com/v1
kind: KongClusterPlugin
metadata:
name: amberflo
namespace: kong
annotations:
kubernetes.io/ingress.class: kong
labels:
global: 'true'
config:
apiKey: '$API_KEY'
meterApiName: kong-api-calls
customerHeader: x-consumer-username
methodDimension: method
hostDimension: host
routeDimension: route
serviceDimension: service
plugin: amberflo
" | kubectl apply -f -
Add this section to your declarative configuration file:
_format_version: "3.0"
plugins:
- name: amberflo
service: serviceName|Id
config:
apiKey: ${{ env "DECK_API_KEY" }}
meterApiName: kong-api-calls
customerHeader: x-consumer-username
methodDimension: method
hostDimension: host
routeDimension: route
serviceDimension: service
Make sure to replace the following placeholders with your own values:
-
serviceName|Id
: Theid
orname
of the service the plugin configuration will target.
Make the following request:
curl -i -X POST http://localhost:8001/services/{serviceName|Id}/plugins/ \
--header "Accept: application/json" \
--header "Content-Type: application/json" \
--data '
{
"name": "amberflo",
"config": {
"apiKey": "'$API_KEY'",
"meterApiName": "kong-api-calls",
"customerHeader": "x-consumer-username",
"methodDimension": "method",
"hostDimension": "host",
"routeDimension": "route",
"serviceDimension": "service"
}
}
'
Make sure to replace the following placeholders with your own values:
-
serviceName|Id
: Theid
orname
of the service the plugin configuration will target.
echo "
apiVersion: configuration.konghq.com/v1
kind: KongPlugin
metadata:
name: amberflo
namespace: kong
annotations:
kubernetes.io/ingress.class: kong
config:
apiKey: '$API_KEY'
meterApiName: kong-api-calls
customerHeader: x-consumer-username
methodDimension: method
hostDimension: host
routeDimension: route
serviceDimension: service
plugin: amberflo
" | kubectl apply -f -
Next, apply the KongPlugin
resource by annotating the service
resource:
kubectl annotate -n kong service SERVICE_NAME konghq.com/plugins=amberflo
Add this section to your declarative configuration file:
_format_version: "3.0"
plugins:
- name: amberflo
route: routeName|Id
config:
apiKey: ${{ env "DECK_API_KEY" }}
meterApiName: kong-api-calls
customerHeader: x-consumer-username
methodDimension: method
hostDimension: host
routeDimension: route
serviceDimension: service
Make sure to replace the following placeholders with your own values:
-
routeName|Id
: Theid
orname
of the route the plugin configuration will target.
Make the following request:
curl -i -X POST http://localhost:8001/routes/{routeName|Id}/plugins/ \
--header "Accept: application/json" \
--header "Content-Type: application/json" \
--data '
{
"name": "amberflo",
"config": {
"apiKey": "'$API_KEY'",
"meterApiName": "kong-api-calls",
"customerHeader": "x-consumer-username",
"methodDimension": "method",
"hostDimension": "host",
"routeDimension": "route",
"serviceDimension": "service"
}
}
'
Make sure to replace the following placeholders with your own values:
-
routeName|Id
: Theid
orname
of the route the plugin configuration will target.
echo "
apiVersion: configuration.konghq.com/v1
kind: KongPlugin
metadata:
name: amberflo
namespace: kong
annotations:
kubernetes.io/ingress.class: kong
config:
apiKey: '$API_KEY'
meterApiName: kong-api-calls
customerHeader: x-consumer-username
methodDimension: method
hostDimension: host
routeDimension: route
serviceDimension: service
plugin: amberflo
" | kubectl apply -f -
Next, apply the KongPlugin
resource by annotating the httproute
or ingress
resource:
kubectl annotate -n kong httproute konghq.com/plugins=amberflo
kubectl annotate -n kong ingress konghq.com/plugins=amberflo