Kibana is a popular open-source data visualization and exploration platform that provides easy-to-use dashboards for real-time analytics. When using Kibana on a Kubernetes cluster, it's important to ensure that it's securely exposed to the internet.
In this article, we will show you how to expose Kibana through a subpath on a Kubernetes cluster via Ingress.
Prerequisites:
- A running Kubernetes cluster
- Kibana deployment
- Ingress controller installed
Step 1: Create an Ingress Resource
To expose Kibana through a subpath, we need to create an Ingress resource that specifies the rules for routing traffic to the Kibana service. The following is an example of an Ingress resource that routes traffic to Kibana at the subpath /kibana:
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: kibana
spec:
rules:
- http:
paths:
- path: /kibana
pathType: Prefix
backend:
service:
name: kibana
port:
name: http
Step 2: Deploy the Ingress Resource
Once the Ingress resource is defined, we need to deploy it to the cluster. Use the following command to deploy the Ingress resource:
$ kubectl apply -f ingress.yaml
Replace ingress.yaml with the filename of the Ingress resource definition file.
Step 3: Test the Ingress Resource
To test the Ingress resource, we need to know the external IP address of the ingress controller. Use the following command to get the IP address:
$ kubectl get ingress
The output should include the external IP address of the ingress controller. Now, open a web browser and enter the following URL:
http://<external-ip>/kibana
This should take you to the Kibana login page.
Step 4: Configure Kibana to Use the Subpath
By default, Kibana is configured to run at the root path. To configure Kibana to use the subpath, add the following line to the kibana.yml configuration file:
server.basePath: "/kibana"
Restart the Kibana deployment for the configuration changes to take effect.
Step 5: Verify Kibana is Accessible
To verify that Kibana is accessible through the subpath, refresh the Kibana login page and ensure that the URL now includes /kibana.
Congratulations! You have successfully exposed Kibana through a subpath on a Kubernetes cluster via Ingress.
More Examples:
- If you want to expose Kibana on a different subpath, modify the path value in the Ingress resource.
- If you want to use SSL/TLS, add the necessary annotations to the Ingress resource.
- If you want to restrict access to Kibana, add authentication and authorization rules to the Ingress resource.
Related Searches and Questions asked:
That's it for this post. Keep practicing and have fun. Leave your comments if any.
0 Comments