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
- Go to the Virtual Clusters view using the menu on the left
- Switch to the Virtual Cluster Templates tab
- Click the button to create a new virtual cluster template
- In the drawer that appears on the right, use the field Display Name to specify a Name for your virtual cluster template
- Specify any of these options: labels, annotations, virtual cluster version, helm values and apps to deployed
- Expand the Space Template should be applied for the underlying host namespace if being created as part of the virtual clusters creation process section to specify which
- On the very bottom, click on the button to create this virtual cluster template
2. Create Virtual Cluster Based On Template
- UI
- CLI
- Go to the Virtual Clusters view using the menu on the left
- Click on the button
- Use the field Virtual Cluster Template to select a template to use for creating this virtual cluster
- Use the field Display Name to define the name of this space and optionally specify other settings
- Click on the button at the very bottom
Retrieve a kube-context for this virtual cluster using Loft CLI:
loft use vcluster [vcluster-name]
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[])