Deploy image from Container Registry
If you store Docker images in the Container Registry You can deploy underneath in a Managed Kubernetes cluster.
- Load the image into the Container Registry.
- Configure Container Registry integration with the cluster.
- Deploy the application from the image.
Upload image to Container Registry
-
Enter 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 withdocker image list
;<registry>
— name of the registry where you want to load the image;<tag>
— Tag.
-
Load the image into the registry:
docker push cr.selcloud.ru/<registry>/<image>:<tag>
Configure Container Registry integration with the cluster
You can configure integration from a Managed Kubernetes cluster with one or more Container Registries.
-
В control panels go to Cloud platform → Kubernetes.
-
Open the cluster page → tab Settings.
-
In the block Integration with Container Registry click Customize integration.
-
Select the registries to be accessed from the cluster.
-
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 Registries accessed from the cluster is displayed on the Cluster page → tab Settings → block Integration with Container Registry.
Deploy an application from an image
-
Create a deployment.yaml file:
nano deployment.yaml
-
Copy the contents 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>:latestSpecify:
<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 status
running
:kubectl get pods