使用 istioctl 在 IstioControlPlane 中更改 grafana.ini

Change grafana.ini in IstioControlPlane using istioctl

我是 运行 Azure Kubernetes 集群 (AKS) 中的 grafana(kiali、prometheus 和跟踪)。 AKS 集群位于应用程序网关入口控制器 (AGIC) 后面,grafana pod 在子路径中 运行,例如 https://{domain}/grafana/。我能够通过 AGIC 位的入口访问 grafana 服务,grafana pod 一直在 https://{domain}/ 而不是 https://{domain}/grafana/ 中搜索资源。 所以,我想更改 grafana.ini 中的属性 root_url 以解决问题。我怎样才能做到这一点?

我正在使用以下命令在 AKS 中安装 istio 1.6:

istioctl manifest apply -f istio.aks.yaml

我的 IstioControlPlane 如下所示:

apiVersion: install.istio.io/v1alpha2
kind: IstioControlPlane
spec:
  # Use the default profile as the base
  # More details at: https://istio.io/docs/setup/additional-setup/config-profiles/
  profile: default
  components:
    pilot:
      k8s:
        resources:
          requests:
            cpu: 10m # override from default 500m
            memory: 40Mi # ... default 2048Mi
  values:
    global:
      # Ensure that the Istio pods are only scheduled to run on Linux nodes
      defaultNodeSelector:
        beta.kubernetes.io/os: linux
      # Enable mutual TLS for the control plane
      controlPlaneSecurityEnabled: true
      mtls:
        # Require all service to service communication to have mtls
        enabled: false
    grafana:
      # Enable Grafana deployment for analytics and monitoring dashboards
      enabled: true
      security:
        # Enable authentication for Grafana
        enabled: false
    kiali:
      # Enable the Kiali deployment for a service mesh observability dashboard
      enabled: true
      resources:
        requests:
          cpu: 2m # override from default 500m
    tracing:
      # Enable the Jaeger deployment for tracing
      enabled: true
      jaeger:
        resources:
          requests:
            cpu: 2m # override from default 500m
    gateways:
      istio-ingressgateway:
        enabled: false
    prometheus:
      enabled: true
      resources:
        requests:
          cpu: 2m # override from default 500m

grafana网页在https://{domain}.com/grafana/ returns下图中的错误:

enter image description here

由于您正在使用 ItsioControlPlane CRD 部署 Grafana,因此您应该能够通过更新以下 ENV 变量来更新清单。

    grafana:
      env:
        GF_SERVER_ROOT_URL: '%(protocol)s://%(domain)s:/grafana'

这将允许您更改其 ROOT URL 并使其在 Azure AppGW 后面正确服务

这是可用的,因为所有 itsio HelmChart 配置都映射在 CRD 中

https://istio.io/latest/blog/2019/introducing-istio-operator/#migration-from-helm

You can also set Helm configuration values in an IstioControlPlane custom resource. See Customize Istio settings using Helm for details.