Enable the Amberflo pluginv3.0+
Enable the Amberflo.io metering plugin.
Environment variables
-
API_KEY: Your Amberflo API key
Add this section to your kong.yaml configuration file:
kong.yaml
Copied!
_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"
},
"tags": []
}
'
Copied!
echo "
apiVersion: configuration.konghq.com/v1
kind: KongClusterPlugin
metadata:
name: amberflo
namespace: kong
annotations:
kubernetes.io/ingress.class: kong
konghq.com/tags: ''
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 -
Copied!
Add this section to your kong.yaml configuration file:
kong.yaml
Copied!
_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: Theidornameof 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"
},
"tags": []
}
'
Copied!
Make sure to replace the following placeholders with your own values:
-
serviceName|Id: Theidornameof 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
konghq.com/tags: ''
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 -
Copied!
Next, apply the KongPlugin resource by annotating the service resource:
kubectl annotate -n kong service SERVICE_NAME konghq.com/plugins=amberflo
Copied!
Add this section to your kong.yaml configuration file:
kong.yaml
Copied!
_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: Theidornameof 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"
},
"tags": []
}
'
Copied!
Make sure to replace the following placeholders with your own values:
-
routeName|Id: Theidornameof 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
konghq.com/tags: ''
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 -
Copied!
Next, apply the KongPlugin resource by annotating the httproute or ingress resource:
kubectl annotate -n kong httproute konghq.com/plugins=amberflo
Copied!
kubectl annotate -n kong ingress konghq.com/plugins=amberflo
Copied!