Extracting and Decoding ServiceAccount Token from Kubernetes Secret
by Omkar Shelke
Scenario
You need to work in the mars namespace and identify the Secret that is linked to the ServiceAccount named mars-sa-v2.
After locating this Secret, extract the token value stored inside it and decode the Base64-encoded token.
Once decoded, save the resulting token content into the file /opt/token.
Finally, confirm that the /opt/token file is not empty and that its contents represent a valid JWT structure.
Perform the task on the dev-machine using the root user.