Kar*_*mar 5 kubernetes istio istio-kiali istio-prometheus
我使用以下配置来设置 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
Run Code Online (Sandbox Code Playgroud)
并公开了如下所述的普罗米修斯服务
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}
Run Code Online (Sandbox Code Playgroud)
我已经部署了一个应用程序,但是在 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.
[...]
Run Code Online (Sandbox Code Playgroud)
顺便说一句:使用 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 设置你自己的实例。
| 归档时间: |
|
| 查看次数: |
201 次 |
| 最近记录: |