The repository is setup! You can now install packages.
You will now be able to install MDCB as follows:
tyk-redis-master.tyk-cp.svc:6379
(Tyk needs the name including the port)
The Bitnami chart also creates a secret tyk-redis
which stores the connection password in redis-password
. We will make use of this secret in installation later.
dashboard-svc-tyk-cp-tyk-dashboard
at port 3000
and mdcb-svc-tyk-cp-tyk-mdcb
at port 9091
respectively. You can login to Dashboard using the admin email and password to start managing APIs.
You can use the MDCB connection details included in the installation output, to install the MDCB Data Plane.
/opt/tyk-sink/tyk_sink.conf
file as follows:
analytics
storage. In order to setup your PostgreSQL storage, you can use the same configuration from your Tyk Dashboard main storage.For example, to set up a postgres
storage the analytics
configurations would be:http_port
configuration setting and defaults to 8181
. Do not use the standard MDCB listen port (listen_port
) for MDCB health checks.
From MDCB v2.7.0, there are 2 health check services available:
/liveness
endpoint returns a HTTP 200 OK
response when the service is operational./readiness
endpoint returns a HTTP 200 OK
response when MDCB is ready to accept requests. It ensures that dependent components such as Redis and data store are connected, and the gRPC server is ready for connection./health
via the port defined by the healthcheck_port
configuration setting. The default port is 8181
. The /health
endpoint is also available on v2.7.0 or later for backward compatibility.
To use the health check service, call the /health
endpoint i.e. http://my-mdcb-host:8181/health
. This will return a HTTP 200 OK
response if the service is running.
Please note that an HTTP 200 OK response from the /health
endpoint merely indicates that the MDCB service is operational. However, it is important to note that the service may not yet be ready for use if it is unable to establish a connection with its dependent components (such as Redis and Data store) or if they are offline. Upgrade to v2.7.0 and later to have more accurate health checking.
-f
flag to follow the log. The command should return output similar to this:
/config
can be enabled that allows you to query configuration of MDCB.
To enable the secured HTTP endpoint, make sure you have the following in your /opt/tyk-sink/tyk_sink.conf
config file.
/config
endpoint to return a json representation of your MDCB config:
/env
endpoint to return your MDCB config in the form of environment variables settings:
export DASH_ADMIN_SECRET=<YOUR_ADMIN_SECRET>
<YOUR_ADMIN_SECRET>
in tyk_analytics.conf
file under admin_secret
field or TYK_DB_ADMINSECRET
environment variable.
export DASH_URL=<YOUR_DASH_URL>
export ORG_ID=<YOUR_ORG_ID>
/admin/organisations/$ORG_ID
to retrieve the organization object. In the example below, we are redirecting the output json to a file myorg.json
for easy editing.myorg.json
in your favorite text editor and add the following fields as follows.
New fields are between the ...
.hybrid_enabled
and event_options
configuration fields have been added:
hybrid_enabled:
Allows a worker gateway to login as an organization member into MDCB.
event_options:
The event_options
object is optional. By default the update and removal of Redis keys (hashed and unhashed), API Definitions and policies are propagated to various instance zones. The event_options
object contains a key_event
object that allows configuration of the following additional features:
webhook
property to the value of the webhook URL. Similarly, events can be notified via email by setting the email
property to the value of the target email address.redis
property to true
.event_options
in the example above enables the following functionality:
redis
is true
https://example.com/webhook
and email address [email protected]
myorg.json
file.gateway-svc-tyk-dp-tyk-gateway
at port 8080
. Pump is also configured with Hybrid Pump which sends aggregated analytics to MDCB, and Prometheus Pump which expose metrics locally at :9090/metrics
.
gateway-svc-tyk-dp-tyk-gateway
at port 8080
. Pump is also configured with Hybrid Pump which sends aggregated analytics to MDCB, and Prometheus Pump which expose metrics locally at :9090/metrics
.
For the complete installation guide and configuration options, please see Tyk Data Plane Chart.
tyk-data-plane
Chart, you don’t need to go through following steps to configure Tyk Gateway. The necessary configurations has been set in tyk-data-plane
chart templates.tyk.conf
) as follows:
"use_db_app_configs": false,
Next, we need to ensure that the policy loader and analytics pump use the RPC driver:
analytics_config.type
to rpc
- make sure you don’t have your Tyk Pump configured to send analytics via the hybrid
Pump type.key_space_sync_interval
to set the period’s length in which the gateway will check for changes in the key space, if this value is not set then by default it will be 10 seconds.
The most important elements here are:
Field | Description |
---|---|
api_key | This the API key of a user used to authenticate and authorize the Gateway’s access through MDCB. The user should be a standard Dashboard user with minimal privileges so as to reduce risk if compromised. The suggested security settings are read for Real-time notifications and the remaining options set to deny . |
group_id | This is the “zone” that this instance inhabits, e.g. the cluster/data center the gateway lives in. The group ID must be the same across all the gateways of a data center/cluster which are also sharing the same Redis instance. This id should also be unique per cluster (otherwise another gateway’s cluster can pick up your keyspace events and your cluster will get zero updates). |
connection_string | The MDCB instance or load balancer. |
bind_to_slugs | For all Tyk installations except for Tyk Classic Cloud this should be set to false. |
helm
, jq
, kubectl
and watch
gcloud
./google-cloud-sdk/install.sh
gcloud auth login
gcloud components install gke-gcloud-auth-plugin
gcloud container clusters get-credentials <<gcp_cluster_name>> —zone <<zone_from_gcp_cluster>>—project <<gcp_project_name>>
kubectl
kubectl get nodes
.env
file within tyk-k8s-demo based on the provided .env.example
file.env
:
LICENSE=<dashboard_license>
MDCB_LICENSE=<mdcb_license>
./up.sh -r redis-cluster -e load-balancer tyk-cp
./up.sh
script:
TYK_WORKER_CONNECTIONSTRING=<MDCB-exposure-address:port> TYK_WORKER_ORGID=<org_id> TYK_WORKER_AUTHTOKEN=<mdcb_auth_token> TYK_WORKER_USESSL=false ./up.sh --namespace <worker-namespace> tyk-worker
<worker-namespace>
to tyk-worker-us
, the other to tyk-worker-eu
(or namespaces of your choice)
Deploying the tyk-worker-us
namespace (Data Plane #1)
tyk-worker-eu
namespace (Data Plane #2)
curl
to verify that the gateways are alive by calling their /hello
endpointswatch
to observe each of the Kubernetes namespacestyk-cp
(Control Plane)
tyk-worker-us
(Data Plane #1)
tyk-worker-eu
(Data Plane #2)
34.136.51.227:3000
, so just enter this in your browser./up.sh
output:
[email protected]
topsecretpassword
(or whatever you’ve configured in the .env
file)Open - keyless
); for simplicity we suggest a simple pass-through proxy to httbin.org
.34.173.240.149:8081
for my tyk-worker-us
gateway above).httpbin.org
again. You can see in the Dashboard’s API Usage Data section that there will have been success and error requests to the API.Open - keyless
and confirm that you can hit the endpoint without the Authentication key from both workers.kubectl delete deployment.apps/mdcb-tyk-cp-tyk-pro -n tyk
./up.sh -r redis-cluster -e load-balancer tyk-cp
./down.sh -n tyk-worker-us
./down.sh -n tyk-worker-eu
./down.sh
"slave_options":{ "synchroniser_enabled":true }
Please see Gateway configuration options for reference.
To configure how often the worker Gateways read signals from MDCB control plane:
"slave_options":{ "key_space_sync_interval": 10 }
It configures the interval (in seconds) that the worker Gateway will take to check if there are any changes. If this value is not set then it will default to 10 seconds.
Please see Gateway configuration options for reference.
If you are running a cluster of Gateways, you must have a GroupID configured for synchronisation to work properly and propagate keys.
"slave_options":{ "group_id": "FOOBAR" }
Please see Gateway configuration options for reference
"sync_worker_config":{ "enabled":true }
Please see MDCB configuration options for reference.
If API keys were used and hash key is disabled, please also set these additional configurations for the following components:
"sync_worker_config":{ "enabled":true, "hash_keys": false }, "hash_keys": false
"hash_keys": false
"hash_keys": false
If certificates were used, please also set these additional configurations:
"security.private_certificate_encoding_secret"
with the certificate encoding secret. This is required because MDCB would decode the certificate first before propagating it to worker gateways. The worker Gateways could encode the certificate with their own secret.
Please see MDCB configuration options for reference