Azure Kubernetes-Jaeger UI是否未显示作为ISTIO的一部分部署的服务?

问题描述

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

并公开了如下所述的jaeger-query服务

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

我在Jaeger中看不到下面部署的应用程序

enter image description here

并已按如下所述部署了应用程序

cat << EOF | kubectl apply -f -
apiVersion: apps/v1 # for versions before 1.9.0 use apps/v1beta2
kind: Deployment
Metadata:
  name: Nginx-deployment
  namespace: akv2k8s-test
spec:
  selector:
    matchLabels:
      app: Nginx
  replicas: 1
  template:
    Metadata:
      labels:
        app: Nginx
    spec:
      containers:
      - name: Nginx
        image: stenote/Nginx-hostname
        ports:
        - containerPort: 80
---
apiVersion: v1
kind: Service
Metadata:
  name: web
  namespace: akv2k8s-test
spec:
  selector:
    app: Nginx
  ports:
  - protocol: TCP
    port: 80
EOF

cat <<EOF | kubectl apply -f -
apiVersion: networking.istio.io/v1alpha3
kind: Gateway
Metadata:
  name: public-gateway
  namespace: akv2k8s-test
spec:
  selector:
    istio: ingressgateway # use istio default ingress gateway
  servers:
  - port:
      number: 443
      name: https
      protocol: HTTPS
    tls:
      mode: SIMPLE
      credentialName: "${KEY_CERT2_NAME}"
    hosts:
    - web.zaalion.com
EOF


cat <<EOF | kubectl apply -f -
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
Metadata:
  name: helloworld
  namespace: akv2k8s-test
spec:
  hosts:
    - web.zaalion.com
  gateways:
    - public-gateway
  http:
    - route:
      - destination:
          host: web.akv2k8s-test.svc.cluster.local
          port:
            number: 80
EOF

我可以如下所示访问服务

export EXTERNAL_IP=$(kubectl get svc istio-ingressgateway -n istio-system -o jsonpath='{.status.loadBalancer.ingress[0].ip}')

curl -v --resolve web.zaalion.com:443:$EXTERNAL_IP --cacert cert2.crt https://web.zaalion.com

我知道为什么Jaeger UI中未列出该服务吗?

解决方法

根据istio documentation

要查看跟踪数据,必须将请求发送到服务。请求数量取决于Istio的采样率。您在安装Istio时设置此速率。默认采样率为1%。在显示第一条跟踪之前,您至少需要发送100个请求。您能否尝试发送至少100个请求并检查其是否有效?

如果您不想更改默认采样率,则可以使用istio documentation

自定义跟踪采样

采样率选项可用于控制将多少百分比的请求报告给您的跟踪系统。应根据网格中的流量和要收集的跟踪数据量进行配置。默认比率是1%。

要将默认随机抽样修改为50,请将以下选项添加到您的tracing.yaml文件中。

http://localhost

采样率应在0.0到100.0的范围内,精度为0.01。例如,要跟踪每10000个请求中的5个请求,请在此处使用0.05作为值。