gpt4 book ai didi

kubernetes - Azure Kubernetes - prometheus 作为 ISTIO 的一部分部署,但未显示部署?

转载 作者:行者123 更新时间:2023-12-03 16:20:08 25 4
gpt4 key购买 nike

我使用以下配置来设置 Istio

cat << EOF | kubectl apply -f -
apiVersion: install.istio.io/v1alpha1
kind: IstioOperator
metadata:
namespace: istio-system
name: istio-control-plane
spec:
# Use the default profile as the base
# More details at: https://istio.io/docs/setup/additional-setup/config-profiles/
profile: default
# Enable the addons that we will want to use
addonComponents:
grafana:
enabled: true
prometheus:
enabled: true
tracing:
enabled: true
kiali:
enabled: true
values:
global:
# Ensure that the Istio pods are only scheduled to run on Linux nodes
defaultNodeSelector:
beta.kubernetes.io/os: linux
kiali:
dashboard:
auth:
strategy: anonymous
components:
egressGateways:
- name: istio-egressgateway
enabled: true
EOF
并公开了如下所述的普罗米修斯服务
kubectl expose service prometheus --type=LoadBalancer --name=prometheus-svc --namespace istio-system
kubectl get svc prometheus-svc -n istio-system -o json
export PROMETHEUS_URL=$(kubectl get svc prometheus-svc -n istio-system -o jsonpath="{.status.loadBalancer.ingress[0]['hostname','ip']}"):$(kubectl get svc prometheus-svc -n istio-system -o 'jsonpath={.spec.ports[0].port}')
echo http://${PROMETHEUS_URL}
curl http://${PROMETHEUS_URL}
我已经部署了一个应用程序,但是在 prometheus 中看不到以下部署
enter image description here

最佳答案

istio 的标准 prometheus 安装不会将您的 pod 配置为向 prometheus 发送指标。它只是从 istio 资源中收集数据。
要将您的 pod 添加到被抓取中,请在您的应用程序的 deployment.yml 中添加以下注释:

apiVersion: apps/v1
kind: Deployment
[...]
spec:
template:
metadata:
annotations:
prometheus.io/scrape: true # determines if a pod should be scraped. Set to true to enable scraping.
prometheus.io/path: /metrics # determines the path to scrape metrics at. Defaults to /metrics.
prometheus.io/port: 80 # determines the port to scrape metrics at. Defaults to 80.
[...]
顺便说一句:使用 istioctl 安装的 prometheus 实例不应用于生产。从文档:

[...] pass --set values.prometheus.enabled=true during installation. This built-in deployment of Prometheus is intended for new users to help them quickly getting started. However, it does not offer advanced customization, like persistence or authentication and as such should not be considered production ready.


您应该设置自己的 prometheus 并配置 istio 以向它报告。看:
引用: https://istio.io/latest/docs/ops/integrations/prometheus/#option-1-metrics-merging
以下 istio 提供的 yaml 可以作为 prometheus 设置的引用:
https://raw.githubusercontent.com/istio/istio/release-1.7/samples/addons/prometheus.yaml
此外,如果我没记错的话,安装 kiali、prometheus 等附加组件将在 istio 1.8(发布日期 2020 年 12 月)中删除。所以你可能想用 helm 设置你自己的实例。

关于kubernetes - Azure Kubernetes - prometheus 作为 ISTIO 的一部分部署,但未显示部署?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64484444/

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