Cluster Templates
Cluster templates encompass both Kubernetes configuration and node pool configuration, allowing a single template to contain all the information Rancher needs to provision new nodes in a cloud provider and install Kubernetes on those nodes.
Overview
Cluster templates are provided as Helm charts. To use them, you will need to clone and fork the templates, change them according to your use case, and then install the Helm charts on the Rancher management cluster. When the Helm chart is installed on the Rancher management cluster, a new cluster resource is created, which Rancher uses to provision the new cluster.
After the cluster is provisioned using the template, no changes to the template will affect the cluster. After the cluster is created from the cluster template, its configuration and infrastructure can change, because no restrictions are enforced by cluster templates.
SUSE® Rancher Prime RKE2 Cluster Template
See the example repository for an RKE2 cluster template.
Adding a Cluster Template to Rancher
In this section, you’ll learn how to add the cluster template to the local
cluster’s chart repo list. The result is that Rancher will include the cluster template as an option when users install new Kubernetes clusters.
Prerequisites:
|
-
Go to a cluster template example repository. Rancher’s examples are in this GitHub repository.
-
Fork the repository.
-
Optional: Edit the cluster options by editing the
values.yaml
file. For help editing the file, see the cluster template’s Helm chart README. -
Add the chart repository to Rancher. Click ☰ > Cluster Management.
-
Go to the
local
cluster and click Explore. -
In the left navigation bar, click
-
Click Create.
-
Enter a name for the cluster template repository.
-
Click Git Repository containing Helm chart definitions.
-
In the Git Repo URL field, enter the URL for the repository. For example,
https://github.com/rancher/cluster-template-examples.git
. -
In the Git Branch field, enter the branch to use as the source for the template. Rancher’s example repository uses
main
. -
Click Create.
Result: The cluster template available from the Apps in Rancher’s local
cluster. It can now be used to deploy clusters.
Restricted Admin access:
If you are a restricted admin and don’t have access to the |
Creating a Cluster from a Cluster Template
Prerequisites:
|
-
Click ☰ > Cluster Management.
-
On the Clusters page, click Create.
-
Click the name of your cluster template.
-
Finish installing the Helm chart.
Result: After Rancher provisions the new cluster, it is managed in the same way as any other Rancher-launched Kubernetes cluster. You can configure any options through the UI if the cluster template has options for the user to choose from.
Updating a Cluster Created from a Cluster Template
You can update any clusters using a template from the
page, given there is a new version of a template being used by those clusters.Deploying Clusters from a Template with SUSE® Rancher Prime Continous Delivery
Prerequisites:
|
-
Click ☰ > Cluster Management.
-
On the Clusters page, click Create.
-
Click Create Cluster from Template.
Result: After Rancher provisions the new cluster, it is managed by Fleet.
Uninstalling Cluster Templates
-
Click ☰ > Cluster Management.
-
Go to the
local
cluster and click -
Go to the chart repository for your cluster template and click ⋮ > Delete.
-
Confirm the deletion.
Result: The cluster template is uninstalled. This action does not affect clusters created with the cluster template.
An admin with access to the local
cluster can also remove a cluster deployed via cluster templates through the page.
Configuration Options
Cluster templates are flexible enough that they can be used to configure all of the following options:
-
Node configuration
-
Node pools
-
Pre-specified cloud credentials
-
Enable/configure an authorized cluster endpoint to get kubectl access to the cluster without using Rancher as a proxy
-
Install Rancher V2 monitoring
-
Kubernetes version
-
Assign cluster members
-
Infrastructure configuration such as AWS VPC/subnets or vSphere data center
-
Cloud provider options
-
Pod security options
-
Network providers
-
Ingress controllers
-
Network security configuration
-
Network plugins
-
Private registry URL and credentials
-
Add-ons
-
Kubernetes options, including configurations for Kubernetes components such as kube-api, kube-controller, kubelet, and services
For details on how to configure the template, refer to the cluster template’s Helm chart README.