Skip to main content
Version: 1.0.x

Kubernetes Installation

note

Before installing Lunar's API Consumption Gateway, make sure that Helm is installed on your environment. If you haven't installed Helm yet, you can learn more about it and download it from the Helm website

Installation through the Lunar Control Plane

The easiest installation process is through the Lunar Control Plane. After launching the control plane, simply follow the step-by-step instructions that appear after clicking the "Continue" button. As long as you have a Docker instance up and running, the Lunar Control Plane will be automatically synced to your API Consumption Gateway via the API key that appears in the command for you to copy.

Manual Installation

Alternatively, if you do not want to leverage the Lunar Control Plane, you can install the Lunar API Consumption Gateway without the UI by following the steps below.

Step 1: Add and update Lunar repository

To start the installation process, add and update our Lunar API Consumption Gateway repository for helm charts. ֿOpen a terminal or command prompt and execute the following command:

helm repo add lunar https://thelunarcompany.github.io/proxy-helm-chart/
helm repo update

Step 2: Override Lunar API Consumption Gateway configuration (Optional)

if you need to override values in the Lunar API Consumption Gateway chart, you can get the default values.

helm show values lunar/lunar-proxy | tee values.yaml

Step 3: Install Lunar API Consumption Gateway helm chart

Once you have the updated values.yaml file, you can proceed to install the Lunar API Consumption Gateway chart using the following command:

  1. In case of default installation
helm install lunar-proxy lunar/lunar-proxy --set tenantName=<name> --namespace lunar-proxy --create-namespace
note

Before installing Lunar's API Consumption Gateway, ensure that the tenantName is set to the name of your organization, for example: Acme or Google.

tenantName - is a mandatory requirement, Lunar API Consumption Gateway will not start if it is left unset. This can also be set in the values.yaml file.

  1. In case of changes in the values.yaml
helm install lunar-proxy lunar/lunar-proxy -f values.yaml

Step 4: Verify Installation

To ensure the successful installation of Lunar API Consumption Gateway there are two options:

Option 1: Run the following command to make a request to the healthcheck endpoint which validates that Lunar API Consumption Gateway is up.

helm test lunar-proxy

Option 2: Try to pass a request through the API Consumption Gateway by running the following command:

curl http://localhost:8000/fact -H "x-lunar-host: catfact.ninja" -H "x-lunar-scheme: https"

This will make a request to Lunar API Consumption Gateway on port 8000, which will forward the request to the upstream server catfact.ninja on port 443, at the path /fact (this is an API that returns the latest exchange rates).

The result should look something like this:

{"fact":"Among many other diseases, cats can suffer from anorexia, senility, feline AIDS and acne.","length":89}

Then, use the Discover command to validate that the requests were passed through Lunar API Consumption Gateway.

kubectl exec <lunar-proxy-pod-name> -- discover

The result should look something like this:

{
"interceptors": [
{
"type": "unknown",
"version": "unknown",
"last_transaction_date": "2023-07-10T08:56:12Z"
}
],
"endpoints": {
"GET:::catfact.ninja/fact": {
"min_time": "2023-02-05T17:07:42",
"max_time": "2023-02-05T17:09:14",
"count": 1,
"status_codes": {
"200": 1
},
"average_duration": 555
}
}
}

note

The interceptor type and version are unknown because we are using curl to make the request. Once an interceptor is used, its type and version will appear in the discover command output.

CTRL + M