Skip to content
Kong Docs are moving soon! Our docs are migrating to a new home. You'll be automatically redirected to the new site in the future. In the meantime, view this page on the new site!
Kong Logo | Kong Docs Logo
  • Docs
    • Explore the API Specs
      View all API Specs View all API Specs View all API Specs arrow image
    • Documentation
      API Specs
      Kong Gateway
      Lightweight, fast, and flexible cloud-native API gateway
      Kong Konnect
      Single platform for SaaS end-to-end connectivity
      Kong AI Gateway
      Multi-LLM AI Gateway for GenAI infrastructure
      Kong Mesh
      Enterprise service mesh based on Kuma and Envoy
      decK
      Helps manage Kong’s configuration in a declarative fashion
      Kong Ingress Controller
      Works inside a Kubernetes cluster and configures Kong to proxy traffic
      Kong Gateway Operator
      Manage your Kong deployments on Kubernetes using YAML Manifests
      Insomnia
      Collaborative API development platform
  • Plugin Hub
    • Explore the Plugin Hub
      View all plugins View all plugins View all plugins arrow image
    • Functionality View all View all arrow image
      View all plugins
      AI's icon
      AI
      Govern, secure, and control AI traffic with multi-LLM AI Gateway plugins
      Authentication's icon
      Authentication
      Protect your services with an authentication layer
      Security's icon
      Security
      Protect your services with additional security layer
      Traffic Control's icon
      Traffic Control
      Manage, throttle and restrict inbound and outbound API traffic
      Serverless's icon
      Serverless
      Invoke serverless functions in combination with other plugins
      Analytics & Monitoring's icon
      Analytics & Monitoring
      Visualize, inspect and monitor APIs and microservices traffic
      Transformations's icon
      Transformations
      Transform request and responses on the fly on Kong
      Logging's icon
      Logging
      Log request and response data using the best transport for your infrastructure
  • Support
  • Community
  • Kong Academy
Get a Demo Start Free Trial
decK
  • Home icon
  • decK
  • Gateway
  • Object Defaults
github-edit-pageEdit this page
report-issueReport an issue
  • Kong Gateway
  • Kong Konnect
  • Kong Mesh
  • Kong AI Gateway
  • Plugin Hub
  • decK
  • Kong Ingress Controller
  • Kong Gateway Operator
  • Insomnia
  • Kuma

  • Docs contribution guidelines
  • Introduction
    • Overview
    • Configuration Options
    • Support Policy
    • Security Policy
  • Changelog
  • Installation
    • Overview
    • Binary
    • Docker
    • GitHub Actions
  • Get Started
  • Managing Kong Gateway
    • Overview
    • Konnect Configuration
    • Configure Authentication
    • Ping
    • Backup
    • Diff
    • Sync
    • Apply
    • Reset
    • Validate
    • RBAC
    • Workspaces
    • Tags
    • De-duplicate Plugin Configuration
    • Object Defaults
    • Sensitive Data
  • decK Files
    • Overview
    • Config Generation
      • openapi2kong
      • kong2kic
      • kong2tf
    • Linting
    • File Manipulation
      • Overview
      • Update Values
      • Plugins
      • Tags
      • Namespace
    • Combining Files
      • Merge
      • Render
    • Validate
    • Convert
  • APIOps
    • Overview
    • Continuous Integration
    • Federated Config
  • Reference
    • Entities
    • FAQ
    • Gateway 3.0 Upgrade
    • Environment Variables
enterprise-switcher-icon Switch to OSS
On this pageOn this page
  • Value order of precedence
  • Test default value handling
  • Set custom defaults
  • Find defaults for an object
  • See also

Object Defaults

Kong Gateway sets some default values for most objects, including Kong plugins. You can see what the defaults are for each object in the Admin API reference, or use the /schemas endpoint to check the latest object schemas for your instance of the Kong Gateway.

decK recognizes value defaults and doesn’t interpret them as changes to configuration. If you push a config for an object to Kong Gateway with sync, Kong Gateway applies its default values to the object, but a further diff or sync does not show any changes.

If you upgrade Kong Gateway to a version that introduces a new property with a default value, a diff will catch the difference.

You can also configure your own custom defaults to enforce a set of standard values and avoid repetition in your configuration.

Value order of precedence

decK assigns values in the following order of precedence, from highest to lowest:

  1. Values set for a specific instance of an object in the state file (for example, for a service named example_service defined in kong.yml).
  2. Values set in the {_info: defaults:} object in the state file.
  3. Self-managed Kong Gateway only: Values are checked against the Kong Admin API schemas.
  4. Konnect Cloud only: Values are checked against the Kong Admin API for plugins, and against hardcoded defaults for Service, Route, Upstream, and Target objects.

