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 the image to Container Registry.
  2. Configure Container Registry integration with the cluster.
  3. Deploy the 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> — image name, can be viewed using docker image list;
    • <registry> — name of the registry to upload the image to;
    • <tag> — 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, in the top menu, click Products and select Managed Kubernetes.

  2. In the Clusters section, open the cluster page → tab Settings.

  3. In the Container Registry integration block, click Set up integration.

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

  5. If you are configuring the integration for the first time, click Integrate.

  6. If you are editing the integration settings, click Save.

    Information about the Container Registry registries accessible from the cluster is displayed on the cluster page → tab Settings → section Container Registry integration.

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 status of the pods — they should be in the running status:

    kubectl get pods