Skip to content

Install in custom infrastructure

guideinstall-custom-infrastructure

Install Platforma into a Kubernetes cluster that the company already has, in any cloud or data center.

Other ways: Install in cloud with Terraform, Install in cloud with installer, Install in Single Server mode.

The cluster must meet the Kubernetes contract. Two paths install Platforma into it: the Terraform modulesTerraform modules — The Terraform code that MiLaboratories provides to install Platforma. The cloud-specific Terraform modules make the cluster and its cloud parts in AWS or Google Cloud; the cloud-agnostic Terraform modules install Platforma into the cluster. Glossary, which MiLaboratories recommends, and the Helm chart alone. To make a new cluster in AWS or Google Cloud, see Install in cloud with Terraform.

What you get

Tool: platforma-tf-* modules (cloud and cloud-agnostic)

For a KubernetesKubernetes — A system that runs programs on a group of machines (a cluster). Platforma can run in a Kubernetes cluster. Glossary cluster that the company already has, MiLaboratories recommends the cloud-agnostic Terraform modulescloud-agnostic Terraform modules — The Terraform modules platforma-tf-services-cluster and platforma-tf-services. They do not depend on the infrastructure and install Platforma into any cluster that meets the Kubernetes contract, in a cloud or in the company's own infrastructure. Glossary. You describe the cluster one time in the input cluster_config, and the modules do the rest: platforma-tf-services-cluster creates the namespace, installs KueueKueue — A Kubernetes add-on that holds jobs in a queue until the cluster has free CPU, memory and GPU for them. Glossary and AppWrapperAppWrapper — A Kubernetes add-on that wraps the pods of one job into a single unit, so that Kueue admits and starts them together. Glossary, and creates the jobjob — One run of a tool on data. The Backend starts jobs on the server where it runs, or in a Kubernetes cluster. Glossary queues and the RBAC roles; platforma-tf-services installs the BackendBackend — The server program of Platforma. It keeps the projects, runs the Blocks and starts jobs. Glossary. Before they change the cluster, the modules check the inputs and stop at a wrong value with its path.

  • Primary storageprimary storage — The bucket (Amazon S3 or Google Cloud Storage) or folder where Platforma keeps all results and uploaded files. Glossary: an S3-compatible bucket, with the access keys from the Secret platforma-storage. Platforma also supports Amazon S3 and Google Cloud Storage with the cloud identity of the Backend (see Primary storage). Workspaceworkspace — The storage where the Backend and all jobs keep the working files of running jobs. The Backend and the jobs use it at the same time. In Kubernetes, it is a network file system; in Single Server mode, it is a folder on the server. Glossary: a claim of 1 TiB from the StorageClass platforma-workspace of the workspace. The database and the logs get claims from the StorageClasses platforma-database and platforma-logs.
  • Sign-insign in — To show the Backend who you are, with a sign-in provider or a single-user token. The verb is "sign in"; the noun and the adjective are "sign-in". Glossary: the static list of usersstatic list of users — A sign-in provider that is a file with the logins and the password hashes of the users, in the htpasswd format. The Backend reads it again when it changes. Glossary from the Secret platforma-users; admin is an administrator.
  • Entry pointentry point — The way in to the Backend from outside the cluster, a load balancer or an Ingress with a DNS name. It usually ends TLS and sends the traffic to the Backend pod. Glossary and TLS: the Desktop AppDesktop App — The program that each user installs on their own computer to work with Platforma. It is a client of the Backend. Glossary connects to platforma.example.com through the Gateway of the cluster. The listener platforma of the Gateway holds the certificate, so TLS ends there. With generic, the Gateway must also have the gRPC health check and the long stream timeouts (see Gateway).
  • What runs where: the Backend pod runs on the node with the label platforma.bio/pool=backend. The jobs go through the job queues to the nodes with the labels platforma.bio/pool=ui and platforma.bio/pool=batch, and each job node also has the label platforma.bio/node-group=<group> (see Node pools). With autoscaling.enabled set to false, the module reads the nodes of each pool and calculates from them the quotas of the job queues and the largest job.

The modules use the StorageClasses, the Gateway and the bucket that the cluster has, and do not create them. The license key and the master secret come from the Secrets platforma-license and platforma-master-secret, the defaults of the modules, so the inputs do not name them.

Size. The size follows the nodes of the cluster. With 8 CPUs and 32 GiB, the Backend serves up to about 30 users who work at the same time. Kubernetes keeps a part of each node for itself, so a node of 8 CPUs and 32 GiB cannot hold this request. Use a larger Backend node, or set the Backend to the CPU and the memory that its node gives to pods (the step “Prepare the cluster”). The biggest jobs of a sample ask for 16 CPUs, so they need batch nodes of 32 CPUs and 256 GiB, one such job on each node. For the time and the cost of the analyses on these nodes, see Size and cost of an analysis.

