gpt4 book ai didi

docker - Kubernetes无法访问Google云端平台的grafana和Prometheus

转载 作者:行者123 更新时间:2023-12-02 20:48:24 30 4
gpt4 key购买 nike

我已经按照link的指示在Google云端kubernetes中安装了Grafana / Prometheus。我希望它已成功部署,请找到以下响应以供引用,

服务已成功创建:

kubectl --namespace=monitoring get services
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
grafana NodePort 10.27.249.8 <none> 3000:32703/TCP 1h
prometheus NodePort 10.27.249.233 <none> 9090:31939/TCP 1h

命名空间创建成功:
kubectl get namespaces
NAME STATUS AGE
default Active 19h
kube-public Active 19h
kube-system Active 19h
monitoring Active 1h

PODS响应:
kubectl --namespace=monitoring get pods
NAME READY STATUS RESTARTS AGE
grafana-1323121529-8614m 1/1 Running 0 1h
node-exporter-lw8cr 0/1 CrashLoopBackOff 17 1h
node-exporter-nv85s 0/1 CrashLoopBackOff 17 1h
node-exporter-r2rfl 0/1 CrashLoopBackOff 17 1h
prometheus-3259208887-x2zjc 1/1 Running 0 1h

现在,我正在尝试为Grafana公开外部IP,但是我无法继续获取以下异常信息:“服务器错误(AlreadyExists):服务“prometheus”已存在”
kubectl --namespace=monitoring expose deployment/prometheus --type=LoadBalancer

Error from server (AlreadyExists): services "prometheus" already exists

编辑

kubectl -n monitoring edit service prometheus

Edit cancelled, no changes made.

最佳答案

由于您已经在监视 namespace 中部署了Prometheus服务 list 文件。但是,您正在尝试在相同的 namespace 中部署具有相同名称的服务,这是 Not Acceptable ,因为两个服务不能在具有相同名称的相同 namespace 中共存。

解决问题的方法

我将使用以下命令来编辑已部署的服务。

kubectl -n monitoring edit service prometheus 

然后您喜欢的文本编辑器会弹出,您只需要更新
类型:LoadBalancer

基本上,您的服务将被编辑。

编辑

如果您无法使用上述命令,请执行以下步骤:
您需要编辑Prometheus服务 list 文件,并使用 类型更新它:LoadBalancer

现在您需要 申请 kubectl apply -f prometheus-service.yaml

关于docker - Kubernetes无法访问Google云端平台的grafana和Prometheus,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47354049/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com