Skip to main content

Deploy an image from Container Registry to a Managed Kubernetes cluster

Last update:

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

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

Upload an image to Container Registry

  1. Log in to the registry.

  2. Enter your username and password.

  3. Assign a tag to the image:

    docker tag <image> cr.selcloud.ru/<registry>/<image>:<tag>

    Specify:

    • <image> — the image name, which can be viewed using docker image list;
    • <registry> — the name of the registry to which you want to upload the image;
    • <tag> — the tag.
  4. Upload the image to the registry:

    docker push cr.selcloud.ru/<registry>/<image>:<tag>

Configure integration of the Container Registry with the cluster

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

  1. In the control panel on the top menu, click Products and select Managed Kubernetes.

  2. Open the cluster page → Settings tab.

  3. In the Container Registry integration block, click Configure integration.

  4. Select the registries you want the cluster to access.

  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 that the cluster has access to is displayed on the cluster page → Settings tab → Container Registry integration block.

Deploy an application from an image

  1. Create a deployment.yaml file:

    nano deployment.yaml
  2. Copy the content 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> — the registry name;
    • <image_name> — the image name.
  3. Deploy the application:

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

    kubectl get pods