Skip to main content
Deploy a Docker image to Kubernetes
Last update:

Deploy a Docker image to Kubernetes

If you store Docker images in the Container Registry, you can deploy under to a [Managed Kubernetes] cluster(/cloud/managed-kubernetes/about/about-managed-kubernetes.mdx) or to a Kubernetes cluster that you administer yourself.

  1. Upload image to Container Registry.
  2. Configure Container Registry integration with cluster.
  3. Deploy application from image.

Upload the image to Container Registry

  1. Authorize in the registry.

  2. Enter username and password.

  3. Assign a tag to the image:

    docker tag <image><registry>/<image>:<tag>


    • <image> — image name, can be viewed with docker image list;
    • <registry> is the name of the registry where you want to load the image;
    • <tag> — Tag.
  4. Load the image into the registry:

    docker push<registry>/<image>:<tag>

Configure Container Registry integration with the cluster

For a Managed Kubernetes cluster, after integration, authentication credentials are automatically added to the default service account and secret to all cluster namespaces.

In a Kubernetes cluster, you create the object Secret — secret with Container Registry token data by yourself.

You can configure integration from Container Registry with one or more Managed Kubernetes clusters.

  1. In Control Panel, go to Cloud PlatformContainer Registry.
  2. Open the registry page.
  3. Click Registry Access.
  4. Select Integration with Kubernetes.
  5. Press Continue.
  6. Select the Managed Kubernetes clusters that will be granted access to the selected registry. You can only select clusters with status ACTIVE. Clusters with other statuses are labeled as `INACTIVE'.
  7. If you are setting up the integration for the first time, click Integrate.
  8. If you are changing the integration settings, click Save.

Information about the Managed Kubernetes clusters that have been granted access to the selected registry is displayed on the registry page, under the registry name.

Deploy the application from the image

  1. Create a deployment.yaml file:

    nano deployment.yaml
  2. Copy the contents into the file:

    apiVersion: apps/v1
    kind: Deployment
    name: example-deployment
    app: example-deployment
    replicas: 2
    app: example-deployment
    app: example-deployment
    - name: <image_name>


    • <registry> is the name of the registry;
    • <image_name> is the name of the image.
  3. Deploy the application:

    kubectl apply -f deployment.yaml
  4. Check the status of the pods — they should be in running status:

    kubectl get pods