Skip to main content

View service account password in k8s

To access the password for the DWP service account stored in a Kubernetes secret, follow the steps below. The password is stored in base64-encoded format and will need to be decoded to retrieve the actual value.


Accessing the Secret

Run the following command to fetch the secret and view its contents:

kubectl get secret -n dwp-system-akerbp242 autogenerated-dwp-svc-password-secret -o yaml

This command will output the details of the secret in YAML format. Below is an example of the output:

apiVersion: v1
data:
dwp-svc-password: uwp4WmMLJxk/IW5tbjLDWGFXbjk=
kind: Secret
metadata:
annotations:
kubectl.kubernetes.io/last-applied-configuration: |
{"apiVersion":"v1","data":{"dwp-svc-password":"uwp4WmMLJxk/IW5tbjLDWGFXbjk="},"kind":"Secret","metadata":{"annotations":{},"name":"autogenerated-dwp-svc-password-secret","namespace":"dwp-system-akerbp242"}}
creationTimestamp: "2024-07-16T04:20:32Z"

Decoding the Password

The password is stored in base64-encoded format under the dwp-svc-password field. To decode it, run the following command:

echo "uwp4WmMLJxk/IW5tbjLDWGFXbjk=" | base64 --decode

Replace the base64 string uwp4WmMLJxk/IW5tbjLDWGFXbjk= with the actual value you get from the kubectl output.


Notes

  • Ensure you have the necessary permissions to access the namespace and secret.
  • Always handle sensitive information like passwords securely. Avoid sharing decoded passwords in plain text or over insecure channels.
  • If you need to access other secrets, adjust the secret name accordingly in the kubectl command.
Connecting...