Skip to main content
Version: 2.0 (Latest)

Virtual Cluster Templates

Loft allows you to create templates for virtual clusters. Virtual cluster templates are optional templates that a user can choose to apply when creating a virtual cluster.

Common use cases for virtual cluster templates may be:

  • Adding development tooling to a virtual cluster
  • Deploying pre-populated databases with test data
  • Equipping new virtual clusters with optional credentials, CRDs, etc.

Working with Virtual Cluster Templates

1. Create Virtual Cluster Template
  1. Go to the Virtual Clusters view using the menu on the left
  2. Switch to the Virtual Cluster Templates tab
  3. Click the button to create a new virtual cluster template
  4. In the drawer that appears on the right, use the field Display Name to specify a Name for your virtual cluster template
  5. Specify any of these options: labels, annotations, virtual cluster version, helm values and apps to deployed
  6. Expand the Space Template section to specify which Space Template should be applied for the underlying host namespace if being created as part of the virtual clusters creation process
  7. On the very bottom, click on the button to create this virtual cluster template
2. Create Virtual Cluster Based On Template

To use a virtual cluster template to create a virtual cluster using Loft CLI, run:

loft create vcluster [vcluster-name] --template [template-name]
Kube-Context

Running loft create vcluster will automatically add a kube-context to your kube-config file, so you can immediately run kubectl commands right after creating a virtual cluster.

Configuration

Metadata

Display Name

JSONPath in VirtualClusterTemplate CRD:
 spec.displayName (type: string)

Kubernetes Name

JSONPath in VirtualClusterTemplate CRD:
 metadata.name (type: string)

Description

JSONPath in VirtualClusterTemplate CRD:
 spec.description (type: string)

Labels

JSONPath in VirtualClusterTemplate CRD:
 metadata.labels (type: map[string]string)

Annotations

JSONPath in VirtualClusterTemplate CRD:
 metadata.annotations (type: map[string]string)

Template For Virtual Clusters

Labels

JSONPath in VirtualClusterTemplate CRD:
 spec.template.metadata.labels (type: map[string]string)

Annotations

JSONPath in VirtualClusterTemplate CRD:
 spec.template.metadata.annotations (type: map[string]string)

Version

JSONPath in VirtualClusterTemplate CRD:
 spec.template.helmRelease.chart.version (type: string)

Helm Values

JSONPath in VirtualClusterTemplate CRD:
 spec.template.helmRelease.values (type: {})

Apps

Namespaces For Apps

Space Template

JSONPath in VirtualClusterTemplate CRD:
 spec.spaceTemplateRef (type: string)

Access To Virtual Cluster Template

JSONPath in VirtualClusterTemplate CRD:
 spec.access (type: Access[])

CRDs

VirtualClusterTemplate

apiVersion
string

APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources

kind
string

Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds

object (io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta)

ObjectMeta is metadata that all persisted resources must have, which includes all objects users must create.

object (com.github.loft-sh.api.pkg.apis.management.v1.VirtualClusterTemplateSpec)

VirtualClusterTemplateSpec holds the specification

object (com.github.loft-sh.api.pkg.apis.management.v1.VirtualClusterTemplateStatus)

VirtualClusterTemplateStatus holds the status

{
  • "apiVersion": "string",
  • "kind": "string",
  • "metadata": {
    },
  • "spec": {
    },
  • "status": {
    }
}