| title | Deploy {{site.konnect_short_name}} Reference Platform | ||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| content_type | how_to | ||||||||||||||||||||||||||||||||||||
| permalink | /konnect-reference-platform/how-to/ | ||||||||||||||||||||||||||||||||||||
| description | How to deploy the {{site.konnect_short_name}} Reference Platform | ||||||||||||||||||||||||||||||||||||
| products |
|
||||||||||||||||||||||||||||||||||||
| works_on |
|
||||||||||||||||||||||||||||||||||||
| tldr |
|
||||||||||||||||||||||||||||||||||||
| tags |
|
||||||||||||||||||||||||||||||||||||
| prereqs |
|
||||||||||||||||||||||||||||||||||||
| automated_tests | false |
For most use cases, a single {{site.konnect_short_name}} organization is sufficient. However, you may determine that your requirements include multiple {{site.konnect_short_name}} organizations which the reference platform can support.
The FAQ page provides guidance on {{site.konnect_short_name}} Organization design. If you choose to use multiple {{site.konnect_short_name}} 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 {{site.konnect_short_name}} Organization and sign in
The {{site.konnect_short_name}} Orchestrator (aka "orchestrator" or koctl) provides commands you can use to
setup the reference platform in your own engineering environment. koctl also runs within the APIOps workflows
and creates and manages resource configurations within your {{site.konnect_short_name}} Organization via APIs.
In order to authorize the tool, use the following steps to create a system account with
Organization Admin permissions:
- From the {{site.konnect_short_name}} web console, under
Organization->System Accounts, create a new System Account namedkonnect-orchestrator - Add the
konnect-orchestratorsystem account to theOrganization Adminteam - Use the Manage Tokens feature to generate a new access token for the
konnect-orchestratorsystem account and securely save the token secret
Regardless of the number of {{site.konnect_short_name}} 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.
{:.info}
While we refer to this repository as the
platformrepository, the repository name on GitHub is arbitrary. The {{site.konnect_short_name}} Orchestrator will file PRs to this repository under the.github/workflowsandkonnectsub-directories. You can use an existing repository as long as PRs with changes to these locations is acceptable.
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 its relationship to the orchestrator (e.g.
platform-konnect-orchestrator) -
Select the GitHub organization that owns the
platformrepository you created in the previous step and set appropriate token expiration -
Under Repository access, choose Only select repositories and choose the
platformrepository. -
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
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
initcommand from your shell:koctl init
Use the
Tabkey to navigate through the prompts and enter the required information -
Enter the GitHub URL for the
platformrepository 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 andkoctlwill proceed with initializing the repository by filing a PR containing the necessary changes to initialize the repository to participate in the platform
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.
As described earlier, the reference platform can support one or more {{site.konnect_short_name}} 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 {{site.konnect_short_name}} Organization to the platform repository. Run the following and
follow the prompts to provide the necessary information.
-
Run the
add organizationcommand 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 {{site.konnect_short_name}} Organization. This can be any name you choose but you should choose one that clearly relates to the name of the organization within {{site.konnect_short_name}}
-
Enter the {{site.konnect_short_name}} token you created earlier for the
konnect-orchestratorsystem account -
Once you have entered the necessary information, select the
Go!button and thekoctltool will proceed with adding a PR that sets up the organization within theplatformrepository
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 {{site.konnect_short_name}} Organization to the platform repository and the APIOps workflows will initiate
the necessary steps to prepare your {{site.konnect_short_name}} Organization for use with the reference platform.
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
platformteam 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 Secretvalue
These instructions detail how to use koctl to run the self service UI locally using Docker.
{: .info}
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
runcommand from your shell:koctl run
-
Use the
TabandEnterkeys to navigate through the prompts and enter the necessary information. -
Enter the
Client IDandClient Secretvalues you created in the previous step -
Enter the URL of the
platformrepository you created in the previous steps -
Enter the GitHub token secret you created for the
platformrepository 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
- Open the self-service UI at
http://localhost:8080in 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
platformrepository - 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>
{: .info}
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.yamlin the root of the repository. If necessary, the path can be overridden by changing thespec-pathfield in theteams.yamlconfiguration file staged by the PR.
- The
platformowner should then review and merge the PR. This will trigger the running of thekoctl applyworkflow which will 1) Apply the necessary configuration to the {{site.konnect_short_name}} Organization and 2) copy the service API specification to theplatformrepository. The API specification will be staged as a PR in theplatformrepository.
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 {{site.konnect_short_name}}. To see how the APIOps workflows operate, reference the APIOps page for the full details.
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 {{site.konnect_short_name}} Organization. Login to your {{site.konnect_short_name}} account and review the resources created by the orchestrator.
- Explore the Kong Developer site fully to learn about the features and capabilities of {{site.base_gateway}} and {{site.konnect_short_name}}.
- 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.