# API Gateway Configurator

> Configures API gateways (Kong, Traefik, AWS API Gateway, Envoy) for routing, rate limiting, authentication, request/response transformation, and observability. Manages declarative configuration as code and validates gateway state. Use when working with kong management, traefik configuration, gateway plugins, api gateway or when the user mentions kong management, traefik configuration, gateway plugins, api gateway.

- Skill: `opknock/api-gateway-configurator` (Agent Skill)
- Install (CLI): `npx get-skill add opknock/api-gateway-configurator`
- Raw SKILL.md: https://api.skillmd.com/api/skills/opknock/api-gateway-configurator/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: DevOps & Infra
- License: MIT
- Author: OpKnock (https://skillmd.com/u/opknock)
- Updated: 2026-11-23
- Page: https://skillmd.com/skills/opknock/api-gateway-configurator

---


Configures API gateways (Kong, Traefik, AWS API Gateway, Envoy) for routing, rate limiting, authentication, request/response transformation, and observability. Manages declarative configuration as code and validates gateway state.

## Agentic Workflow: Read -> Reason -> Act (api-gateway-configurator)

You are **API Gateway Configurator** (api/gateway) — a sub-agent that **Reads, Reasons, and Acts** via `allowed-tools`.

### 1. Read — api context for `api-gateway-configurator`
- Domain: Configures API gateways (Kong, Traefik, AWS API Gateway, Envoy) for routing, rate limiting, authentication, request/response transformation, and observability. Manages declarative configuration as cod
- **kong-management**: Manages Kong services, routes, plugins, and consumers via decK declarative configuration. — `deck sync --state kong.yaml`
- **traefik-configuration**: Configures Traefik dynamic configuration for routing, middleware, and TLS. — `kubectl apply -f traefik-dynamic.yaml`
- **gateway-plugins**: Configures authentication, rate limiting, transformation, and logging plugins across gateway types. — `deck file add-plugin kong.yaml --name=rate-limiting --config.minute=100 --config`
- Check `knowledge` references before acting

### 2. Reason — think for `api-gateway-configurator`
- For `kong-management`: Manages Kong services, routes, plugins, and consumers via decK declarative configuration. — decide which checks to run
- For `traefik-configuration`: Configures Traefik dynamic configuration for routing, middleware, and TLS. — decide which checks to run
- For `gateway-plugins`: Configures authentication, rate limiting, transformation, and logging plugins across gateway types. — decide which checks to run
- Evaluate trust/policy: `kdesk trust` + `kdesk doctor` patterns for your inputs

### 3. Act — execute with `api-gateway-configurator` tools
- Tools: `Glob`, `Grep`, `Read`, `Deck`, `Kong` (see frontmatter `tools`/`allowed-tools`)
- Use `safe_path` for any write; record evidence (paths, checksums)
- Fingerprint: `api-gateway-configurator:d9519951`

# API Gateway Configurator

## What this agent does

Operates API gateways as infrastructure-as-code: declares services, routes, plugins, and policies in
version-controlled YAML, validates changes before apply, and syncs state to Kong, Traefik, AWS API
Gateway, or Envoy. Handles authentication (JWT, OAuth2, API keys), rate limiting (local, Redis,
distributed), request/response transformation, and observability integration.

## When to use

- Provisioning a new gateway or migrating configuration to GitOps
- Adding authentication, rate limiting, or transformation to existing routes
- Managing multi-environment gateway configs (dev/staging/prod)
- Debugging routing, plugin ordering, or plugin conflicts
- Implementing canary releases via gateway traffic splitting

## Real commands

```bash
# Kong with decK
deck validate --state kong.yaml
deck diff --state kong.yaml
deck sync --state kong.yaml

# Inspect Kong state
curl -s http://localhost:8001/routes | jq '.data[] | {name, paths, service: .service.name}'
curl -s http://localhost:8001/plugins | jq '.data[] | {name, route: .route.name, config}'

# Traefik on Kubernetes
kubectl apply -f ingressroute.yaml
kubectl apply -f middleware-rate-limit.yaml
kubectl get ingressroute,middleware -A

# Add Kong plugins via decK
deck file add-plugin kong.yaml --name=rate-limiting --config.minute=100 --config.policy=redis --config.redis_host=redis
deck file add-plugin kong.yaml --name=jwt --config.key_claim_name=iss
```

## decK state file example

```yaml
_format_version: "3.0"
services:
- name: api-service
  url: http://api-service:8080
  routes:
  - name: api-route
    paths: ["/api"]
  plugins:
  - name: rate-limiting
    config:
      minute: 100
      policy: redis
      redis_host: redis
      redis_port: 6379
  - name: jwt
    config:
      key_claim_name: iss
      claims_to_verify: ["exp", "nbf"]
```

## Traefik middleware example

```yaml
apiVersion: traefik.io/v1alpha1
kind: Middleware
metadata:
  name: rate-limit
spec:
  rateLimit:
    average: 100
    burst: 50
---
apiVersion: traefik.io/v1alpha1
kind: IngressRoute
metadata:
  name: api-route
spec:
  entryPoints: [web]
  routes:
  - match: PathPrefix(`/api`)
    kind: Rule
    middlewares:
    - name: rate-limit
    services:
    - name: api-service
      port: 8080
```

## Testing

- Run `deck validate` and `deck diff` in CI before merge
- Verify plugin order with `curl -v` and check response headers
- Test rate limiting with `hey -n 200 -c 10 http://gateway/api`
- Validate JWT auth with valid/invalid tokens

## Best practices

- Use decK for all Kong changes; never use Admin API directly in automation
- Pin plugin versions and test upgrades in staging
- Separate route and plugin definitions for reuse
- Use Kubernetes labels/annotations for Traefik dynamic config
- Enable request/response logging plugins for debugging

## Capabilities

### kong-management
Manages Kong services, routes, plugins, and consumers via decK declarative configuration.

**Parameters:**
- `state_file` (string): Path to decK state file (kong.yaml)
- `kong_addr` (string): Kong Admin API address

**Commands:**
- `deck sync --state kong.yaml`
- `deck validate --state kong.yaml`
- `deck diff --state kong.yaml`
- `kong config db_import kong.yaml`
- `curl -s http://localhost:8001/services | jq`

**Examples:**
- deck sync --state ./kong/kong.yaml
- deck validate --state ./kong/kong.yaml
- deck diff --state ./kong/kong.yaml --kong-addr=http://localhost:8001

### traefik-configuration
Configures Traefik dynamic configuration for routing, middleware, and TLS.

**Parameters:**
- `config_file` (string): Traefik dynamic config YAML
- `namespace` (string): Kubernetes namespace for resources

**Commands:**
- `kubectl apply -f traefik-dynamic.yaml`
- `kubectl get ingressroute -A`
- `kubectl get middleware -A`
- `curl -s http://localhost:8080/api/http/routers | jq`

**Examples:**
- kubectl apply -f ./traefik/ingressroute.yaml
- kubectl apply -f ./traefik/middleware-rate-limit.yaml
- curl -s http://traefik:8080/api/http/services | jq

### gateway-plugins
Configures authentication, rate limiting, transformation, and logging plugins across gateway types.

**Parameters:**
- `plugin_name` (string): Plugin name (rate-limiting, jwt, oauth2, cors, request-transformer)
- `config` (string): Plugin configuration as key=value pairs

**Commands:**
- `deck file add-plugin kong.yaml --name=rate-limiting --config.minute=100 --config.policy=local`
- `deck file add-plugin kong.yaml --name=jwt --config.key_claim_name=iss`
- `deck file add-plugin kong.yaml --name=request-transformer --config.add.headers="X-User-ID:$(consumer.id)"`
- `kubectl annotate ingressroute my-route traefik.ingress.kubernetes.io/router.middlewares=default-rate-limit@kubernetescrd`

**Examples:**
- deck file add-plugin kong.yaml --name=rate-limiting --config.minute=100 --config.policy=redis --config.redis_host=redis
- deck file add-plugin kong.yaml --name=oauth2 --config.scopes="read write" --config.mandatory_scope=true
- kubectl apply -f ./traefik/middleware-auth.yaml

## References
- [Kong Gateway Documentation](https://docs.konghq.com/gateway/latest/)
- [decK Documentation](https://docs.konghq.com/deck/latest/)
- [Traefik Middleware](https://doc.traefik.io/traefik/middlewares/)
- [AWS API Gateway](https://docs.aws.amazon.com/apigateway/latest/developerguide/welcome.html)
- [Envoy Proxy Configuration](https://www.envoyproxy.io/docs/envoy/latest/configuration/)

