clearml

by ClearML

Helm chartv7.15.0App 2.0Apache-2.0Verified publisher

MLOps platform

About this chart

ClearML Ecosystem for Kubernetes

MLOps platform

Homepage: https://clear.ml

Maintainers

NameEmailUrl
filippo-clearmlhttps://github.com/filippo-clearml
ummon-vhttps://github.com/ummon-v

Introduction

The clearml-server is the backend service infrastructure for ClearML. It allows multiple users to collaborate and manage their experiments.

clearml-server contains the following components:

  • The ClearML Web-App, a single-page UI for experiment management and browsing
  • RESTful API for:
    • Documenting and logging experiment information, statistics and results
    • Querying experiments history, logs and results
  • Locally-hosted file server for storing images and models making them easily accessible using the Web-App

Add to local Helm repository

To add this chart to your local Helm repository:

helm repo add clearml https://clearml.github.io/clearml-helm-charts

Kubernetes CRD requirements

During the initial Helm installation, Custom Resource Definitions (CRDs) are automatically installed. However, due to Helm's update strategy, these CRDs will not be updated automatically during subsequent helm upgrade operations.

To ensure you have the latest CRD versions when performing an upgrade, please apply the CRDs manually before running helm upgrade:

kubectl apply -f https://raw.githubusercontent.com/mongodb/mongodb-kubernetes/1.6.1/public/crds.yaml

Local environment

For development/evaluation it's possible to use kind. After installation, following commands will create a complete ClearML insatllation:

cat <<EOF | kind create cluster --config=-
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
  extraPortMappings:
  # API server's default nodePort is 30008. If you customize it in helm values by
  # `apiserver.service.nodePort`, `containerPort` should match it
  - containerPort: 30008
    hostPort: 30008
    listenAddress: "127.0.0.1"
    protocol: TCP
  # Web server's default nodePort is 30080. If you customize it in helm values by
  # `webserver.service.nodePort`, `containerPort` should match it
  - containerPort: 30080
    hostPort: 30080
    listenAddress: "127.0.0.1"
    protocol: TCP
  # File server's default nodePort is 30081. If you customize it in helm values by
  # `fileserver.service.nodePort`, `containerPort` should match it
  - containerPort: 30081
    hostPort: 30081
    listenAddress: "127.0.0.1"
    protocol: TCP
  extraMounts:
  - hostPath: /tmp/clearml-kind/
    containerPath: /var/local-path-provisioner
EOF

helm install clearml clearml/clearml

After deployment, the services will be exposed on localhost on the following ports:

  • API server on 30008
  • Web server on 30080
  • File server on 30081

Data persisted in every Kubernetes volume by ClearML will be accessible in /tmp/clearml-kind folder on the host.

Production cluster environment

In a production environment it's suggested to install an ingress controller and verify that is working correctly. During ClearML deployment enable ingress section of chart values. This will create 3 ingress rules:

  • app.<your domain name>
  • files.<your domain name>
  • api.<your domain name>

(for example, app.clearml.mydomainname.com, files.clearml.mydomainname.com and api.clearml.mydomainname.com)

Just pointing the domain records to the IP where ingress controller is responding will complete the deployment process.

A production ready cluster should also have some different configuration like the one proposed in values-production.yaml that can be applied with:

helm install clearml clearml/clearml -f values-production.yaml

Dependencies migration

Starting chart version 7.15.0, a migration path for database dependencies is available to help users transition to new bundled dependencies.

IMPORTANT: This procedure is required to prepare for future Helm chart updates that may not be possible if the migration is not completed. The migration ensures data consistency and compatibility with upcoming chart versions.

Procedure

Phase 1: Enable MCK MongoDB Deployment

Prerequisites

Export your clearml namespace (the default is clearml but verify your actual namespace as it may have been customized during installation):

CLEARML_NAMESPACE=clearml

Add CRDs following Helm chart README:

kubectl apply -f https://raw.githubusercontent.com/mongodb/mongodb-kubernetes/1.6.1/public/crds.yaml

Update your Helm chart configuration with the following values to deploy the MCK MongoDB instance, staying on Helm chart version 7.15.0:

mckMongodb:
  enabled: true

Upgrade chart accordingly with helm upgrade command.

Note: This step creates the new MongoDB instance in parallel with the existing Bitnami deployment, allowing for data migration without service interruption.

Phase 2: Data Migration Process

