Skip to main content
Deploy image from Container Registry
Last update:

Deploy image from Container Registry

If you store Docker images in Container Registry, you can deploy under to a Managed Kubernetes cluster.

  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> cr.selcloud.ru/<registry>/<image>:<tag>

    Specify:

    • <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 cr.selcloud.ru/<registry>/<image>:<tag>

Configure Container Registry integration with the cluster

You can configure integration from a Managed Kubernetes cluster with one or more Container Registries.

  1. In Control Panel, go to Cloud PlatformKubernetes.
  2. Open the cluster page → Settings tab.
  3. In the Integration with Container Registry box, click Customize Integration.
  4. Select the registries to be accessed from the cluster.
  5. If you are setting up the integration for the first time, click Integrate.
  6. If you are changing the integration settings, click Save.

Information about Container Registry registries accessed from the cluster is displayed on the Cluster page → Settings tabIntegration with Container Registry block.

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
    metadata:
    name: example-deployment
    labels:
    app: example-deployment
    spec:
    replicas: 2
    selector:
    matchLabels:
    app: example-deployment
    template:
    metadata:
    labels:
    app: example-deployment
    spec:
    containers:
    - name: <image_name>
    image: cr.selcloud.ru/<registry>/<image>:latest

    Specify:

    • <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