Helm公开普罗米修斯仪表板

问题描述 投票:0回答:1

我已将Prometheus using helm安装到Kubernets群集(CentOS 8 VM)中,并希望使用VM IP从群集外部访问仪表板

kubectl get svc -n monitoring
NAME                                      TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)                      AGE
alertmanager-operated                     ClusterIP   None             <none>        9093/TCP,9094/TCP,9094/UDP   27m
prometheus-grafana                        ClusterIP   10.98.154.200    <none>        80/TCP                       27m
prometheus-kube-state-metrics             ClusterIP   10.109.183.131   <none>        8080/TCP                     27m
prometheus-operated                       ClusterIP   None             <none>        9090/TCP                     27m
prometheus-prometheus-node-exporter       ClusterIP   10.101.171.235   <none>        30206/TCP                    27m
prometheus-prometheus-oper-alertmanager   ClusterIP   10.109.205.136   <none>        9093/TCP                     27m
prometheus-prometheus-oper-operator       ClusterIP   10.111.243.35    <none>        8080/TCP,443/TCP             27m
prometheus-prometheus-oper-prometheus     ClusterIP   10.106.76.22     <none>        9090/TCP                     27m

我需要公开在端口9090上运行的prometheus-prometheus-oper-prometheus服务,以便使用NodePort从外部在端口30000上进行访问

http://Kubernetes_VM_IP:30000

所以我创建了另一个服务:但是失败了services.yaml:

apiVersion: v1
kind: Service
metadata:
  name: prometheus-service
  namespace: monitoring
  annotations:
      prometheus.io/scrape: 'true'
      prometheus.io/port:   '9090'
spec:
  selector:
    app: prometheus-operator-prometheus
  type: NodePort
  ports:
    - port: 9090
      nodePort: 30000
      protocol: TCP


kubectl describe svc prometheus-prometheus-oper-prometheus -n monitoring
Name:              prometheus-prometheus-oper-prometheus
Namespace:         monitoring
Labels:            app=prometheus-operator-prometheus
                   chart=prometheus-operator-8.12.2
                   heritage=Helm
                   release=prometheus
                   self-monitor=true
Annotations:       <none>
Selector:          app=prometheus,prometheus=prometheus-prometheus-oper-prometheus
Type:              ClusterIP
IP:                10.106.76.22
Port:              web  9090/TCP
TargetPort:        9090/TCP
Endpoints:         10.32.0.7:9090
Session Affinity:  None
Events:            <none>
kubernetes-helm prometheus-alertmanager
1个回答
0
投票

在安装过程中重新创建的prometheus和指定的节点端口:

helm install prometheus stable/prometheus-operator --namespace monitoring --set prometheus.service.nodePort=30900 --set prometheus.service.type=NodePort
© www.soinside.com 2019 - 2024. All rights reserved.