Declarative configuration with kongctl

Uses: kongctl

Manage Kong Konnect resources by declaring their desired state in YAML. kongctl queries Konnect, calculates a change plan, and executes it. It does not maintain a local state file. You can review changes directly with diff or save a JSON plan for review and later execution.

Namespaces define ownership and reconciliation boundaries. Use distinct namespaces for resources synchronized independently, such as each team’s development and production environments. Profiles select credentials and configuration; they do not create ownership boundaries.

Quick start

Install kongctl using the installation instructions, then authenticate with kongctl login. Save this manifest as portal.yaml:

portals:
  - ref: developer-portal
    name: developer-portal
    display_name: Developer Portal
    kongctl:
      namespace: docs-dev

Preview the creates and updates, then apply the configuration:

kongctl diff --mode apply -f portal.yaml
kongctl apply -f portal.yaml
kongctl get portals

Use kongctl explain portal to inspect accepted fields and kongctl scaffold portal to generate starter YAML for your installed version. For field definitions and supported resource types, see the declarative resource reference.

Choose a workflow

Goal

Command

Deletion behavior

Create and update apply Does not prune omitted resources
Reconcile desired state sync Prunes explicitly scoped collections
Remove selected resources delete Deletes selected resources
Review changes diff --mode <mode> Previews the selected mode

Execution commands generate a plan internally. For a separate review step:

kongctl plan --mode apply -f portal.yaml --output-file plan.json
kongctl diff --plan plan.json
kongctl apply --plan plan.json

Saved apply, sync, and delete plans require the matching execution command.

Find detailed behavior

Read the topic matching your task. Each page includes examples and the technical rules needed to interpret them. This guide was previously one page, so if an older link brought you here, find the section in one of the following topics. For schema details, use kongctl explain <resource>.<field> before guessing field names or tags.

Configuration files and resource identity

Choose identifiers, organize nested or root declarations, and load local or remote files.

Ownership, namespaces, and protection

Set namespaces, defaults, protection, and ownership guardrails.

Adopt existing resources

Preview adoption, select existing children, and save declarations for your configuration workflow.

Planning, reviewing, and executing changes

Choose commands, review saved plans, and understand execution and recovery.

Sync scope and deletion safety

Understand omissions, empty collections, singletons, and deletion scope.

References and external resource lookups

Link declarations and look up existing resources, including scoped parents.

Reusable configuration templates

Reuse configuration and understand inheritance and merge rules.

File values and path boundaries

Load file content, extract values, and choose path boundaries.

Environment values and saved plans

Choose deferred or stored values, types, and saved-plan behavior.

Write-only secrets and rotation

Create and rotate write-only values without embedding them in plans.

Managing multiple environments

Reuse a manifest across independently managed dev and prod environments.

Resource-specific declarative behavior

Check API operation removal, portal webhooks, and AI Gateway lifecycle rules.

Managing Gateway configuration with decK

Orchestrate Gateway state files through control planes.

Patching tagged configuration files

Edit tagged YAML without resolving its values.

AI-assisted declarative setup

Install the bundled agent skills from the repository where your agent works:

kongctl install skills

Preview installation with kongctl install skills --dry-run. Use the declarative skill to discover schemas and draft manifests, then review the resulting plan before applying changes. Agents can follow the topic links in this guide to load the detailed behavior needed for the current task.

Examples and troubleshooting

Browse example configurations for complete manifests. Use the GitHub Actions quickstart to automate diffs on pull requests and apply merged configuration. See Troubleshooting for authentication, planning, and file-loading failures.

See Use kongctl with AI agent skills for agent setup.

Help us make these docs great!

Kong Developer docs are open source. If you find these useful and want to make them better, contribute today!