Deploy Konnect Reference Platform
The following is a step by step guide to deploying a Konnect Reference Platform to your own Kong Konnect Organization and GitHub repositories.
Prerequisites
Reference Platform background
Before proceeding with deploying your own Konnect Reference Platform, review the landing page to ensure you have an understanding of the platform and its purpose.
Kong Konnect account
A Kong Konnect account is required to create and manage Konnect Organizations and resources. If you do not have a Konnect account, you can sign up for a free trial at https://konghq.com/products/kong-konnect/register.
GitHub account
A GitHub account is required with the authorization to create and administer repositories. For now, GitHub is the only supported Version Control System and these instructions are specific to it.
Konnect Orchestrator
The Konnect Orchestrator (or koctl
) is the
command line tool included in the Konnect Reference Platform.
-
On MacOS, install
koctl
using Homebrewbrew install kong/konnect-orchestrator/koctl
-
On Linux or Windows, install directly from the release page
Docker
This guide uses Docker to run a web application for onboarding teams and services to the Konnect Reference Platform. You must have Docker (or Docker equivalent software) installed on your development machine to run the web app.
Operating system compatibility
These instructions are specific to *nix style operating systems. For MS Windows, the user will need to make adjustments to commands and instructions.
Konnect organization setup
For most use cases, a single Konnect organization is sufficient. However, you may determine that your requirements include multiple Konnect organizations which the reference platform can support.
The FAQ page provides guidance on Konnect Organization design. If you choose to use multiple Konnect Organizations, the instructions pertaining to organizations in this guide will need to be repeated for each one you wish to add to the reference platform.
Create (if necessary) a new Konnect Organization and sign in
Authorize the Konnect Orchestrator to Konnect
The Konnect Orchestrator (aka “orchestrator” or koctl
) provides commands you can use to
setup the reference platform in your own engineering environment. koctl
is also ran within the APIOps workflows
and creates and manages resource configurations within your Konnect Organization via APIs.
In order to authorize the tool, use the following steps to create a system account with
Organization Admin permissions:
- From the Konnect web console, under
Organization->System Accounts
, create a new System Account namedkonnect-orchestrator
- Add the
konnect-orchestrator
system account to theOrganization Admin
team - Use the Manage Tokens feature to generate a new access token for the
konnect-orchestrator
system account and securely save the token secret
Platform Git repository setup
Regardless of the number of Konnect Organizations used, the reference platform operates around a single Platform Team git repository. This repository will contain copies of the development teams API specifications, APIOps workflows, and other configurations that the orchestrator will manage.
From the GitHub web console, create (if necessary) a platform
GitHub repository in your GitHub organization. An example repository
can be found in the KongAirlines GitHub organization.
While we refer to this repository as the
platform
repository, the repository name on GitHub is arbitrary. The Konnect Orchestrator will file PRs to this repository under the.github/workflows
andkonnect
sub-directories. You can use an existing repository as long as PRs with changes to these locations is acceptable.
Authorize the Konnect Orchestrator to GitHub
The orchestrator requires specific access to the platform
repository in order to facilitate the reference platform features.
In order to authorize the orchestrator, you need to create a GitHub access token with the proper permissions.
- From the GitHub web console, navigate to your profile menu, then Settings -> Developer Settings -> Personal access tokens
- Create a new Fine-grained token and give the token a name that indicates it’s relationship to the orchestrator (e.g.
platform-konnect-orchestrator
) - Select the GitHub organization that owns the
platform
repository you created in the previous step and set appropriate token expiration - Under Repository access, choose Only select repositories and choose the
platform
repository. -
Under Repository permissions, select all of the following permissions:
Repository Permission Access Description Actions
Read & Write Required to create and manage GitHub Actions Contents
Read & Write Required to write declarative configuration files to the repository Pull requests
Read & Write Required to file pull requests for all proposed code file changes Secrets
Read & Write Required to write secrets (the orchestrator cannot read secret values from the repository) Workflows
Read & Write Required to create and manage GitHub action workflows for APIOps - Once the token is generated, securely save the token secret
Initialize the platform repository
The orchestrator provides an init
command to initialize the platform GitHub repository for you.
The command will prompt you for the platform
team GitHub repository URL and the GitHub token created previously.
-
Run the
init
command from your shell:koctl init
Use the
Tab
key to navigate through the prompts and enter the required information -
Enter the GitHub URL for the
platform
repository you created previously (the URL should be in the formathttps://github.com/<org>/<repo>
) -
Enter the GitHub token secret you created in the previous step
-
Tab onto the
Go!
button andkoctl
will proceed with initializing the repository by filing a PR containing the necessary changes to initialize the repository to participate in the platform
Merge the Init PR
Once the koctl init
command has completed, you will see a message indicating that a PR has been filed to the platform
repository, including
a link directly to the PR. The PR will have the following title: [Konnect Orchestrator] - Init Platform
.
Open the PR in the GitHub web console and review the changes. Once satisfied with the changes,
merge the PR into the main
branch of the repository. You now have a platform
repository that is ready to be used with the
reference platform including GitHub actions that can facilitate the APIOps workflows and other configurations to support API delivery and governance.
Add an organization to the platform repository
As described earlier, the reference platform can support one or more Konnect Organizations. Generally a single organization design is sufficient, and you will only need to run the following instructions once. But if you wish to add multiple organizations, run these steps for each one you wish to support.
koctl
provides a command to add a new Konnect Organization to the platform repository. Run the following and
follow the prompts to provide the necessary information.
-
Run the
add organization
command from your shell:koctl add organization
- Enter the URL of the platform repository you created in the previous steps
- Enter the GitHub token secret you created in the previous steps
- Enter the name of the Konnect Organization. This can be any name you choose but you should choose one that clearly relates to the name of the organization within Konnect
- Enter the Konnect token you created earlier for the
konnect-orchestrator
system account - Once you have entered the necessary information, select the
Go!
button and thekoctl
tool will proceed with adding a PR that sets up the organization within theplatform
repository
Merge the organization PR
Once the koctl add organization
command has completed, you will see a message indicating that a PR has been filed to the platform
repository,
including a link directly to the PR. The PR will have the following title: [Konnect Orchestrator] - Add <org-name> Organization
.
Open the PR in the GitHub web console and review the changes. Once satisfied with the changes, merge the PR into the main
branch of the repository.
You have now added your Konnect to the platform
repository and the APIOps workflows will initiate
the necessary steps to prepare your Konnect Organization for use with the reference platform.
Create a Konnect Orchestrator GitHub OAuth application
The reference platform includes a web-based self service tool that can be used to onboard your development teams and their services. Once this tool is configured and ran, you (or your development teams) can use it to add teams and service applications to the platform.
The self service tool requires additional GitHub security configuration because it uses OAuth to allow users to sign in with their GitHub accounts to browse and select their service repositories.
- From the GitHub web console, navigate to your profile menu, then Settings -> Developer Settings -> OAuth Apps
- Create a new OAuth application and name it
Konnect Orchestrator
- Set the Homepage URL to your
platform
team repository (or any other URL you choose) - Set the Authorization callback URL to the localhost URL of the self service application:
http://localhost:8080/auth/github/callback
- Register the new application and securely save the
Client ID
- Click the Generate a new client secret button and securely save the
Client Secret
value
Run the self service UI
These instructions detail how to use koctl
to run the self service UI locally using Docker.
Just like any web based app, running the self service UI locally on Docker will not allow you to share access to the application with your users. It may be preferable for you to run the self service UI in a more production-like environment allowing your users to access the app from their own machines. These instructions do not cover that use case at this time. The Dockerfiles and built images can be found in the GitHub repository https://github.com/Kong/konnect-orchestrator
-
Run the
run
command from your shell:koctl run
- Use the
Tab
andEnter
keys to navigate through the prompts and enter the necessary information. - Enter the
Client ID
andClient Secret
values you created in the previous step - Enter the URL of the
platform
repository you created in the previous steps - Enter the GitHub token secret you created for the
platform
repository in previous steps - The command will run two Docker containers which host the platform repository API server and a web UI that allows users to sign in with their GitHub accounts and select their service repositories
Add a team and service to the platform
- Open the self-service UI at
http://localhost:8080
in your browser and sign in with your GitHub account - Select a GitHub Account or Organization you have access to and it will populate the list of repositories available and service repository to add to the platform
- Select the repository you wish to add to the platform
- Select the Production and Development branches in their respective drop down menus
- Select or Add a team
- Click the Add Service to Platform button and the orchestrator will file a PR to the
platform
repository - Once you have added the service, you will see the pending PR in the Pull Requests section of the self-service UI. The PR will have the following title:
[Konnect Orchestrator] - Add Service <service-name>
In order for the reference platform logic to work, there must be an OpenAPI specification found in the service repository. The orchestrator will look for a file named
openapi.yaml
in the root of the repository. If necessary, the path can be overridden by changing thespec-path
field in theteams.yaml
configuration file staged by the PR.
- The
platform
owner should then review and merge the PR. This will trigger the running of thekoctl apply
workflow which will 1) Apply the necessary configuration to the Konnect Organization and 2) copy the service API specification to theplatform
repository. The API specification will be staged as a PR in theplatform
repository.
Execute the APIOps Workflow
Once the koctl apply
workflow has successfully completed, the orchestrator will have created two PRs in the platform
repository one for
each environment (dev
and prod
). These PRs contain the addition of the service repository API specification to the platform
repository
and the addition of various patching files that are used to apply service specific configurations to the resulting decK configuration files.
Approving these initial PRs will initiate the APIOps workflows to deliver the APIs to Konnect. To see how the APIOps workflows operate, reference the APIOps page for the full details.
View your populated Konnect organization
Once the APIOps workflows are complete, your platform is now setup! The APIOps workflows are in place, and the orchestrator has created resources for you within the Konnect Organization. Login to your Konnect account and review the resources created by the orchestrator.
What’s next?
- Explore the Kong Developer site fully to learn about the features and capabilities of Kong Gateway and Konnect.
- For unanswered questions on the reference platform, check out the FAQ page for additional information.
- If you have questions or feedback about the reference platform, please reach out on the Kong Community Forums.