@Sandeep Yarashi , Thank you for your question.
This sounds like a perfect use case of an ingress controller (in your case it would be best to use an Application Gateway ingress Controller) for path based routing of prometheus and grafana services running on the AKS cluster.
The ingress controller must be deployed before installing grafana and prometheus.
For Grafana Helm values must have:
grafana:
ingress:
enabled: true
annotations:
kubernetes.io/ingress.class: "nginx"
nginx.ingress.kubernetes.io/rewrite-target: /
nginx.ingress.kubernetes.io/backend-protocol: "HTTP"
paths:
- /grafana
For prometheus Helm values must have:
prometheus:
enabled: true
service:
nodePort: 9090
type: NodePort
ingress:
enabled: true
annotations:
kubernetes.io/ingress.class: nginx
nginx.ingress.kubernetes.io/rewrite-target: /
nginx.ingress.kubernetes.io/backend-protocol: "HTTP"
paths:
- /prometheus
Note:
I can curl -L http:localhost.com:9090 (prometheus port -9090) in aks but can't access localhost:9090 in browser as my laptop and aks is in different network.
The kubectl proxy:
- runs on a user's desktop or in a pod
- proxies from a localhost address to the Kubernetes apiserver
- client to proxy uses HTTP
- proxy to apiserver uses HTTPS
- locates apiserver
- adds authentication headers
Without a public IP address this can be used to access services running on the cluster from your workstation machine which is in a different network.
Hope this helps.
Please "Accept as Answer" if it helped, so that it can help others in the community looking for help on similar topics.