Create
Each virtual cluster that is created in Loft belongs to a Project. There are two primary ways which virtual clusters can be created inside Loft: from a template, and manually.
Virtual clusters created from a template inherit all template settings. Regular project users (non project admins) are only allowed to create virtual clusters from templates that the project administrator has allowed. This ensures that virtual clusters in each project adhere to the standards set by the project owner.
Project owners and Loft admins can create virtual clusters manually, that is without a template.
Create From Template
Project members can create a new virtual cluster through the Loft UI or CLI:
- UI
- CLI
- Select the Projects field on the left menu bar.
- From the project drop-down menu, select the project you'd like to create the virtual cluster in.
- Click the Virtual Clusters option on the project pane.
- Click the button on the right side of the page.
- In the pop-up box, select your template from the template drop down menu.
- [Optional] select the cluster in which to create the virtual cluster.
- Click the to continue.
- In the drawer that appears from the right, give your virtual cluster a name by replacing the my-vcluster placeholder name, or by updating the manifest YAML metadata.name field.
- Click the button.
Retrieve a kube-context for a virtual cluster using Loft CLI:
loft use vcluster [vcluster-name] --project [project-name]
When creating a virtual cluster from the Loft CLI, you will need to provide the name of the project in which to deploy the virtual cluster, and the name of template to use:
loft create vcluster [vcluster-name] --project [project-name] --template [template-name]
If you omit specifying a template, Loft will automatically select one for you (if there is a default template in the project specified) or prompt you to select a template.
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.
Regardless of how you create a virtual cluster from a template, either by the UI or the CLI, Loft
allows you to provide a template version string. If you do not provide this string, the latest
version will be automatically selected for you. If you do provide the string though, you can
do something very neat -- you can set any of the MAJOR, MINOR, PATCH version components to an
X
wildcard character. This allows the virtual cluster to be automatically updated to a more recent
template version that matches your provided template string.
For example, given a template with a version of 1.0.0, and a virtual cluster created from this template with a version string "1.X.X". Adding a new template version "1.1.0", will cause this virtual cluster to be automatically updated. Whereas adding a new version "2.0.0", will not cause the virtual cluster to be upgraded.
This is a very handy way to keep virtual clusters up to date with the latest templates without having to manually upgrade them!
Note that you can even set the version to "X.X.X" to always have your virtual cluster updated to the latest template version!
Create Without Template
Only Project admins can create a virtual cluster without a template:
- Select the Projects field on the left menu bar.
- From the project drop-down menu, select the project you'd like to create the virtual cluster in.
- Click the Virtual Clusters option on the project pane.
- Click the button on the right side of the page.
- In the popup make sure the virtual cluster template field is empty.
- [Optional] select the cluster in which to create the virtual cluster.
- Click the to continue.
- In the drawer that appears from the right, give your virtual cluster a name by replacing the my-vcluster placeholder name, or by updating the manifest YAML metadata.name field.
- [Optional] Update the virtual cluster with any additional desired configuration options.
- The Definition tab contains settings relating to the virtual cluster deployment itself, here you can provide helm values to be used when deploying the virtual cluster, select the virtual cluster distribution (ex: k3s (default), k0s, k8s), as well as configurations for sleep mode and ingress access.
- Objects is where you can define Kubernetes manifests that should be created in the virtual cluster.
- Apps allows you to select any pre-defined 'applications' (ex: Cert Manager) that should be installed into the virtual cluster.
- Space settings allow for configuration of labels and annotations on the space that the virtual cluster will be created in, you can also define objects and Apps that should be deployed into this space.
- Permissions are additional access rules that can be defined for the virtual cluster instance.
- Click the button.
Retrieve a kube-context for a virtual cluster using Loft CLI:
loft use vcluster [vcluster-name] --project [project-name]