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.
- Upload an image to the Container Registry.
- Configure the integration of Container Registry with the cluster.
- Deploy an application from the image.
Upload an image to Container Registry
-
Enter your username and password.
-
Assign a tag to the image:
docker tag <image> cr.selcloud.ru/<registry>/<image>:<tag>Specify:
<image>— the image name, which can be viewed usingdocker image list;<registry>— the name of the registry to which you want to upload the image;<tag>— the tag.
-
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.
-
In the control panel on the top menu, click Products and select Managed Kubernetes.
-
Open the cluster page → Settings tab.
-
In the Container Registry integration block, click Configure integration.
-
Select the registries you want the cluster to access.
-
If you are setting up the integration for the first time, click Integrate.
-
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
-
Create a deployment.yaml file:
nano deployment.yaml -
Copy the content into the file:
apiVersion: apps/v1kind: Deploymentmetadata:name: example-deploymentlabels:app: example-deploymentspec:replicas: 2selector:matchLabels:app: example-deploymenttemplate:metadata:labels:app: example-deploymentspec:containers:- name: <image_name>image: cr.selcloud.ru/<registry>/<image>:latestSpecify:
<registry>— the registry name;<image_name>— the image name.
-
Deploy the application:
kubectl apply -f deployment.yaml -
Check the pod status — they should be in the
running:status:kubectl get pods