Sunday, 20 September 2020

Working with Private Repository in Kubernetes.

 If the Docker repository is public you no need to do any extra configurations you can follow here. If the repository is private then we need to follow the below steps. 

Create the secret using the command line. 

 

kubectl create secret docker-registry regcred --docker-server=https://index.docker.io/v1/ --docker-username=syedghouse14--docker-password=<UR_PASSWORD> --docker-email=<UR_MAIL> 


Once if the following command executed then we will get the following output. 


secret/regcred created 


Specifying the Secret in the  Yaml File. 

 

apiVersion: v1 

kind: Pod 

metadata: 

  name: private-reg 

spec: 

  containers: 

  - name: private-reg-container 

    image: <your-private-image> 

  imagePullSecrets: 

  - name: regcred 


You can mention in the pods. 


Or you can create the deployment and copy the Yaml file and add this Secret and create it again. Or You can manually create it from the form. 


The Easiest way will be using the Form type. Then the K8s start pulling the image from the private repository. 

 

No comments:
Write comments