Search code examples
kuberneteskubernetes-secrets

why is kubernetes using its own base64 format?


When I use base64 inside Ubuntu to encode admin, I get: YWRtaW4K. But when I see secret in kubernetes I get YWRtaW4=.

enter image description here


Solution

  • You need to remove the trailing newline character from the input; you can use the -n switch to trim the trailing new line from the echo command and get the same behavior as seen with the Kubernetes secrets.

    echo -n  "admin" |base64
    YWRtaW4=
    
    
    echo -n "YWRtaW4=" |base64 -d
    admin