Documentation Apps and Routing Deploy with pipelines

Deploy with pipelines

Every cluster comes with a CI/CD service (Devtron, built on Argo), a private GitLab and a private Docker registry, already connected to each other. Once an application is set up, a git push builds a container image, stores it in the registry and deploys it to the cluster.

This guide walks through the steps from a repository to a live URL. The screens in the last part belong to Devtron. Its own documentation at docs.devtron.ai covers every option.

What is already set up

When the cluster is ready, its CI/CD service already has:

In Devtron Name Points at
Host URL — https://cicd.c-<id>.k8s.kstych.com
Container registry Cluster-Registry The cluster's private registry registry.c-<id>.k8s.kstych.com
Git account Cluster-GitLab The cluster's GitLab git.c-<id>.k8s.kstych.com
GitOps GitLab The GitLab group cicd-group, where Devtron keeps deployment manifests

You do not need to connect these yourself. Sign-in details for each service are on the cluster's Overview tab. You can also add your own GitHub, GitLab or Bitbucket account in Devtron and build from repositories there.

1. Create a project

Create a project on the cluster. Its namespace is where the application runs, and its cicd-pull-secret lets the application pull images from the private registry.

2. Put your code in Git

Your repository needs a Dockerfile that builds the application. To use the built-in GitLab, sign in at the GitLab address on the cluster's Overview tab, create a repository and push your code. GitLab's Web IDE lets you edit code in the browser.

3. Create the application in Devtron

Open CI/CD from the cluster's Overview tab and sign in, then create a custom app:

  1. Git repository: pick Cluster-GitLab (or your own account) and enter the repository's clone URL.
  2. Build configuration: pick Cluster-Registry as the container registry and give the path to your Dockerfile.
  3. Deployment template: set the container port, the number of replicas and, if you want, autoscaling. Under the image pull secrets, add cicd-pull-secret. Readiness and liveness probes, resources and environment variables are set here too.
  4. Workflow: create a build pipeline that triggers on pushes to your branch, and a deployment pipeline to an environment that uses your project's namespace. Deployments can run automatically or wait for a manual trigger. Pipelines can also run tests, scan images for vulnerabilities and do canary releases.

4. Push and deploy

Push a commit to the branch. The build pipeline picks it up (it checks for new commits every 2 minutes, or trigger it by hand), builds the image, pushes it to the registry and starts the deployment.

When the deployment is up, Devtron's App details page lists the Kubernetes resources it created. Note the service name and port.

5. Give it a URL

In the console, open the project and create a virtual service for that service name and port. Leave the domain empty to get a generated https:// address, or use your own domain. You only need to do this once: later deployments reuse the same route.

From now on, every push to the branch is built and deployed automatically, and the cluster autoscaler adds nodes when the new pods need room.