Before you start

Prepare these items before the first apply:

  • The cluster meets the Kubernetes contract: Kubernetes 1.35 or later, the node pools with their labels, the StorageClasses, the Gateway and the bucket. With the Terraform modules, the modules add Kueue, AppWrapper and the job queues; with the Helm chart alone, the team that runs the cluster adds them.
  • Rights. A kubeconfig with cluster admin rights to prepare the cluster, and the role admin in the namespace to install the Backend. See Rights to install.
  • A host and TLS. The host name that users type in the Desktop App, for example platforma.example.com. A DNS record from the host to the address of the Gateway. A certificate for the host on the listener of the Gateway. See Domain and TLS.
  • The bucket of the primary storage and its access keys. See Primary storage.
  • The license key. See License.
  • Network access from the computer that installs Platforma to github.com (the modules) and ghcr.io (the charts), or a clone and a chart mirror in the corporate network. For all hosts, see Outbound connections.
  • A clone of platforma-install at a release tag: the modules and the charts. See Where the modules are.
  • Tools on the computer that runs the installation: kubectl (at most one minor version from the version of the cluster), openssl and htpasswd (the package apache2-utils or httpd-tools). Also Terraform 1.12 or later (or OpenTofu 1.12 or later) for the modules, or Helm 3 for the chart.

When the cluster cannot reach the public registries, make a mirror of each of them before the first apply, and keep the mirrors for as long as Platforma runs: see Registries mirroring.

Steps

MiLaboratories recommends the Terraform modules for a cluster that exists: they prepare the cluster for Platforma and check the inputs before they change it. With the Helm chart alone, the team that runs the cluster prepares by hand all that the Kubernetes contract asks. In the examples, <platforma-install> is the folder of a clone of the repository platforma-install at the release tag (see Where the modules are), <release tag> is this tag, and <kubeconfig context> is the context of the cluster in ~/.kube/config. Select this context before the steps, so that the kubectl commands and the Terraform providers use the same cluster:

Terminal window
kubectl config use-context <kubeconfig context>

