如何解决从istio Service Mesh上的工作程序节点中的服务连接到Kubernetes API Server
我有一个安装了Istio的AKS集群。我正在使用Kubernetes Client for C#在集群上执行一些操作(读取和创建机密)。 我为此配置了适当的群集角色和绑定:
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: secret-creator
rules:
- apiGroups: [""]
resources: ["secrets"]
verbs: ["create","get","list","delete","update"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: role-binding
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: secret-creator
subjects:
- kind: ServiceAccount
name: default
namespace: default
当前,该服务位于默认名称空间中,并在默认服务帐户下运行。我为整个集群设置了PeerAuthentication和DestinationRules,如下所示:
apiVersion: security.istio.io/v1beta1
kind: PeerAuthentication
metadata:
name: default
namespace: default
spec:
mtls: {}
apiVersion: networking.istio.io/v1alpha3
kind: DestinationRule
metadata:
name: Mdestinationrule
namespace: default
spec:
host: "*"
trafficPolicy:
tls:
mode: ISTIO_MUTUAL
使用这些配置后,我的服务无法与API服务器通信以使用KubeClient的client.ReadNamespacedSecret(name,secretNamespace)。当我禁用destinationRule时,一切开始起作用。
由于某些限制,我无法修改现有的destiationRules,也无法在单独的命名空间中部署服务。我需要帮助,以了解在与API服务器通信时是否可以放入某种过滤器或类似过滤器,以使通信不是mTls?
请咨询。
解决方法
这对我有用:
apiVersion: networking.istio.io/v1alpha3
kind: DestinationRule
metadata:
name: Mdestinationrule
namespace: default
spec:
host: "*.kubernetes.default.svc" #Disabling it for Kube API Server communication
trafficPolicy:
tls:
mode: DISABLE
host: "*.default.svc"
trafficPolicy:
tls:
mode: ISTIO_MUTUAL
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。