所以我们正在使用全局mtl部署istio 1.0.2,到目前为止它已经很好了 . 对于运行状况检查,我们已为服务添加了单独的端口,并根据文档对其进行了配置:
https://istio.io/docs/tasks/traffic-management/app-health-check/#mutual-tls-is-enabled
我们的应用程序端口现在位于8080,运行状况检查端口位于8081.执行此操作后,Kubernetes可以进行运行状况检查,并且服务似乎正常运行 .
但是,我们的监控解决方案无法访问运行状况检查端口
监控应用程序也位于kubernetes中,目前位于网格之外 . 上述文件说明如下:
因为Istio代理仅拦截在containerPort字段中显式声明的端口,所以无论是否启用了Istio相互TLS,到8002端口的流量都会绕过Istio代理 .
这就是我们配置它的方式 . 所以在我们的例子中,8081应该在网格之外:
livenessProbe:
failureThreshold: 3
httpGet:
path: /manage/health
port: 8081
scheme: HTTP
initialDelaySeconds: 180
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 1
name: <our-service>
ports:
- containerPort: 8080
name: http
protocol: TCP
readinessProbe:
failureThreshold: 3
httpGet:
path: /manage/health
port: 8081
scheme: HTTP
initialDelaySeconds: 10
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 1
但是,我们无法从网格外部的另一个窗格访问8081 .
例如:
curl http://<our-service>:8081/manage/health
curl: (7) Failed connect to <our-service>:8081; Connection timed out
如果我们从网格中的另一个pod尝试,则会返回404,这可能是预期的 .
我试着玩这样的目的地规则:
apiVersion: networking.istio.io/v1alpha3
kind: DestinationRule
metadata:
name: <our-service>-health
spec:
host: <our-service>.namepspace.svc.cluster.local
trafficPolicy:
portLevelSettings:
- port:
number: 8081
tls:
mode: DISABLE
但这只会在内部和通过入口网关杀死所有与服务的连接 .
1 回答
根据官方Istio Documentation端口8081将无法通过Istio Envoy,因此无法访问服务网格之外的其他Pod,因为Istio代理仅确定通过Pod服务传输的
containerPort
的值 .如果您在Pod之间构建没有TLS身份验证的Istio服务网格,则可以选择将相同的端口用于Pod服务和准备/活动探测的基本网络路由 .
假设Istio Mixer提供了三个Prometheus endpoints,您可以考虑使用Prometheus作为主要监视工具来收集和分析网格度量 .