Test default value handling

Create a sample kong.yaml file with a service, route, and plugin, push it to Kong Gateway, and then pull Kong Gateway’s configuration down again to see how decK interprets default values.

  1. Create a kong.yaml configuration file with the following sample service, route, and plugin:

    _format_version: "3.0"
    services:
      - host: httpbin.konghq.com
        name: example_service
        routes:
          - name: mockpath
            paths:
            - /mock
    plugins:
    - name: basic-auth
      config:
        hide_credentials: true
    
  2. Compare this file with the object configuration in Kong Gateway:

    Command
    Response
    deck gateway diff kong.yaml
    creating service example_service
    creating route mockpath
    creating plugin basic-auth (global)
    Summary:
      Created: 3
      Updated: 0
      Deleted: 0

    If you’re using a completely empty instance, you should only see the service, route, and basic-auth plugin creation messages with no extra JSON data.

  3. Sync your changes with Kong Gateway:

     deck gateway sync kong.yaml
    
  4. Now, run another diff and note the response:

    Command
    Response
    deck gateway diff kong.yaml
    Summary:
      Created: 0
      Updated: 0
      Deleted: 0

    Notice that the diff doesn’t show any changes. This is because decK checked the values against the service and route schemas and didn’t find any differences.

  5. You can check that any missing default values were set by exporting Kong Gateway’s object configuration into a file. If you want to avoid overwriting your current state file, specify a different filename:

    deck gateway dump -o kong-test.yaml
    

    Even though diff didn’t show any changes, the result now has default values populated for the service, route, and Basic Auth plugin:

    _format_version: "3.0"
    plugins:
    - config:
        anonymous: null
        hide_credentials: true
      enabled: true
      name: basic-auth
      protocols:
      - grpc
      - grpcs
      - http
      - https
    services:
    - connect_timeout: 60000
      host: httpbin.konghq.com
      name: example_service
      port: 80
      protocol: http
      read_timeout: 60000
      retries: 5
      routes:
      - https_redirect_status_code: 426
        name: mockpath
        path_handling: v0
        paths:
        - /mock
        preserve_host: false
        protocols:
        - http
        - https
        regex_priority: 0
        request_buffering: true
        response_buffering: true
        strip_path: true
      write_timeout: 60000
    

Set custom defaults

You can set custom configuration defaults for the following core Kong Gateway objects:

  • Service
  • Route
  • Upstream
  • Target

Default values get applied to both new and existing objects. See the order of precedence for more detail on how they get applied.

You can choose to define custom default values for any subset of entity fields, or define all of them. decK still finds the default values using a combination of your defined fields and the object’s schema, based on the order of precedence.

decK supports setting custom object defaults both in self-managed Kong Gateway and with Kong Konnect.

Important: This feature has the following limitations:

  • Custom plugin object defaults are not supported.
  • If an existing property’s default value changes in a future Kong Gateway release, decK has no way of knowing that this change has occurred, as its defaults configuration would overwrite the value in your environment.
  1. In your kong.yaml configuration file, add an _info section with defaults:

    _format_version: "3.0"
    _info:
      defaults:
    services:
      - host: httpbin.konghq.com
        name: example_service
        routes:
          - name: mockpath
            paths:
              - /mock
    

    For production use in larger systems, we recommend that you break out your defaults into a separate defaults.yaml file or use tags to apply the defaults wherever they are needed.

  2. Define the properties you want to set for Kong Gateway objects.

    You can define custom defaults for service, route, upstream, and target objects.

    For example, you could define default values for a few fields of the Service object:

    _format_version: "3.0"
    _info:
      defaults:
        service:
          port: 8080
          protocol: https
          retries: 10
    services:
      - host: httpbin.konghq.com
        name: example_service
        routes:
          - name: mockpath
            paths:
              - /mock
    

    Or you could define custom default values for all available fields:

    _format_version: "3.0"
    _info:
      defaults:
        route:
          https_redirect_status_code: 426
          path_handling: v1
          preserve_host: false
          protocols:
          - http
          - https
          regex_priority: 0
          request_buffering: true
          response_buffering: true
          strip_path: true
        service:
          port: 8080
          protocol: https
          connect_timeout: 60000
          write_timeout: 60000
          read_timeout: 60000
          retries: 10
    services:
      - host: httpbin.konghq.com
        name: example_service
        routes:
          - name: mockpath
            paths:
              - /mock
    
  3. Sync your changes with Kong Gateway:

     deck gateway sync kong.yaml
    
  4. Run a diff and note the response:

