How to pull image from dockerhub in kubernetes?

后端 未结 2 2030
礼貌的吻别
礼貌的吻别 2021-02-02 11:31

I am planning to deploy an application in my kubernetes-clustering infra. I pushed image to dockerhub repo. How can I pull image from dockerhub?

2条回答
  •  忘了有多久
    2021-02-02 12:17

    One line command to create a Docker registry secret

    kubectl create secret docker-registry regcred --docker-username= --docker-password= --docker-email= -n 
    

    Then you can use it in your deployment file under spec

    spec:
      containers:
      - name: private-reg-container-name
        image: 
      imagePullSecrets:
      - name: regcred
    

    More details: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/#create-a-secret-in-the-cluster-that-holds-your-authorization-token

提交回复
热议问题