Vault authentication using Kubernetes is failing

7/4/2019

Created a Vault and Consul cluster on Kubernetes with TLS by following
https://testdriven.io/blog/running-vault-and-consul-on-kubernetes/ and was trying to configure Kubernetes auth method using https://learn.hashicorp.com/vault/identity-access-management/vault-agent-k8s everything went fine up to step 3 (Verify the Kubernetes auth method configuration), when I tested connection I am getting the error "Failed to connect to vault port 8200: Connection refused". Can any one help me with this.

$ kubectl run --generator=run-pod/v1 tmp --rm -i --tty --serviceaccount=vault-auth --image alpine:3.7

# VAULT_ADDR=https://vault:8200
/ # curl -s $VAULT_ADDR/v1/sys/health | jq
/ # curl  $VAULT_ADDR/v1/sys/health | jq
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--
 0curl: (7) Failed to connect to vault port 8200: Connection refused



$ k get svc
NAME         TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)                                                                            AGE
consul       ClusterIP   None             <none>        8500/TCP,8443/TCP,8400/TCP,8301/TCP,8301/UDP,8302/TCP,8302/UDP,8300/TCP,8600/TCP   177m
kubernetes   ClusterIP   10.245.0.1       <none>        443/TCP                                                                            26h
vault        ClusterIP   10.245.215.195   <none>        8200/TCP 
-- praveen
consul
hashicorp-vault
kubernetes

0 Answers