Command
Response
deck gateway diff kong.yaml
Summary:
     Created: 0
     Updated: 0
     Deleted: 0

Whether you choose to define a subset of custom defaults or all available options, the result is the same: the diff doesn’t show any changes.

Find defaults for an object

Kong Gateway defines all the defaults it applies in object schema files. Check the schemas to find the most up-to-date default values for an object.

If you want to completely avoid differences between the configuration file and the Kong Gateway, set all possible default values for an object in your kong.yaml file.

Route
Service
Upstream
Target
Plugins

Use the Kong Admin API /schemas endpoint to find default values:

curl -i http://localhost:8001/schemas/routes

In your kong.yaml file, set the default values you want to use across all Routes. For example:

_info:
  defaults:
    route:
      https_redirect_status_code: 426
      path_handling: v0
      preserve_host: false
      protocols:
      - http
      - https
      regex_priority: 0
      request_buffering: true
      response_buffering: true
      strip_path: true

Note: If the Route protocols include grpc and grpcs, the strip_path schema value must be false. If set to true, deck returns a schema violation error.

For documentation on all available properties, see the Route object documentation.

Use the Kong Admin API /schemas endpoint to find default values:

curl -i http://localhost:8001/schemas/services

In your kong.yaml file, set the default values you want to use across all Services. For example:

_info:
  defaults:
    service:
      port: 80
      protocol: http
      connect_timeout: 60000
      write_timeout: 60000
      read_timeout: 60000
      retries: 5

For documentation on all available properties, see the Service object documentation.

Use the Kong Admin API /schemas endpoint to find default values:

curl -i http://localhost:8001/schemas/upstreams

In your kong.yaml file, set the default values you want to use across all Upstreams. For example:

_info:
  defaults:
    upstream:
      slots: 10000
      algorithm: round-robin
      hash_fallback: none
      hash_on: none
      hash_on_cookie_path: /
      healthchecks:
        active:
          concurrency: 10
          healthy:
            http_statuses:
            - 200
            - 302
            interval: 0
            successes: 0
          http_path: /
          https_verify_certificate: true
          timeout: 1
          type: http
          unhealthy:
            http_failures: 0
            http_statuses:
            - 429
            - 404
            - 500
            - 501
            - 502
            - 503
            - 504
            - 505
            interval: 0
            tcp_failures: 0
            timeouts: 0
        passive:
          healthy:
            http_statuses:
            - 200
            - 201
            - 202
            - 203
            - 204
            - 205
            - 206
            - 207
            - 208
            - 226
            - 300
            - 301
            - 302
            - 303
            - 304
            - 305
            - 306
            - 307
            - 308
            successes: 0
          type: http
          unhealthy:
            http_failures: 0
            http_statuses:
              - 429
              - 500
              - 503
            tcp_failures: 0
            timeouts: 0
        threshold: 0

For documentation on all available properties, see the Upstream object documentation.

Use the Kong Admin API /schemas endpoint to find default values:

curl -i http://localhost:8001/schemas/targets

In your kong.yaml file, set the default values you want to use across all Targets. For example:

_info:
  defaults:
    target:
      weight: 100

For all available properties, see the Target object documentation.

Use the Kong Admin API /schemas endpoint to find default values:

curl -i http://localhost:8001/schemas/plugins/<plugin-name>

decK doesn’t support setting custom default values for the plugin object.

See also

  • Deduplicate plugin configuration
  • Using multiple files to store configuration
  • Kong Gateway admin API: /schemas endpoint
Thank you for your feedback.
Was this page useful?
Too much on your plate? close cta icon
More features, less infrastructure with Kong Konnect. 1M requests per month for free.
Try it for Free
  • Kong
    Powering the API world

    Increase developer productivity, security, and performance at scale with the unified platform for API management, service mesh, and ingress controller.

    • Products
      • Kong Konnect
      • Kong Gateway Enterprise
      • Kong Gateway
      • Kong Mesh
      • Kong Ingress Controller
      • Kong Insomnia
      • Product Updates
      • Get Started
    • Documentation
      • Kong Konnect Docs
      • Kong Gateway Docs
      • Kong Mesh Docs
      • Kong Insomnia Docs
      • Kong Konnect Plugin Hub
    • Open Source
      • Kong Gateway
      • Kuma
      • Insomnia
      • Kong Community
    • Company
      • About Kong
      • Customers
      • Careers
      • Press
      • Events
      • Contact
  • Terms• Privacy• Trust and Compliance
© Kong Inc. 2025