Using Private Registry with OVHcloud Managed Kubernetes

Last updated 19th February, 2020.

In this tutorial we are going to guide you in using images from OVHcloud Managed Private Registry service on OVHcloud Managed Kubernetes clusters.

Before you begin

This tutorial presupposes that you already have a working OVHcloud Managed Kubernetes cluster, and some basic knowledge of how to operate it. If you want to know more on those topics, please look at the deploying a Hello World application documentation.

You also need to have a working OVHcloud Managed Private Registry and have followed the guides on creating a private registry, connecting to the UI, managing users and projects and creating and using private images.

We will specifically suppose you have followed the last one and you have a hello-ovh image on your private registry.

Deploying using a Secret based on existing Docker credentials

Login into your OVHcloud Managed Private Registry

In order to pull a private image from you private registry, you must authenticate with it using docker login.


In my private registry example:

  $ docker login
  Authenticating with existing credentials...

  Login Succeeded

The login process creates or updates a config.json file that holds an authorization token.

View the config.json file:

cat ~/.docker/config.json

Creating the Secret

Needing to do a docker login can get annoying quickly, so let's do it in another way: by storing the registry credentials on the Kubernetes cluster in Secret of docker-registry type. You will use this Secret to authenticate with your private registry to pull a private image.

If you already ran docker login, you can copy that credential into Kubernetes:

kubectl create secret generic regcred \
    --from-file=.dockerconfigjson=<path/to/.docker/config.json> \

In my private registry example:

  $ kubectl create secret generic regcred \
  >   --from-file=.dockerconfigjson=/home/horacio/.docker/config.json \
  secret/regcred created

To deploy an image we need a manifest

The first step to deploy a Docker image in a Kubernetes cluster is to write a YAML manifest. Let's call it hello-ovh.yaml:

apiVersion: v1
kind: Service
  name: hello-ovh
    app: hello-ovh
  type: LoadBalancer
  - port: 80
    targetPort: 80
    protocol: TCP
    name: http
    app: hello-ovh
apiVersion: apps/v1
kind: Deployment
  name: hello-ovh-deployment
    app: hello-ovh
  replicas: 1
      app: hello-ovh
        app: hello-ovh
      - name: hello-ovh
        image: [YOUR_PRIVATE_REGISTRY_URL]/private/hello-ovh:1.0.0
        - containerPort: 80
      - name: regcred

And then we can apply the file:

kubectl apply -f hello-ovh.yaml

After applying the YAML file, a new hello-world service and the corresponding hello-world-deployment deployment are created:

  $ kubectl apply -f hello-ovh.yaml
  service/hello-ovh created
  deployment.apps/hello-ovh-deployment created

Go further

To have an overview of OVHcloud Managed Private Registry service, you can go to the OVHcloud Managed Private Registry site.

Join our community of users on

Did you find this guide useful?

Please feel free to give any suggestions in order to improve this documentation.

Whether your feedback is about images, content, or structure, please share it, so that we can improve it together.

Your support requests will not be processed via this form. To do this, please use the "Create a ticket" form.

Thank you. Your feedback has been received.

These guides might also interest you...

OVHcloud Community

Access your community space. Ask questions, search for information, post content, and interact with other OVHcloud Community members.

Discuss with the OVHcloud community