我试图在谷歌库伯内特斯引擎AKAGKE上获得一个新的集群设置。我正在使用helm并添加到repo ingress-nginxhttps://kubernetes.github.io/ingress-nginx和grafanahttps://grafana.github.io/helm-charts
我遵循这个指南,但我无法访问内部IP或让入口工作到我可以看到仪表板的地方。然后,我尝试了这个指南,使用他们对Loki Stack(Loki、Promail、Grafana、Prometheus)的helm部署,并具有持续的音量声明。
这与打开端口8443相结合,我仍然收到503错误。我做了这个入口:
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: ingress-resource
annotations:
kubernetes.io/ingress.class: "nginx"
nginx.ingress.kubernetes.io/use-regex: "true"
spec:
rules:
- http:
paths:
- path: /pro
pathType: Prefix
backend:
service:
name: loki-prometheus-server
port:
number: 9090
- path: /graf
pathType: Prefix
backend:
service:
name: loki-grafana
port:
number: 3000
我尝试了许多不同的端口,包括80个,但没有成功。
loki-prometheus-server服务:
Name: loki-prometheus-server
Namespace: ingress-nginx
Labels: app=prometheus
app.kubernetes.io/managed-by=Helm
chart=prometheus-11.16.9
component=server
heritage=Helm
release=loki
Annotations: cloud.google.com/neg: {"ingress":true}
meta.helm.sh/release-name: loki
meta.helm.sh/release-namespace: ingress-nginx
Selector: app=prometheus,component=server,release=loki
Type: ClusterIP
IP Families: <none>
IP: 10.***
IPs: 10.***
Port: http 80/TCP
TargetPort: 9090/TCP
Endpoints: 10.***:9090
Session Affinity: None
Events: <none>
grafana服务:
Name: loki-grafana
Namespace: ingress-nginx
Labels: app.kubernetes.io/instance=loki
app.kubernetes.io/managed-by=Helm
app.kubernetes.io/name=grafana
app.kubernetes.io/version=7.5.0
helm.sh/chart=grafana-5.7.10
Annotations: cloud.google.com/neg: {"ingress":true}
meta.helm.sh/release-name: loki
meta.helm.sh/release-namespace: ingress-nginx
Selector: app.kubernetes.io/instance=loki,app.kubernetes.io/name=grafana
Type: ClusterIP
IP Families: <none>
IP: 10.***
IPs: 10.***
Port: service 80/TCP
TargetPort: 3000/TCP
Endpoints: 10.***:3000
Session Affinity: None
Events: <none>
一步一步:
在gcloud上创建新集群:
连接到控制台或云外壳
然后:
helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx
helm repo update
kubectl create namespace ingress-nginx
helm install ingress-nginx ingress-nginx/ingress-nginx --namespace ingress-nginx
到目前为止,一切似乎都很正常。
转到VPC网络-
安装loki:
helm upgrade --install loki grafana/loki-stack --namespace ingress-nginx --set grafana.enabled=true,prometheus.enabled=true,prometheus.alertmanager.persistentVolume.enabled=false,prometheus.server.persistentVolume.enabled=false,loki.persistence.enabled=true,loki.persistence.storageClassName=standard,loki.persistence.size=5Gi
一切似乎仍然进展顺利,但如果我去我的外部负载均衡器,我会得到404未找到/nginx
我添加了这个入口:
使用kubectl应用-f ingress. yml-n ingress-nginx
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: ingress-resource
annotations:
kubernetes.io/ingress.class: "nginx"
prometheus.io/scrape: "true"
spec:
rules:
- http:
paths:
- path: /pro
pathType: Prefix
backend:
service:
name: loki-prometheus-server
port:
number: 80
- path: /graf
pathType: Prefix
backend:
service:
name: loki-grafana
port:
number: 80
并获得404页面未找到在文本上 /pro并获得重定向到 /login与404未找到nginx页面在 /graf
我做错了什么?
运行:
helm upgrade ingress-nginx ingress-nginx/ingress-nginx --namespace ingress-nginx --set controller.metrics.enabled=true --set-string controller.podAnnotations."prometheus\.io/scrape"="true" --set-string controller.podAnnotations."prometheus\.io/port"="10254"
使用这个入口,我能够让它工作:
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: ingress-resource
annotations:
kubernetes.io/ingress.class: "nginx"
nginx.ingress.kubernetes.io/use-regex: "true"
nginx.ingress.kubernetes.io/ssl-redirect: "false"
nginx.ingress.kubernetes.io/rewrite-target: /$1
prometheus.io/port: "10254"
prometheus.io/scrape: "true"
spec:
rules:
- http:
paths:
- path: /?(.*)
pathType: Prefix
backend:
service:
name: loki-grafana
port:
number: 80