簡體   English   中英

Azure Kubernetes - prometheus 作為 ISTIO 的一部分部署,但未顯示部署?

[英]Azure Kubernetes - prometheus is deployed as a part of ISTIO not showing the deployments?

我使用以下配置來設置 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 中看不到以下部署

在此處輸入圖片說明

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 實例不應用於生產。 從文檔:

[...] 在安裝過程中通過 --set values.prometheus.enabled=true。 Prometheus 的這種內置部署旨在幫助新用戶快速入門。 但是,它不提供高級定制,如持久性或身份驗證,因此不應被視為生產就緒。

您應該設置自己的 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 設置你自己的實例。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM