I am beginner with Kubernetes. I tried to deploy Prometheus from helm and now I need to setup Ingress in internal network.
I have problem with resolving Prometheus by hostname. If I use IP address I get it work but when I use syntax "host" it is 404 error. I don't know why is not resolved by hostname. I used kubespray for deploy Kubernetes.
Could you help me, please?
Ingress
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: prometheus-ingress
namespace: monitoring
annotations:
nginx.ingress.kubernetes.io/rewrite-target: /
spec:
ingressClassName: nginx
tls:
- hosts:
- prom.tipsport.it
secretName: foo-tls
rules:
- host: prom.cluster.local
- http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: prometheus-kube-prometheus-prometheus
port:
number: 9090
Describe pod
Name: prometheus-ingress
Namespace: monitoring
Address: 10.10.10.3,10.10.10.4,10.10.10.5
Default backend: default-http-backend:80 (<error: endpoints "default-http-backend" not found>)
TLS:
foo-tls terminates prom.tipsport.it
Rules:
Host Path Backends
---- ---- --------
*
/ prometheus-kube-prometheus-prometheus:9090 (10.233.66.116:9090)
Annotations: nginx.ingress.kubernetes.io/enable-cors: true
nginx.ingress.kubernetes.io/rewrite-target: /
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal Sync 7m36s (x8 over 61m) nginx-ingress-controller Scheduled for sync
Normal Sync 7m35s (x8 over 61m) nginx-ingress-controller Scheduled for sync
Normal Sync 7m34s (x8 over 61m) nginx-ingress-controller Scheduled for sync
What you want is this:
rules:
- host: prom.tipsport.it
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: prometheus-kube-prometheus-prometheus
port:
number: 9090
The host:
field tells it which Host header to route where so it should be the public hostname. Also it should be in the same section as the http:
field which gives further routing instructions. also you don't need the rewrite target annotation since no rewriting is needed.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments