I have setup hashicorp vault server in kubernetes. Vault server works fine when accessed through CLI or UI. I created another pod which runs my application. But I cannot access Vault Server from my application which is running on different pod.
I have tried using Cluster-IP:Port, IP:Port but always see error Connection Refused.
service.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.