Reputation: 323
I installed the Prometheus and Grafana into EKS cluster. I changed the ClusterIP to LoadBalancer. The URLs are accessible world wide. http://a9042a504d25f4122b6aa52ed5e53b57-356305290.ap-south-1.elb.amazonaws.com:9090 http://a7ebeb0da858f42328904560e7ce83c5-996403152.ap-south-1.elb.amazonaws.com
I cannot access Prometheus and Grafana if I keep the service as ClusterIP.
Is it possible to limit accessibility to localhost only? As an example,
To access Kubernetes Dashboard from my local workstation I create a secure channel to my Kubernetes cluster. Run the following command:
kubectl proxy
Now access Dashboard at:
http://localhost:8001/api/v1/namespaces/kubernetes-dashboard/services/https:kubernetes-dashboard:/proxy/.
Are there any similar approaches for Prometheus and Grafana?
Upvotes: 1
Views: 1264
Reputation: 6765
Yes, if you'd like to access Prometheus and Grafana in the same way you can keep using a ClusterIP service.
Then, whenever you want to access the server you can do so by running the following commands.
For Prometheus -
kubectl port-forward service/<prometheus-service-name> 9090:9090
For Grafana -
kubectl port-forward service/<grafana-service-name> 8080:8080
This will forward the remote service to your local 9090/8080 ports, and will allow you to access them from localhost.
Upvotes: 4