Import and export specific service

Hi guys!
We are currently in r&d about implementing an API gateway and Kong was the choice. We are using kong gateway oss.

Here’s the scenario:
We deployed the Kong in production, then in our dev environment we added new service, routes and plug-ins.

Questions:
Is there a way to import the new service (with its route and plug-ins) and to export it on production without using the ‘deck gateway sync’ way? or without using manual curl?

Thanks!

For your scenario what is the downside for using deck gateway sync?

@dvqrbn Using deck is the most common way of managing Gateway configuration with Kong in traditional mode. deck provides you a simple declarative configuration based approach which aids greatly in moving configurations between environments. Additionally, deck provides other benefits including tools for deploying “APIOps” style management of configurations. As Mark said, if there are specific reasons you cannot you deck, please let us know.

1 Like

Hi Mark, I think it will be prone to error since its manual approach.
Let’s say I have deployed in production, so every time I have to deploy new service with plugins, this is what I think will be the steps:

  1. deck dump the prod yaml.
  2. deck dump the dev yaml then get the new sections needed.
  3. copy and paste it on dumped prod yaml
  4. deck diff both yaml
  5. deck sync.

Step 3 is crucial and need to focus for human error.

By utilizing tags within the deck configuration file, the configuration can be divided across multiple files, eliminating the need for copying and pasting all configurations into a single file.

For more information on tags see https://docs.konghq.com/deck/latest/guides/distributed-configuration/

1 Like

Hey Mark, I think this helped! I created an end-to-end service with tag just as you said, then just sync that file to deployed yaml.

However, I have a problem when using the merge approach: deck file merge httpbin.yaml another-httpbin.yaml --output-file merged-kong.yaml

When I’m syncing the merged yaml it returned error regarding the consumer:
Create consumer consumername failed: HTTP status 409 (message: "UNIQUE violation detected on '{username=\"consname\"}'")

But your thought helped. thanks!

I keep the files separate instead of using file marge for my use cases.

Also perhaps keep all consumer configurations in one file and/or check the correct tags have been exported/imported.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.