When an Elasticsearch cluster is created, a default user password is generated and stored in a Kubernetes secret. You will need the full credentials to request the Elasticsearch endpoint.
Let's perform the following steps to request Elasticsearch access:
- Get the password that was generated for the default elastic user:
$ PASSWORD=$(kubectl get secret elasticsearch-es-elastic-user
-n logging -o=jsonpath='{.data.elastic}' | base64 --decode)
- Request the Elasticsearch endpoint address:
$ curl -u "elastic:$PASSWORD" -k "https://elasticsearch-es-http:9200"
{
"name" : "elasticsearch-es-default-2",
"cluster_name" : "elasticsearch",
"cluster_uuid" : "E_ATzAz8Th6oMvd4D_QocA",
"version" : {...},
"tagline" : "You Know, for Search"
}
If you are accessing the Kubernetes cluster remotely, you can create a port-forwarding service and use localhost, similar to what can be seen in the following code:
$ kubectl port-forward service/quickstart-es-http 9200
$ curl -u "elastic:$PASSWORD" -k "https://localhost:9200"
Now, we have access to our three-node small Elasticsearch cluster that we deployed on Kubernetes. Next, we need to deploy Kibana to complete the stack.