Skip to main content

Deploy an image from Container Registry to a Managed Kubernetes cluster

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. In the Clusters section, open the cluster page → Settings tab.

  3. In the Integration with Container Registry 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 accessible from the cluster is displayed on the cluster page → Settings tab → Integration with Container Registry 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
    imagePullSecrets:
    - name: craas-auth

    Specify:

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

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

    kubectl get pods