2

Trying to apply deployment.yaml but I got error illegal base64 data at input byte 8.

In my config.json

"auths": {
        "https://index.docker.io/v1/": {
            "auth": "16c...ad7"
        }
    }

I have put token from the docker hub

Register the secret

kubectl create secret generic regcred --from-file=.dockerconfigjson=C:\Users\Herman\.docker\config.json --type=kubernetes.io/dockerconfigjson

in my .yaml my imagePullSecrets: - name: regcred

anybody can help?

Herman
  • 2,832
  • 6
  • 25
  • 37
  • 1
    Is the content of `config.json` all surrounded by `{}` or is it as posted in the question `"auths":.....`? – gears Dec 10 '19 at 15:46
  • 2
    Does this answer your question? [Can't create Secret in Kubernetes: illegal base64 data at input](https://stackoverflow.com/questions/53394973/cant-create-secret-in-kubernetes-illegal-base64-data-at-input) – Ernesto U Dec 10 '19 at 20:15

1 Answers1

2

In my case, the the oauth2accesstoken part wasn't base64 encoded as well. So once I made sure that part was also base64 encoded, along with the token in the same string, it worked.

Example Setup for oAuth and GCR

ACCESS_TOKEN=$(gcloud auth print-access-token)
export BASE_64_GCR_AUTH_TOKEN=$(echo "oauth2accesstoken:${ACCESS_TOKEN}" | base64 -w 0)
Clement
  • 4,491
  • 4
  • 39
  • 69