Manage and deploy private images¶
Mirantis offers its own image registry, Mirantis Secure Registry (MSR), which you can use to store and manage the images that you deploy to your cluster. This topic describes how to use MKE to push the official WordPress image to MSR and later deploy that image to your cluster.
To create an MSR image repository:
Log in to the MKE web UI.
From the left-side navigation panel, navigate to <user name> > Admin Settings > Mirantis Secure Registry.
In the Installed MSRs section, capture the MSR URL for your cluster.
In a new browser tab, navigate to the MSR URL captured in the previous step.
From the left-side navigation panel, click Repositories.
Click New repository.
In the namespace field under New Repository, select the required namespace. The default namespace is your user name.
In the name field under New Repository, enter the name
To create the repository, click Save.
To push an image to MSR:
In this example, you will pull the official WordPress image from Docker Hub, tag it, and push it to MSR. Once pushed to MSR, only authorized users will be able to make changes to the image. Pushing to MSR requires CLI access to a licensed MSR installation.
Pull the public WordPress image from Docker Hub:
docker pull wordpress
Tag the image, using the IP address or DNS name of your MSR instance. For example:
docker tag wordpress:latest <msr-url>:<port>/<namespace>/wordpress:latest
Log in to an MKE manager node.
Push the tagged image to MSR:
docker image push <msr-url>:<port>/admin/wordpress:latest
Verify that the image is stored in your MSR repository:
Log in to the MSR web UI.
In the left-side navigation panel, click Repositories.
Click admin/wordpress to open the repo.
Click the Tags tab to view the stored images.
Verify that the
latesttag is present.
To deploy the private image to MKE:
Log in to the MKE web UI.
In the left-side navigation panel, click Kubernetes.
Click Create to open the Create Kubernetes Object page.
In the Namespace dropdown, select default.
In the Object YAML editor, paste the following Deployment object YAML:
apiVersion: apps/v1 kind: Deployment metadata: name: wordpress-deployment spec: selector: matchLabels: app: wordpress replicas: 2 template: metadata: labels: app: wordpress spec: containers: - name: wordpress image: 184.108.40.206:444/admin/wordpress:latest ports: - containerPort: 80 --- apiVersion: v1 kind: Service metadata: name: wordpress-service labels: app: wordpress spec: type: NodePort ports: - port: 80 nodePort: 32768 selector: app: wordpress
The Deployment object YAML specifies your MSR image in the Pod template spec:
image: <msr-url>:<port>/admin/wordpress:latest. Also, the YAML file defines a
NodePortservice that exposes the WordPress application so that it is accessible from outside the cluster.
Click Create. Creating the new Kubernetes objects will open the Controllers page.
After a few seconds, verify that wordpress-deployment has a green status icon and is thus successfully deployed.