tyk-dashboard
by Tyk
A Helm chart for deploying Tyk Dashboard component on Kubernetes. The Tyk Dashboard is the GUI and analytics platform for Tyk. It provides an easy-to-use management interface for managing a Tyk installation as well as clear and granular analytics. The Dashboard also provides the API Classic Developer Portal, a customisable developer portal for your API documentation, developer auto-enrolment and usage tracking.
About this chart
Tyk Dashboard
The Tyk Dashboard is the GUI and analytics platform for Tyk. It provides an easy-to-use management interface for managing a Tyk installation as well as clear and granular analytics.
The Dashboard also provides the API Classic Developer Portal, a customisable developer portal for your API documentation, developer auto-enrolment and usage tracking.
Introduction
This chart defines a standalone Tyk Dashboard 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
- For multi data centre deployment, please use tyk-control-plane (Coming soon!)
Learn more about Tyk Licensing and Deployment models
Prerequisites
- Kubernetes 1.19+
- Helm 3+
- Redis should already be installed or accessible by the dashboard
- MongoDB or PostgreSQL should already be installed or accessible by the dashboard
Installing the Chart
To install the chart from the Helm repository in namespace tyk with the release name tyk-dashboard:
helm repo add tyk-helm https://helm.tyk.io/public/helm/charts/
helm show values tyk-helm/tyk-dashboard > values-dashboard.yaml
Note:
- Set Redis connection details at
.Values.global.redis - Set MongoDB connection details at
.Values.global.mongo - The Tyk Dashboard also requires a license to be set at
.Values.global.license.dashboard - The Tyk Dashboard will require bootstrapping in order to work. This can be achieved by running the component chart "tyk-bootstrap"
helm install tyk-dashboard tyk-helm/tyk-dashboard -n tyk --create-namespace -f values-dashboard.yaml
Uninstalling the Chart
helm uninstall tyk-dashboard -n tyk
This removes all the Kubernetes components associated with the chart and deletes the release.
Upgrading Chart
helm upgrade tyk-dashboard tyk-helm/tyk-dashboard -n tyk
Note: pinned image tags and runAsUser
The runAsUser: 1000 defaults have been removed from dashboard.securityContext (pod level) and
dashboard.containerSecurityContext (container level) so that platforms such as OpenShift can assign a UID via
a Security Context Constraint. runAsNonRoot: true and fsGroup are retained, so kubelet now relies on the
image's USER directive.
The init-analytics-conf init container is the exception: it pins
dashboard.initContainers.initAnalyticsConf.securityContext.runAsUser: 1000, because busybox has no USER
directive of its own and runAsNonRoot: true without a runAsUser fails admission with
CreateContainerConfigError: container has runAsNonRoot and image will run as root. That container only renders
for dashboard.image.tag values <= 5.0.2. Set
dashboard.initContainers.initAnalyticsConf.securityContext.enabled: false to omit the block entirely on
OpenShift; securityContext: {} will not work, because Helm deep-merges the chart defaults back in.
If you pin dashboard.image.tag to a version whose image has no numeric USER, the main dashboard container
will also fail admission for the same reason. The dashboard image gained a numeric USER (65532) in v5.5.0;
every tag up to and including v5.4.0 has no USER directive and runs as root. Note that this threshold is
unrelated to the <= 5.0.2 condition above, which only controls whether the init container renders — tags
between v5.0.3 and v5.4.0 render no init container yet still fail on the main container. Check yours with
crane config <image> | jq -r '.config.User' before upgrading. Either move to a tag with a numeric USER (the
chart default is tykio/tyk-dashboard:v5.13.1, USER 65532), set an explicit
dashboard.containerSecurityContext.runAsUser, or set dashboard.containerSecurityContext.enabled: false to
omit the block entirely and let the cluster decide.
Configuration
See Customizing the Chart Before Installing. To get all configurable options with detailed comments:
helm show values tyk-helm/tyk-dashboard > 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 in Tyk installation.
Set Redis connection details (Required)
Tyk uses Redis for distributed rate-limiting and token storage.
You may set global.redis.addr and global.redis.pass with Redis connection string and password respectively.
If you do not already have Redis installed, you can use these charts provided by Bitnami
helm repo add bitnami https://charts.bitnami.com/bitnami
helm install tyk-redis bitnami/redis -n tyk --create-namespace
Follow the notes from the installation output to get connection details and password.
The DNS name of your Redis as set by Bitnami is tyk-redis-master.tyk.svc:6379 (Tyk needs the name including the port).
You can update them in your local values.yaml file under global.redis.addrs and global.redis.pass.
Alternatively, you can use --set flag to set it in Tyk installation. For example --set global.redis.pass=$REDIS_PASSWORD
Set MongoDB or PostgreSQL connection details (Required)
If you have already installed MongoDB or PostgreSQL, you can set the connection details in global.mongo and global.postgres section of values file respectively.
If not, you can use these rather excellent charts provided by Bitnami to install MongoDB or PostgreSQL:
MongoDB Installation
helm install tyk-mongo bitnami/mongodb --version {HELM_CHART_VERSION} --set "replicaSet.enabled=true" -n tyk
PostgreSQL Installation
helm install tyk-postgres bitnami/postgresql --set "auth.database=tyk_analytics" -n tyk
Follow the notes from the installation output to get connection details.
NOTE: Please make sure you are installing MongoDB or PostgreSQL versions that are supported by Tyk. Please refer to Tyk docs to get list of supported versions.
Dashboard Configurations
Tyk Dashboard License (Required)
Tyk Dashboard License is required. It can be set up in global.license.dashboard or through secret global.secrets.useSecretName. The secret should contain a key called DashLicense.
global:
license:
# The license key needed by Tyk Dashboard to work.
#
# NOTE: If you do not want to store license as a plain text in the file, you can use a Kubernetes secret
# that stores the dashboard license. Please see `.global.secrets.useSecretName`.
dashboard: ""
Enabling TLS
Assuming that TLS certificates for the Tyk Dashboard are available in the Kubernetes Secret tyk-dashboard-tls,
follow these steps to enable TLS:
- Set
global.tls.dashboardtotrue. - Set
dashboard.tls.secretNameto the name of the Kubernetes secret containing TLS certificates for the Tyk Dashboard, in this case,tyk-dashboard-tls. - Define certificate configurations in
dashboard.tls.certificates, which generatesTYK_DB_HTTPSERVEROPTIONS_CERTIFICATESfor the Tyk Dashboard.
Optional Steps, if needed:
- Modify the secret mount path on the Tyk Dashboard Pod via
dashboard.tls.certificatesMountPath.- If necessary, either enable
insecureSkipVerifyviadashboard.tls.certificates, or mount CA information throughdashboard.extraVolumesanddashboard.extraVolumeMounts.- If the
tyk-bootstrapchart is used to bootstrap the Tyk Dashboard, ensure that it has certificates to send requests to the Tyk Dashboard or enableinsecureSkipVerifyin thetyk-bootstrapchart.- If the Tyk Gateway connects to the Tyk Dashboard, confirm that the Tyk Gateway has appropriate certificates for connecting to the Tyk Dashboard
Embedded TIB
Starting from Tyk v3.0 TIB has been added as a built-in feature of the Tyk Dashboard. You no longer have to setup a separated instance of the service to make it work with the Dashboard.
User can enable in-built TIB simply by setting tib.enabled to true.
Enable autoscaling
This chart allows for easy configuration of autoscaling parameters. To simply enable autoscaling
it's enough to add --set dashboard.autoscaling.enabled=true. That will enable Horizontal Pod Autoscaler resource with
default parameters (avg. CPU load at 60%, scaling between 1 and 3 instances).
To customize those values you can add --set dashboard.autoscaling.averageCpuUtilization=75 or use values.yaml file:
Note: the built-in CPU and memory rules scale on utilization, which Kubernetes computes as a percentage of a pod's resource requests.
dashboard.resourcesis empty by default, so enabling autoscaling on its own produces an HPA whose target reads<unknown>and which never scales the Deployment. Setdashboard.resources.requestsalongside it, as below.
dashboard:
autoscaling:
enabled: true
minReplicas: 3
maxReplicas: 30
# Required for the utilization-based rules above: the HPA measures CPU and memory usage
# as a percentage of these requests. Size them for your own workload.
resources:
requests:
cpu: 100m
memory: 128Mi
When autoscaling is enabled the Deployment stops declaring spec.replicas, handing the replica count
to the HPA so that helm upgrade and GitOps reconciles no longer fight it. That has a one-off cost when
switching an existing release that runs more than one replica: Helm removes the replicas field, the
API server falls back to its default of 1, and the Deployment scales down until the HPA reconciles and
scales it back up. To keep capacity across the switch, set minReplicas to the replicaCount you are
migrating from:
dashboard:
replicaCount: 5 # what the release runs today
autoscaling:
enabled: true
minReplicas: 5 # HPA holds at least this many, so the switch does not drop to 1
maxReplicas: 30
The same applies in reverse: turning autoscaling back off makes the Deployment declare
dashboard.replicaCount again (default 1), so update it to whatever the HPA had settled on before
disabling.
Built-in rules include dashboard.autoscaling.averageCpuUtilization for CPU utilization (set by default at 60%) and
dashboard.autoscaling.averageMemoryUtilization for memory (disabled by default).
In addition to that you can define rules for custom metrics using dashboard.autoscaling.autoscalingTemplate list:
dashboard:
autoscaling:
autoscalingTemplate:
- type: Pods
pods:
metric:
name: nginx_ingress_controller_nginx_process_requests_total
target:
type: AverageValue
averageValue: 10000m
Deploy tyk-dashboard with OpenTenant
Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has tyk-dashboard 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-dashboard 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