{question}
How to enable HTTP API in a Kubernetes Cluster?
{question}
{answer}
In this article, we will discuss how to enable HTTP API on a Kubernetes operator-based cluster and how to test it.
To enable this, a couple of variables needed to be updated. The variable settings are required to be updated in the memsql-cluster.yaml
You will add the http_proxy_port and http_api settings.
The globalVariables
the section must be declared under the aggregatorSpec
.
...
aggregatorSpec:
globalVariables:
http_proxy_port: "8080"
http_api: "on"
...
After updating the settings, apply the configuration with the below command:
kubectl apply -f memsql-custer.yaml
After HTTP API is enabled, you can call the GET /ping
API request to verify that the HTTP service is running and connectable. To perform this action using cURL, invoke a GET request to the /ping
endpoint with no parameters, as shown below.
curl https://localhost:8080/ping
If the HTTP API service is available and can respond to requests, you will receive the following response along with a 200 OK status code, indicating a successful HTTP response.
{answer}