Kubernetes login api gives "missing client token" on kubernetes POD

Hi

I am configuring spring vault to my spring boot app to get the vault token directly to application context.
I am getting below error when the spring boot app starts on Kubernetes POD. I have enabled kubernetes auth on valut. I can read the jwt token file generated in “/run/secrets/kubernetes.io/serviceaccount/token” path inside the POD. Please help to resolve this issue

POST /v1/auth/kubernetes/login
Accept: application/json, application/*+json
Content-Type: application/json;charset\u003dUTF-8
Content-Length: 988
Host: <vault-host>:8200
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.5.6 (Java/1.8.0_222)
Accept-Encoding: gzip,deflate

{\"role\":\"<custom-readonly-role-name>\",\"jwt\":\"<TOKEN from /run/secrets/kubernetes.io/serviceaccount/token file >\"}
HTTP/1.1 400 Bad Request
Cache-Control: no-store
Content-Type: application/json
Date: Fri, 10 Jul 2020 18:55:13 GMT
Content-Length: 36
{\"errors\":[\"missing client token\"]}
1 Like