Container orchestration solutions such as Kubernetes allow development teams to be quick and agile with their software deployments.
“One of the main features of Kubernetes is the ability to reduce the deployment of version piece of software down to a simple image tag which can be applied at the end of a command.” – said Tytus Kurek, Product Manager for Charmed Kubernetes at Canonical.
This opens the doors to streamlined deployments but creates another problem. How do we streamline? We can do this manually, but it’s not very streamlined. Or we can do this automatically, but we need to be smart. We can’t just deploy as soon as a new version is released. We need to check it first. This is where a container registry and CI/CD come in.
Before we get started, we have to find ourselves a healthy Kubernetes cluster. Canonical offers both Charmed Kubernetes and MicroK8s solutions which are fully compliant with the upstream Kubernetes project. While Charmed Kubernetes is suitable for large-scale deployments in data centers or public clouds, MicroK8s was designed for workstation and edge appliances. You can install MicroK8s on your laptop at no cost by following this quick tutorial. If you’re on Windows or Mac you may need to follow the Multipass guide first to get a VM with Ubuntu.
Apart from Kubernetes, we will also need GitLab – a web-based DevOps lifecycle tool. GitLab has the ability to store up to 10 GB in a container registry for projects. You can incorporate the building of these containers into your own CI/CD pipeline or you can use Gitlab’s own CI/CD functionality to do this for you.
Setting up the container registry
Creating the container registry on GitLab involves completing the following steps:
Create a project – you can create a new project or use an existing one.
Create a Dockerfile – create a Dockerfile for an image to be built and stored in GitLab.
Using GitLab as a container registry for Kubernetes allows you to streamline your application deployments. You can check out GitLab’s documentation on how to take your newly learned skills and apply them to your own CI/CD or create one in GitLab.