【发布时间】:2021-05-12 23:35:40
【问题描述】:
我有 2 个部署如下:
- 定向数据库部署。
- Web 服务部署。
最初,为了访问 Orient DB,Web 服务获取存储在 Azure Key Vault 中的 Orient DB 用户名和密码。
为了提供额外的安全性,我创建了一个网络安全策略,它只允许具有 namespaceSelector "application: production" 和 podSelector "application: production" 的 pod。 应用的网络安全策略如下:
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
但是,应用网络安全策略后,Web 服务无法与 Orient DB 连接,因为 Web 服务无法从 Azure 密钥库 获取用户名和密码。 它给出了错误,
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 DB 服务?
如果有人知道,请帮助我。 谢谢。
【问题讨论】:
标签: azure kubernetes azure-aks