Skip to content

how to get JWT token for kubernetes auth method? #211

Closed Answered by rajanadar
the-vishal-mehra asked this question in Q&A
Discussion options

You must be logged in to vote

@vishalmehra2214 The Kubernetes Service Account JWT token (for your pod) is outside the purview of VaultSharp.
Still, here are a couple of pointers.

Using CLI: Typically, you can get it as follows in 2 steps:

  1. Get the secret name for your service account
    kubectl get serviceaccounts <account-name> -o yaml

  2. For the secret name, get the actual JWT token
    kubectl get secret <secret-name-from-above-output> -o yaml

And if you want it via C#, assuming your code runs in the pod, use a Kubernetes C# client like https://github.com/kubernetes-client/csharp to load the config file and get hold of the JWT token for your service account.

As I said, it is outside the purview of VaultSharp itself.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@the-vishal-mehra
Comment options

Answer selected by rajanadar
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants