我有2部署如下:
最初,为了访问Orient,Web服务获取存储在Azure密钥库中的Orient用户名和密码。
为了提供额外的安全性,我创建了一个网络安全策略,它只允许namespaceSelector“应用程序: production"和podSelector”应用程序: production"。应用的网络安全策略如下:
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: nmsp
namespace: production
spec:
podSelector:
matchLabels:
application: production
ingress:
- from:
- namespaceSelector:
matchLabels:
application: production
podSelector:
matchLabels:
application: production
egress:
- to:
- namespaceSelector:
matchLabels:
application: production
podSelector:
matchLabels:
application: production但是,在应用网络安全策略之后,由于服务无法从Azure密钥库中获取用户名和密码,所以Web服务无法与Orient连接。它会产生错误,
Unhandled Rejection at: FetchError: request to https://in-keyvault-kv.vault.azure.net/secrets?api-version=7.1 failed, reason: getaddrinfo EAI_AGAIN in-aks-keyvault-kv.vault.azure.net
at ClientRequest. (/usr/src/app/node_modules/node-fetch/lib/index.js:1461:11)
at ClientRequest.emit (events.js:314:20)
at TLSSocket.socketErrorListener (_http_client.js:428:9)
at TLSSocket.emit (events.js:314:20)
at emitErrorNT (internal/streams/destroy.js:92:8)
at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)
at processTicksAndRejections (internal/process/task_queues.js:84:21) {
type: 'system',
errno: 'EAI_AGAIN',
code: 'EAI_AGAIN'
}那么,如何使用网络安全策略启用的用户名和密码访问这个密钥库呢?并连接到orient服务?
如果有人知道,请帮帮我。谢谢。
发布于 2021-05-12 15:35:40
您可以添加一个允许端口443 (以及密钥库服务的IP范围,如果您想限制流量)的出口规则,或者使用类似用于秘密商店CSI驱动程序的Azure密钥库提供商的东西获取存储在Azure Key Vault实例中的秘密内容,并使用secret驱动程序接口将它们安装到Kubernetes吊舱中。
https://stackoverflow.com/questions/67485360
复制相似问题