tyk-dev-portal
by Tyk
A Helm chart for deploying Tyk Enterprise Developer Portal on Kubernetes. The Tyk Enterprise Developer Portal is the most flexible and straightforward way for API providers to publish, monetise and drive the adoption of APIs. It provides a full-fledged CMS-like system that enables you to serve all stages of API adoption: from the look and feel customisation to exposing APIs and enabling third-party developers to register and use your APIs.
About this chart
Tyk Developer Portal
The Tyk Developer Portal is the most flexible and straightforward way for API providers to publish, monetise and drive the adoption of APIs. It provides a full-fledged CMS-like system that enables you to serve all stages of API adoption: from the look and feel customisation to exposing APIs and enabling third-party developers to register and use your APIs.
Introduction
This chart defines a standalone Tyk Developer Portal component on a Kubernetes cluster using the Helm package manager.
For typical usage, we recommend using following umbrella charts:
- For single data centre deployment, please use tyk-stack
Learn more about different deployment options
Prerequisites
- Kubernetes 1.19+
- Helm 3+
- Tyk Dashboard instance
Installation
1. Create Kubernetes Secret
Make sure the Kubernetes secret exists in your namespace containing Tyk Dashboard Organisation ID and Tyk Dashboard API Access Credentials.
This secret will automatically be generated if tyk-bootstrap component chart was installed with bootstrap.devPortal value set to true in the values.yaml.
If the secret does not exist, you can create it by running the following command.
kubectl create secret generic tyk-dev-portal-conf -n ${NAMESPACE} \
--from-literal=TYK_ORG=${TYK_ORG} \
--from-literal=TYK_AUTH=${TYK_AUTH}
The fields TYK_ORG and TYK_AUTH are the Tyk Dashboard Organisation ID and the Tyk Dashboard API Access Credentials respectively. These can be obtained under your profile in the Tyk Dashboard.
2. Install chart
To install the chart from the Helm repository in namespace tyk with the release name tyk-dev-portal:
helm repo add tyk-helm https://helm.tyk.io/public/helm/charts/
helm show values tyk-helm/tyk-dev-portal > values.yaml
[!NOTE] Set license key at
.Values.license
By default, Helm chart will try to discover Tyk Dashboard service in the same namespace. If you want to explicitly specify Tyk Dashboard URL, you can set .Values.overrideTykDashUrl in values.yaml file.
helm install tyk-dev-portal tyk-helm/tyk-dev-portal -n tyk --create-namespace -f values.yaml
Uninstalling the Chart
helm uninstall tyk-dev-portal -n tyk
This removes all the Kubernetes resources associated with the chart and deletes the release.
Upgrading Chart
helm upgrade tyk-dev-portal tyk-helm/tyk-dev-portal -n tyk
Configuration
See Customizing the Chart Before Installing. To get all configurable options with detailed comments:
helm show values tyk-helm/tyk-tyk-dev-portal > values.yaml
You can update any value in your local values.yaml file and use -f [filename] flag to override default values during installation. Alternatively, you can use --set flag to set it during chart installation.
Tyk Developer Enterprise Portal License (Required)
Tyk Developer Enterprise Portal License is required. It can be set up in license or through secret useSecretName. The secret should contain a key called DevPortalLicense.
# Developer Portal license.
license: ""
Storage Settings
Tyk Enterprise Portal supports different storage options for storing the portal's CMS assets such as images, theme files and Open API Specification files. Please see the Enterprise Portal Storage settings page for all the available options. Helm chart supports the setting of the following fields in storage section:
storage:
# Configuration values for using an SQL database as storage for Tyk Developer Portal
# In case you want to provide the connection string via secrets please
# refer to the existing secret inside the helmchart or the
# .Values.global.secrets.useSecretName variable
# User can set the storage type for portal.
# Supported types: fs, s3, db
type: "db"
# Configuration values for using s3 as storage for Tyk Developer Portal
# In case you want to provide the key ID and access key via secrets please
# refer to the existing secret inside the helm chart or the
# .Values.useSecretName field and a secret containing
# the keys DevPortalAwsAccessKeyId and respectively,
# DevPortalAwsSecretAccessKey
s3:
awsAccessKeyid: your-access-key
awsSecretAccessKey: your-secret-key
region: sa-east-1
endpoint: your-portal-bucket
bucket: https://s3.sa-east-1.amazonaws.com
acl: private
presign_urls: true
persistence:
# User can mount existing PVC to enterprise portal
# Make sure to change the kind to Deployment if you are mounting existing PVC
mountExistingPVC: ""
storageClass: ""
accessModes:
- ReadWriteOnce
size: 8Gi
annotations: {}
labels: {}
selector: {}
Database Settings
Portal uses database to store metadata related to the portal, such as API products, plans, developers, applications, and more. Please refer to Database connection settings for more details.
Helm chart provides following configuration options for database connection:
database:
# This selects the SQL dialect to be used
# The supported values are mysql, postgres and sqlite3
dialect: "sqlite3"
connectionString: "db/portal.db"
enableLogs: false
maxRetries: 3
retryDelay: 5000
Other Configurations
Other Enterprise Portal configurations can be set by using environment variables with extraEnvs fields, e.g.:
extraEnvs:
- name: PORTAL_LOG_LEVEL
value: debug
Security contexts on OpenShift
The portal pins securityContext.fsGroup: 2000 so that the storage PVC and any S3-credential mount are writable by
the non-root portal user on vanilla Kubernetes. On OpenShift the SCC does not override an explicitly-set fsGroup:
the MustRunAs strategy only defaults an unset one and validates an explicit one against the namespace's allocated
range, rejecting anything outside it.
To let the cluster allocate UID/GID instead, set enabled: false on the block you want omitted. Setting the block to
{} does not work, because Helm deep-merges the chart defaults back in.
securityContext:
enabled: false # omits the pod-level block
containerSecurityContext:
enabled: false # omits the container-level block
bootstrapJob:
securityContext:
enabled: false
containerSecurityContext:
enabled: false
Each block is scoped independently, and the enabled key itself is never rendered into the manifest.
The two bootstrapJob blocks ship empty (only enabled: true), so the bootstrap Job renders no securityContext
by default — you only need to disable them if you have added fields of your own.
Protect Confidential Fields with Kubernetes Secrets
In the values.yaml file, some fields are considered confidential, such as Developer Portal license, connection strings, etc.
Declaring values for such fields as plain text might not be desired for all use cases. Instead, for certain fields,
Kubernetes secrets can be referenced, and Kubernetes by itself configures values based on the referred secret.
This section describes how to use Kubernetes secrets to declare confidential fields.
Tyk Developer Enterprise Portal License
In order to refer Tyk Developer Enterprise Portal license through Kubernetes secret, please use useSecretName,
where the secret should contain a key called DevPortalLicense.
Tyk Developer Enterprise Portal Admin Password
In order to refer Tyk Developer Enterprise Portal's admin password through Kubernetes secret,
please use global.adminUser.useSecretName, where the secret should contain a key called adminUserPassword.
Tyk Developer Enterprise Portal Database Connection String
In order to refer Tyk Enterprise Portal connection string to the selected database through Kubernetes secret,
please use useSecretName, where the secret should contain a key called
DevPortalDatabaseConnectionString .
[!WARNING] If
useSecretNameis in use, please add all keys mentioned above to the secret.
Deploy tyk-dev-portal with OpenTenant
Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has tyk-dev-portal on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.
- Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
- Place the charttyk-dev-portal is pinned at v5.5.0 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
- ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below opentenant validate opentenant.yaml terraform init && terraform apply