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
并如下所述公开了 prometheus 服务
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 安装不会配置您的 pods 以将指标发送到 prometheus。它只是从 istio 资源中收集数据。
要将您的 pods 添加到被抓取中,请在您的应用程序的 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
此外,如果我没记错的话,将在 istio 1.8(发布日期为 2020 年 12 月)中删除使用 istioctl 安装 kiali、prometheus 等插件。所以你可能想用 helm 设置你自己的实例。
我使用以下配置来设置 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
并如下所述公开了 prometheus 服务
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 安装不会配置您的 pods 以将指标发送到 prometheus。它只是从 istio 资源中收集数据。
要将您的 pods 添加到被抓取中,请在您的应用程序的 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
此外,如果我没记错的话,将在 istio 1.8(发布日期为 2020 年 12 月)中删除使用 istioctl 安装 kiali、prometheus 等插件。所以你可能想用 helm 设置你自己的实例。