现在的水平,仅止于让它跑起来。:)
同样的环境,microk8s+istio。
步骤如下:
一,使用kubectl get pod -n istio-system查看所有istio的POD运行正常。
NAME READY STATUS RESTARTS AGE grafana-5b5bb96d6d-xsmwb 1/1 Running 0 7d6h istio-citadel-69694bd465-wj5pp 1/1 Running 0 7d6h istio-cleanup-secrets-7m87h 0/1 Completed 0 7d6h istio-egressgateway-6d5cfb474-ffxv6 1/1 Running 0 7d6h istio-galley-6d6b7f9cdd-tbdbb 1/1 Running 0 7d6h istio-grafana-post-install-76crh 0/1 Completed 0 7d6h istio-ingressgateway-859977c87-srsrg 1/1 Running 0 7d6h istio-pilot-5ffcbc484f-wxdgx 2/2 Running 0 7d6h istio-policy-76479db9b8-vgsfv 2/2 Running 0 7d6h istio-security-post-install-kxrhr 0/1 Completed 0 7d6h istio-sidecar-injector-56cdcffcd8-frrmb 1/1 Running 0 7d6h istio-telemetry-75bd8c5898-7cs9f 2/2 Running 0 7d6h istio-tracing-c8b67b59c-bvls6 1/1 Running 0 7d6h prometheus-578b7dcfdc-2g7c9 1/1 Running 0 7d6h servicegraph-84f87799b5-hs256 1/1 Running 0 7d6h
二,使用kubectl get svc -n istio-system了解istio主要的服务端口(注意jaeger-query:16686)
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE grafana ClusterIP 10.152.183.143000/TCP 7d6h istio-citadel ClusterIP 10.152.183.188 8060/TCP,9093/TCP 7d6h istio-egressgateway ClusterIP 10.152.183.228 80/TCP,443/TCP 7d6h istio-galley ClusterIP 10.152.183.200 443/TCP,9093/TCP 7d6h istio-ingressgateway LoadBalancer 10.152.183.167 80:31380/TCP,443:31390/TCP,31400:31400/TCP,15011:31285/TCP,8060:30382/TCP,853:31889/TCP,15030:32354/TCP,15031:31495/TCP 7d6h istio-pilot ClusterIP 10.152.183.29 15010/TCP,15011/TCP,8080/TCP,9093/TCP 7d6h istio-policy ClusterIP 10.152.183.148 9091/TCP,15004/TCP,9093/TCP 7d6h istio-sidecar-injector ClusterIP 10.152.183.189 443/TCP 7d6h istio-telemetry ClusterIP 10.152.183.138 9091/TCP,15004/TCP,9093/TCP,42422/TCP 7d6h jaeger-agent ClusterIP None 5775/UDP,6831/UDP,6832/UDP 7d6h jaeger-collector ClusterIP 10.152.183.187 14267/TCP,14268/TCP 7d6h jaeger-query ClusterIP 10.152.183.236 16686/TCP 7d6h prometheus ClusterIP 10.152.183.46 9090/TCP 7d6h servicegraph ClusterIP 10.152.183.62 8088/TCP 7d6h tracing ClusterIP 10.152.183.3 80/TCP 7d6h zipkin ClusterIP 10.152.183.88 9411/TCP 7d6h
这时,使用查询命令
kubectl get pod -n istio-system -l app=jaeger -o jsonpath='{.items[0].metadata.name}'
输出为:istio-tracing-c8b67b59c-bvls6
三,使用kubectl port-forward命令,将default名字空间下的16686端口的数据,转到istio-system名字空间里的16686端口。( 这个端口看上面输出对应关系)
kubectl port-forward -n istio-system $(kubectl get pod -n istio-system -l app=jaeger -o jsonpath='{.items[0].metadata.name}') 16686:16686
如果命令不放入后台,输出如下:
Forwarding from 127.0.0.1:16686 -> 16686 Forwarding from [::1]:16686 -> 16686 Handling connection for 16686 Handling connection for 16686 Handling connection for 16686 Handling connection for 16686
上面的输出,表示port-proxy forward命令,只能支持到127.0.0.1的本地局域网。
四,用SSH进行二次转发。
ssh -N -f -L 0.0.0.0:16687:127.0.0.1:16686 root@0.0.0.0
此处需要输入root密码,如果可以,更换为普通用户。
五,浏览器输入http://ip:16687即可访问到jaeger UI了。