Declarative config and decK

Kong Course · lesson 11 of 15 · 4 min read

Treat gateway config the way you treat code: in git, diffed, reviewed, applied.

Open this lesson in the learning hub

Key points

  • One YAML file describes every service, route, consumer and plugin - the whole gateway.
  • deck diff shows exactly what would change before anything is applied.
  • deck sync then makes the gateway match the file, adding and removing as needed.
  • Because it is a file, a bad change is reverted with git revert, not by remembering what you clicked.
  • Use deck dump once to capture an existing hand-configured gateway into a file.

Example

# see what would change - nothing is applied
deck gateway diff --state kong.yaml

# apply it: the gateway is made to match the file
deck gateway sync --state kong.yaml

# capture a running gateway into a file
deck gateway dump --output-file kong.yaml

If the gateway config is a file in git, a bad deploy is a revert instead of an investigation.

This is a reading copy. The full lesson — with the visual explainer, the interactive lab and a Run button for the code — lives in the Kong Course course, and every lesson in it is listed on the Kong Course contents page.