istio部署-istio prometheus

參考

1. 使用 Prometheus

1.1 訪問 Prometheus

1.1.1 端口轉發

  • Prometheus 服務默認啓用。
# option1:本地 localhost 端口轉發
kubectl -n istio-system port-forward \
$(kubectl -n istio-system get pod -l app=prometheus -o jsonpath='{.items[0].metadata.name}') \
9090:9090 &

# option2:kube-proxy 端口轉發
kubectl proxy --address='100.64.198.131' --port=9090 --accept-hosts='^*$'
URL:http://100.64.198.131:9090/api/v1/namespaces/istio-system/services/http:prometheus:9090/proxy

1.1.2 開放 Prometheus 服務

1.1.2.1 定製 prometheus values.yaml
  • 同 Grafana 一致,經過定製 values.yaml,能夠開放 Promethehs 的 Service 服務。
vim install/kubernetes/helm/istio/charts/prometheus/values.yaml

# "ingress" 資源的 "spec.rules.host.http.paths.path" 字段,即 "subpath"
contextPath: /

ingress:
  # 啓用 "ingress"
  enabled: enable
  ## Used to create an Ingress record.
  hosts:
    # 修改 "domain"
    - prometheus.istio
  annotations:
    # kubernetes.io/ingress.class: nginx
    # kubernetes.io/tls-acme: "true"
  tls:
    # Secrets must be manually created in the namespace.
    # - secretName: prometheus-tls
    #   hosts:
    #     - prometheus.local

注意:定製 values.yaml 文件後,須要利用 helm template 從新生成部署清單。nginx

1.1.2.2 自定義 prometheus ingress
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  labels:
    app: prometheus
    chart: prometheus
    heritage: Tiller
    release: istio
  name: prometheus
  namespace: istio-system
spec:
  rules:
  - host: prometheus.istio
    http:
      paths:
      - backend:
          serviceName: prometheus
          servicePort: 9090
        path: /

1.2 Prometheus 配置文件

  • 配置文件保存在名爲 prometheusConfigMap 對象中,獲取以下:
kubectl get cm prometheus -n istio-system -o jsonpath='{.data.prometheus\.yml}'
相關文章
相關標籤/搜索