The modules come from github.com and get the charts from oci://ghcr.io/milaboratory/platforma-install. On a machine without internet access, use the clone: set chart_repository of backend_service and of components.appwrapper to <platforma-install>/helm/charts.

  1. Make the secret values. See Secret values. Also put the access keys of the bucket into two files in the same folder:

    Terminal window
    cd ~/platforma-secrets
    printf '%s' '<access key>' > access-key.txt
    printf '%s' '<secret key>' > secret-key.txt
  2. Prepare the cluster.

    Tool: platforma-tf-* modules (cloud and cloud-agnostic)

    Describe the cluster in the input cluster_config of platforma-tf-services-cluster, as a JSON file. Set the labels of the node pools, the names of the ServiceAccounts, the StorageClass of the workspace, the bucket and the Gateway of the cluster:

    cluster/cluster-config.json
    {
    "contract_version": 1,
    "namespaces": ["platforma"],
    "node_pools": {
    "ui": {
    "node_selector": { "platforma.bio/pool": "ui" },
    "tolerations": [],
    "node_groups": [{ "name": "ui", "max_size": 2 }]
    },
    "batch": {
    "node_selector": { "platforma.bio/pool": "batch" },
    "tolerations": [],
    "node_groups": [{ "name": "batch", "max_size": 4 }]
    }
    },
    "autoscaling": { "enabled": false, "provisioning_request": {} },
    "cloud_values": {
    "jobs": { "service_account": { "name": "platforma-jobs" } },
    "backend": {
    "service_account": { "name": "platforma-backend" },
    "allocatable": { "cpu": 7.2, "memory_gib": 26 }
    },
    "volumes": { "workspace": { "storage_class": "platforma-workspace" } },
    "primary_storage": {
    "s3": {
    "bucket": "platforma-results",
    "endpoint": "https://s3.example.com",
    "region": "us-east-1",
    "secret": {
    "access_key": { "name": "platforma-storage", "key": "access-key" },
    "secret_key": { "name": "platforma-storage", "key": "secret-key" }
    }
    }
    },
    "network": {
    "hosts": ["platforma.example.com"],
    "entry_points": [{
    "host": "platforma.example.com",
    "gateway": {
    "name": "platforma-gateway",
    "namespace": "platforma-gateway",
    "section_name": "platforma",
    "implementation": "generic"
    }
    }]
    }
    }
    }

    backend.allocatable is the CPU and the memory that the Backend pod can use on its node: the Allocatable values in the output of kubectl describe node. The Backend pod requests this value. Without it, the pod requests 8 CPUs and 32 GiB, and a node of this size does not have room for it.

    Apply the root cluster with cluster admin rights, from the folder ~/platforma with the subfolders cluster, services and handoff. It creates the namespace platforma, installs Kueue and AppWrapper, and creates the job queues and the RBAC roles. Do not create the namespace by hand: the apply then fails.

    cluster/main.tf
    terraform {
    required_providers {
    helm = { source = "hashicorp/helm", version = "~> 3.1" }
    kubernetes = { source = "hashicorp/kubernetes", version = "~> 3.0" }
    kubectl = { source = "alekc/kubectl", version = "~> 2.1" }
    }
    }
    provider "kubernetes" {
    config_path = "~/.kube/config"
    config_context = "<kubeconfig context>"
    }
    provider "helm" {
    kubernetes = {
    config_path = "~/.kube/config"
    config_context = "<kubeconfig context>"
    }
    }
    provider "kubectl" {
    config_path = "~/.kube/config"
    config_context = "<kubeconfig context>"
    }
    module "services_cluster" {
    source = "git::https://github.com/milaboratory/platforma-install.git//terraform/cloud-agnostic/platforma-tf-services-cluster?ref=<release tag>"
    cluster_config = jsondecode(file("cluster-config.json"))
    }
    output "infrastructure" { value = module.services_cluster.infrastructure }
    output "versions" { value = module.services_cluster.versions }
    Terminal window
    cd ~/platforma/cluster
    terraform init
    terraform apply
    terraform output -json infrastructure > ../handoff/infrastructure.json

    To change the node pools, the quotas of the job queues or to add GPU nodes, see Jobs and resources. For an Ingress in place of the Gateway, see Domain and TLS.

    Result: kubectl get namespace platforma shows Active.

  3. Create the Secrets, from the files of step 1. These are the names and keys of the examples; the license, the master secret and the users have the default names of the chart and of the modules.

    Terminal window
    cd ~/platforma-secrets
    kubectl -n platforma create secret generic platforma-license --from-file=MI_LICENSE=license.txt
    kubectl -n platforma create secret generic platforma-master-secret --from-file=master-secret=master-secret.txt
    kubectl -n platforma create secret generic platforma-users --from-file=htpasswd=users.htpasswd
    kubectl -n platforma create secret generic platforma-storage --from-file=access-key=access-key.txt --from-file=secret-key=secret-key.txt

    Result: kubectl -n platforma get secrets lists the four Secrets.

    For the Secrets of other sign-in providerssign-in provider — A configured way for users to sign in to the Backend: single sign-on (SSO), LDAP or a static list of users. One Backend can have more than one. Glossary, see Authentication. For a bucket that the Backend reads with its cloud identity, with no keys, see Primary storage.

  4. Install the Backend.

    Tool: platforma-tf-* modules (cloud and cloud-agnostic)

    Apply the root services with the role admin in the namespace. It reads the hand-off file of the root cluster, and waits until the Backend is ready.

    services/main.tf
    terraform {
    required_providers {
    helm = { source = "hashicorp/helm", version = "~> 3.1" }
    }
    }
    provider "helm" {
    kubernetes = {
    config_path = "~/.kube/config"
    config_context = "<kubeconfig context>"
    }
    }
    module "platforma" {
    source = "git::https://github.com/milaboratory/platforma-install.git//terraform/cloud-agnostic/platforma-tf-services?ref=<release tag>"
    namespace = "platforma"
    infrastructure = jsondecode(file("../handoff/infrastructure.json"))
    backend_service = {
    auth = {
    providers = [
    {
    name = "local"
    title = "Local password"
    htpasswd = { secret = { name = "platforma-users", key = "htpasswd" } }
    admin_users = ["admin"]
    },
    ]
    }
    }
    }
    output "entry_points" { value = module.platforma.entry_points }
    output "release" { value = module.platforma.release }
    output "versions" { value = module.platforma.versions }
    Terminal window
    cd ~/platforma/services
    terraform init
    terraform apply

    Result: kubectl -n platforma get pods shows the Backend pod Running.

    To change the sign-in, see Authentication and Users and roles. For the other settings of the Backend, see Storage, Data libraries, Jobs and resources, Proxy and custom CA and Registries.

  5. Check DNS and the certificate.

    Terminal window
    kubectl -n platforma-gateway get gateway platforma-gateway # PROGRAMMED: True
    dig +short platforma.example.com
    openssl s_client -connect platforma.example.com:443 -servername platforma.example.com \
    -verify_hostname platforma.example.com -verify_return_error -alpn h2 </dev/null >/dev/null 2>&1 \
    && echo "certificate OK"

    Result: the host resolves to the address of the Gateway, and the last command shows certificate OK. When it shows nothing, the certificate is not valid for the host name: run openssl again without >/dev/null 2>&1 to see the error. For the certificate and the DNS record, see Domain and TLS.

  6. Verify the installation. See Verify the installation.

  7. Connect the Desktop App to https://platforma.example.com, and sign in as admin with the password of the list of users. See Connect clients.

Next