2.1 Scale down the ClearML API server

Scale down ClearML services:

kubectl -n $CLEARML_NAMESPACE scale deployment -l app.kubernetes.io/name=clearml --replicas=0

2.2 Deploy Migration Pod

Create a Kubernetes pod equipped with MongoDB tools for the migration process. Create a file called mongodb-migrate.yaml:

apiVersion: v1
kind: Pod
metadata:
  name: mongodb-migrate
spec:
  restartPolicy: Never
  containers:
    - name: mongo-tools
      image: mongo:7
      command: ["sleep", "infinity"]
      env:
        - name: CLEARML_MONGODB_SERVICE_CONNECTION_STRING
          valueFrom:
            secretKeyRef:
              name: mongodb-root
              key: connectionString

Deploy and access the migration pod:

kubectl -n $CLEARML_NAMESPACE apply -f mongodb-migrate.yaml

2.3 Export Data from Source Database

Dump data from Bitnami MongoDB:

MONGO_CONNECTION_STRING=$(kubectl get deploy -n $CLEARML_NAMESPACE -o jsonpath='{.items[*].spec.template.spec.containers[?(@.name=="clearml-apiserver")].env[?(@.name=="CLEARML_MONGODB_SERVICE_CONNECTION_STRING")].value}{"\n"}')
kubectl -n $CLEARML_NAMESPACE exec -it mongodb-migrate -- mongodump --uri="$MONGO_CONNECTION_STRING" --archive=/dump.archive --gzip

Copy the dump to a local system so there's a further local copy just in case:

kubectl -n $CLEARML_NAMESPACE cp mongodb-migrate:/dump.archive /tmp/dump.archive

2.4 Import Data to Target Database

Restore data to MCK MongoDB:

kubectl -n $CLEARML_NAMESPACE exec -it mongodb-migrate -- sh -c 'mongorestore \
  --uri="$CLEARML_MONGODB_SERVICE_CONNECTION_STRING" \
  --archive=/dump.archive \
  --gzip \
  --drop'

Phase 3: Configuration Updates

3.1 Mark Migration as Complete

Update your Helm configuration to indicate successful data migration, staying on Helm chart version 7.15.0:

mckMongodb:
  enabled: true
  migrated: true

Upgrade chart accordingly with helm upgrade command.

3.2 Validate System Functionality

Thoroughly test ClearML Enterprise functionality to ensure all components are working correctly with the new MongoDB deployment.

3.3 Decommission Bitnami MongoDB

Once validation is complete, disable the legacy Bitnami MongoDB deployment, staying on Helm chart version 7.15.0:

mongodb:
  enabled: false
mckMongodb:
  enabled: true
  migrated: true

Upgrade chart accordingly with helm upgrade command.

3.4 Remove migration pod

Remove the migration pod:

kubectl -n $CLEARML_NAMESPACE delete -f mongodb-migrate.yaml

Upgrades/ Values upgrades

Updating to latest version of this chart can be done in two steps:

helm repo update
helm upgrade clearml clearml/clearml

Changing values on existing installation can be done with:

helm upgrade clearml clearml/clearml --version <CURRENT CHART VERSION> -f custom_values.yaml

Please note: updating values only should always be done setting explicit chart version to avoid a possible chart update. Keeping separate updates procedures between version and values can be a good practice to seprate potential concerns.

Major upgrade from 5.* to 6.*

Before issuing helm upgrade:

  • delete Redis statefulset(s)
  • scale MongoDB deployment(s) replicas to 0
  • if using securityContexts check for new value form in values.yaml (podSecurityContext and containerSecurityContext)

Additional Configuration for ClearML Server

You can also configure the clearml-server for:

  • fixed users (users with credentials)
  • non-responsive experiment watchdog settings

For detailed instructions, see the Optional Configuration section in the clearml-server repository README file.

Source Code

Requirements

Kubernetes: >= 1.21.0-0

RepositoryNameVersion
https://charts.bitnami.com/bitnamimongodb13.18.5
https://helm.elastic.coelasticsearch7.17.3
https://mongodb.github.io/helm-chartsmckMongodb(mongodb-kubernetes)1.6.1
oci://ghcr.io/dragonflydb/dragonfly/helmdragonflyv1.36.0

Values

