Azure Kubernetes-Istio是否从外部访问grafana,prometheus,jaeger,kiali和使节?

问题描述

我已经使用以下配置来设置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

我想从外部访问grafana,prometheus,jaeger,kiali和使节等服务-例如:https://grafana.mycompany.com,我该怎么办?

更新: 我在下面尝试过,但是不起作用

kubectl expose service prometheus --type=LoadBalancer --name=prometheus --namespace istio-system
kubectl get svc prometheus-svc -n istio-system -o json
export PROMETHEUS_URL=$(kubectl get svc istio-ingressgateway -n istio-system  -o jsonpath="{.status.loadBalancer.ingress[0]['hostname','ip']}"):$(kubectl get svc prometheus-svc -n istio-system -o 'jsonpath={.spec.ports[0].nodePort}')
echo http://${PROMETHEUS_URL}
curl http://${PROMETHEUS_URL}

解决方法

我按如下所述工作了

kubectl expose service prometheus --type=LoadBalancer --name=prometheus --namespace istio-system
    
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}

我认为这可能不是公开服务的正确方法。代替

  1. 创建一个指向https://grafana.mycompany.com的Istio网关点
  2. 创建Istio虚拟服务以将请求重定向到上述内部服务