Synchronize your local and remote state
The deck gateway sync
command configures the target Kong Gateway to match the values specified in your declarative configuration.
Any configuration in Kong Gateway that isn’t present in the provided declarative configuration file will be deleted using
deck gateway sync
.
The deck gateway sync
command can accept one or more files as positional arguments:
# Sync a single file
deck gateway sync kong.yaml
In addition to positional arguments, deck gateway sync
can read input from stdin
for use in pipelines:
# Remove example-service from the file before syncing
cat kong.yaml | yq 'del(.services[] | select(.name == "example-service"))' | deck gateway sync
Syncing multiple files
decK can construct a state by combining multiple JSON or YAML files inside a directory instead of a single file.
In most use cases, a single file will suffice, but you might want to use multiple files if:
- You want to organize the files for each service. In this case, you can have one file per service, and keep the service, its associated routes, plugins, and other entities in that file.
- You have a large configuration file and want to break it down into smaller digestible chunks.
# Sync multiple files
deck gateway sync services.yaml consumers.yaml
# Sync a whole directory
deck gateway sync directory/*.yaml
Note that having the state split across different files is not same as distributed configuration using tags.