我在 kubernetes 中设置了 hashcorp 保险库服务器。通过 CLI 或 UI 访问时,Vault 服务器工作正常。我创建了另一个运行我的应用程序的 pod。但是我无法从运行在不同 pod 上的应用程序访问 Vault Server。
我尝试使用 Cluster-IP:Port, IP:Port 但总是看到错误连接被拒绝。
服务.yaml
apiVersion: v1
kind: Service
metadata:
name: vault
labels:
run: vault
spec:
type: ClusterIP
ports:
- port: 8080
targetPort: 8200
protocol: TCP
name: vault
selector:
run: vault
deployment.yaml
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: vault
labels:
run: vault
spec:
replicas: 1
template:
metadata:
labels:
run: vault
spec:
containers:
- name: vault
command: ["vault", "server", "-config", "/vault/config/vault.hcl"]
image: "vault"
imagePullPolicy: IfNotPresent
securityContext:
capabilities:
add:
- IPC_LOCK
volumeMounts:
- name: configurations
mountPath: /vault/config/vault.hcl
subPath: vault.hcl
volumes:
- name: configurations
configMap:
name: vault
I need to access vault server from an application running in different pod within same cluster.