KeyTypeDefaultDescription
apiserverobject{"additionalConfigs":{},"additionalVolumeMounts":{},"additionalVolumes":{},"affinity":{},"asyncdelete":{"extraEnvs":[]},"containerSecurityContext":{},"deploymentAnnotations":null,"enabled":true,"existingAdditionalConfigsConfigMap":"","existingAdditionalConfigsSecret":"","extraEnvs":[],"image":{"pullPolicy":"IfNotPresent","registry":"","repository":"allegroai/clearml","tag":"2.0.0-613"},"ingress":{"annotations":{},"enabled":false,"hostName":"api.clearml.127-0-0-1.nip.io","ingressClassName":"","path":"/","tlsSecretName":""},"initContainers":{"resources":{"limits":{"cpu":"10m","memory":"64Mi"},"requests":{"cpu":"10m","memory":"64Mi"}}},"nodeSelector":{},"podAnnotations":{},"podSecurityContext":{},"prepopulateEnabled":true,"processes":{"count":8,"maxRequests":1000,"maxRequestsJitter":300,"timeout":24000},"replicaCount":1,"resources":{"limits":{"cpu":"2000m","memory":"1Gi"},"requests":{"cpu":"100m","memory":"256Mi"}},"service":{"annotations":{},"nodePort":30008,"port":8008,"type":"NodePort"},"serviceAccountAnnotations":{},"serviceAccountName":"clearml","tolerations":[]}Api Server configurations
apiserver.additionalConfigsobject{}files declared in this parameter will be mounted and read by apiserver (examples in values.yaml) if not overridden by existingAdditionalConfigsSecret
apiserver.additionalVolumeMountsobject{}Specifies where and how the volumes defined in additionalVolumes.
apiserver.additionalVolumesobject{}# Defines extra Kubernetes volumes to be attached to the pod.
apiserver.affinityobject{}Api Server affinity setup
apiserver.asyncdeleteobject{"extraEnvs":[]}Api Server asyncdelete configurations
apiserver.asyncdelete.extraEnvslist[]Api Server asyncdelete extra environment variables
apiserver.containerSecurityContextobject{}Api Server containers security context
apiserver.deploymentAnnotationsstringnilAdd the provided map to the annotations for the Deployment resource created by this chart.
apiserver.enabledbooltrueEnable/Disable component deployment
apiserver.existingAdditionalConfigsConfigMapstring""reference for files declared in existing ConfigMap will be mounted and read by apiserver (examples in values.yaml)
apiserver.existingAdditionalConfigsSecretstring""reference for files declared in existing Secret will be mounted and read by apiserver (examples in values.yaml) if not overridden by existingAdditionalConfigsConfigMap
apiserver.extraEnvslist[]Api Server extra envrinoment variables
apiserver.imageobject{"pullPolicy":"IfNotPresent","registry":"","repository":"allegroai/clearml","tag":"2.0.0-613"}Api Server image configuration
apiserver.ingressobject{"annotations":{},"enabled":false,"hostName":"api.clearml.127-0-0-1.nip.io","ingressClassName":"","path":"/","tlsSecretName":""}Ingress configuration for Api Server component
apiserver.ingress.annotationsobject{}Ingress annotations
apiserver.ingress.enabledboolfalseEnable/Disable ingress
apiserver.ingress.hostNamestring"api.clearml.127-0-0-1.nip.io"Ingress hostname domain
apiserver.ingress.ingressClassNamestring""ClassName (must be defined if no default ingressClassName is available)
apiserver.ingress.pathstring"/"Ingress root path url
apiserver.ingress.tlsSecretNamestring""Reference to secret containing TLS certificate. If set, it enables HTTPS on ingress rule.
apiserver.initContainersobject{"resources":{"limits":{"cpu":"10m","memory":"64Mi"},"requests":{"cpu":"10m","memory":"64Mi"}}}Api Server resources per initContainers pod
apiserver.nodeSelectorobject{}Api Server nodeselector
apiserver.podAnnotationsobject{}specific annotation for Api Server pods
apiserver.podSecurityContextobject{}Api Server pod security context
apiserver.prepopulateEnabledbooltrueEnable/Disable example data load
apiserver.processesobject{"count":8,"maxRequests":1000,"maxRequestsJitter":300,"timeout":24000}Api Server internal processes configuration
apiserver.processes.count

Deploy clearml with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has clearml on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the chartclearml is pinned at v7.15.0 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below
opentenant validate opentenant.yaml
terraform init && terraform apply