How to save and provide an external JWT token in Kubernetes?

5/1/2020

Hi world !

My problem :

I have one kubernetes cluster with many pods that run the same symfony app. On this app, I make a request on HERE's api for geocoding. HERE sends me a JWT token available for 24h. I would like to save this token in kubernetes, in this way, all pods/app have the same token.

My question is :

Is there a good practice, approved solution, to get a jwt token on external API and save it in kubernetes for provide it to my pods ?

-- cisco_bro
jwt
kubernetes
kubernetes-pod
token

1 Answer

5/1/2020

You can use a kubernetes secret for storing the token. Mount the secret in the pod for using it to call external API.

Here is the guide on distributing credentials securely using secrets.

As a side note kubernetes itself uses secret to store service account credential which is a JWT token. So this approach is approved and mainstream.

-- Arghya Sadhu
Source: StackOverflow