我是新来的,因此可能是无意义的问题,但我想了解最好的方法。我在k8s中有如下这些名称空间。因此,目前运行在hub-dev中的微服务可以访问数据库命名空间禁用istio的PostgreSQL。
- 怎么可能在
STRICT
模式下,或者我做错了什么或分析错误的方式?所以这意味着网格中的pod可以与另一个未网格的pod通信,但另一个pod不能与任何其他网格中的pod通信?
正如你在这里看到的,似乎我的应用程序可以与数据库
对话[2021-01-15T15:21:38.601Z] "GET /userinfo?t=1610724097377 HTTP/1.1" 200 - "-" 0 236 5 3 "95.0.145.40,10.6.0.24" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.141 Safari/537.36" "34130335-b0dd-4cca-b157-f612e3767c9c" "oneapihub-auth-dev" "127.0.0.1:50002" inbound|80|| 127.0.0.1:51230 10.6.19.251:50002 10.6.0.24:0 outbound_.80_._.oneapihub-auth-dev.hub-dev.svc.cluster.local default
[2021-01-15T15:21:38.608Z] "- - -" 0 - "-" 374 778 10012 - "-" "-" "-" "-" "10.6.5.95:64000" outbound|64000||my-postgres-postgresql-helm.database.svc.cluster.local 10.6.19.251:50024 10.254.134.161:64000 10.6.19.251:47396 - -
我有一些运行analytics
命名空间的单体服务,其中这些服务需要连接logging
和monitoring
,同样在hub-dev中运行的微服务。因此,如果我为logging
和monitoring
启用Istio,那么在分析命名空间中运行的服务无法访问在logging
和monitoring
中运行的服务,对吗?那么你应该创建另一个ELK或prometheus实例吗?
那么管理这个流程的最佳方法是什么呢?
$ kubectl get ns --show-labels
NAME STATUS AGE LABELS
database Active 319d name=database
analytics Actice. 20d. name=analytics
hub-dev Active 46h istio-injection=enabled
istio-system Active 2d8h istio-injection=disabled
logging Active 133d purpose=logging
monitoring Active 291d name=monitoring,namespace=monitoring
这里是peerauthentication
$ kubectl get peerauthentication -n istio-system -o yaml
apiVersion: v1
items:
- apiVersion: security.istio.io/v1beta1
kind: PeerAuthentication
metadata:
annotations:
kubectl.kubernetes.io/last-applied-configuration: |
{"apiVersion":"security.istio.io/v1beta1","kind":"PeerAuthentication","metadata":{"annotations":{},"name":"default","namespace":"istio-system"},"spec":{"mtls":{"mode":"STRICT"}}}
name: default
namespace: istio-system
spec:
mtls:
mode: STRICT
你是正确的:
- 当启用严格模式时,网格外的服务不能与网格内的服务通信,但反过来也是可能的。
- 如果
logging
和monitoring
进入mesh,当STRICT
模式被启用时,analytics
确实无法与其通信。