简体   繁体   中英

Need docker authorization token for k8s deployment but not in .docker/config.json

Struggling with this one. Can't find the docs. I need the authorization token to log into k8s and currently the contents of my .docker/config.json just has

{
   "auths": {
       "https://index.docker.io/v1/": {}
   },
   "HttpHeaders": {
       "User-Agent": "Docker-Client/18.09.5 (linux)"
   },
   "credsStore": "secretservice"
}

I don't know how to change things to get my authorization token which I need for the k8s login.

In order to pull docker images from your registry into kubernetes cluster, you need to:

  • Specify kubernetes secret . k8s support special type of secret that allows to pull images from registry and refer this secret in pod yaml.
kubectl create secret docker-registry <name> --docker-server=DOCKER_REGISTRY_SERVER --docker-username=DOCKER_USER --docker-password=DOCKER_PASSWORD --docker-email=DOCKER_EMAIL

For more info check this .

NOTE: If kubernetes is running on AWS and docker registry is AWS ECR then assign appropriate IAM role to k8s ec2 nodes, k8s will then automatically pull the images.

Hope this helps, let me know.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM