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 the image to Container Registry.
- Configure Container Registry integration with the cluster.
- Deploy the 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>— image name, can be viewed usingdocker image list;<registry>— name of the registry to upload the image to;<tag>— 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, in the top menu, click Products and select Managed Kubernetes.
-
In the Clusters section, open the cluster page → tab Settings.
-
In the Container Registry integration block, click Set up integration.
-
Select the registries you want the cluster to access.
-
If you are configuring the integration for the first time, click Integrate.
-
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
-
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>:latestimagePullSecrets:- name: craas-authSpecify:
<registry>— registry name;<image_name>— image name.
-
Deploy the application:
kubectl apply -f deployment.yaml -
Check the status of the pods — they should be in the
runningstatus:kubectl get pods