Instructions for installing Private Docker Registry on Kubernetes

Tram Ho

You should have your own docker repository or registry in your Kubernetes cluster for security. In this article, I share the private repository settings on Kubernetes.

1.Prepare

2.Installation steps

Create archive directory first on all node

Login to node master using openssl command to generate self-signed certificate for the repository.

Enter a name for the lines like: region, company,.. and press enter

Check the newly created certificate

Copy these 2 files to the directory  /opt/cert worker node machine

On the master node create a private-registry.yaml with the following content

Save and exit yaml file

Run kubectl with the above yaml file

Check the status of the registry deployment with the pod created.

Copy the registration certificate file from the directory “/opt/cert” to the directory thư“/etc/pki/ca-trust /source/anchor”  on all nodes.

Deploy as nodeport service, we create more yaml file with the following content

Save and exit the file.

Run the command below to generate

Check the status of NodePort just created

Now we test by pulling an nginx image and uploading the image to the private registry, from the master node

Run the following command to check if nginx uploaded to the private repository.

Now we deploy a basic nginx on the private docker registry above.

Save and exit the file

Run the following command to initialize

View in more detail the newly created pod

The output is below:

So, I have guided you to build a private repository for your project with docker and kubernets. Thank you for watching, see you in the next post. Sincerely and to win

Share the news now