deck gateway sync

Uses: deck
Related Documentation
Related Resources

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. To apply a partial configuration use tags.

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

Syncing multiple files at once causes decK to merge all of the provided files in to a single configuration before syncing. To split your configuration in to independent units, use tags.

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

Command usage

Usage:
  deck gateway sync [flags] [kong-state-files...]

Flags:
      --consumer-group-policy-overrides                     allow deck to sync consumer-group policy overrides.
                                                            This allows policy overrides to work with Kong GW versions >= 3.4
                                                            Warning: do not mix with consumer-group scoped plugins
      --db-update-propagation-delay db_update_propagation   artificial delay (in seconds) that is injected between insert operations 
                                                            for related entities (usually for Cassandra deployments).
                                                            See db_update_propagation in kong.conf.
  -h, --help                                                help for sync
      --json-output                                         generate command execution report in a JSON format
      --no-mask-deck-env-vars-value                         do not mask DECK_ environment variable values at diff output.
      --parallelism int                                     Maximum number of concurrent operations. (default 10)
      --rbac-resources-only                                 diff only the RBAC resources (Kong Enterprise only).
      --select-tag strings                                  only entities matching tags specified via this flag are synced.
                                                            When this setting has multiple tag values, entities must match every tag.
                                                            All entities in the state file will get the select-tags assigned if not present already.
      --silence-events                                      disable printing events to stdout
      --skip-ca-certificates                                do not sync CA certificates.
      --skip-consumers                                      do not sync consumers, consumer-groups or any plugins associated with them.
      --skip-consumers-with-consumer-groups                 do not show the association between consumer and consumer-group.
                                                            If set to true, deck skips listing consumers with consumer-groups,
                                                            thus gaining some performance with large configs.
                                                            Usage of this flag without apt select-tags and default-lookup-tags can be problematic.
                                                            This flag is not valid with Konnect.
  -w, --workspace string                                    Sync configuration to a specific workspace (Kong Enterprise only).
                                                            This takes precedence over _workspace fields in state files.
      --yes yes                                             assume yes to prompts and run non-interactively.

Something wrong?

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!