Cluster Templates
Summary
You can bring your own cluster templates and specify custom Terraform modules for cluster infrastructure creation. This feature enables you to define custom input variables that dynamically prompt users during cluster creation.
Custom templates are available for:
- Workload clusters - Development and production application clusters
- Team management clusters - Organization management and control plane clusters (Available in Konstruct 0.2+)
Prerequisites
Git Repository
You need a git repository in your Organization's GitHub org for your custom cluster templates and terraform modules. For a great example starting point, please fork our upstream.
https://github.com/konstructio/konstruct-templates
Terraform Knowledge
- Familiarity with Terraform module structure
- Understanding of provider requirements
- Knowledge of your cloud provider's Terraform resources
Repository Access Setup
Public Repositories
Public repositories work without additional configuration.
Private Repositories
For private repositories, you'll need to provide access credentials when creating the custom template:
- GitHub: Create a personal access token with repository read permissions.
You'll provide these credentials in the Konstruct UI when configuring your custom template.
Validation Checklist
Before proceeding:
- Git repository created
- Repository access configured
Using Custom Templates
Create a Custom Template
A workload cluster template is a directory in a git repository that has GitOps content used when creating a workload cluster. The template allows you to use <TOKENS> to be used as variables for replacement during cluster provisioning. Konstruct comes with many available tokens automatically, but allows you to add your own tokens as well.
Define Input Variables
- In your template root directory, create a
konstruct.yamlfile. - Define the cluster type and input variables:
clusterType: "physical" # physical|virtual|gpu
inputs:
- name: "cidr"
token: "<WORKLOAD_CIDR>"
prompt: "Enter your workload cluster VPC CIDR block"
tip: "10.0.0.0/16"
- name: "business-unit"
token: "<BUSINESS_UNIT>"
prompt: "Enter your business unit name"
tip: "e.g. 'engineering', 'sales', 'marketing'" - Use the tokens directly in your GitOps yaml content wherever values should be replaced per instance.
- Commit and push the new
konstruct.yamlfile to your git repository.
Create a Cluster with your Custom Template
Connect to your cluster template

- Select Create Cluster.
- Choose Custom Template from the template dropdown.
- Provide the URL for your custom template's git repository
- Specify the path in that git repository where the workload cluster template folder resides
- Enter the branch or tag name to define the version of your template
- Provide a PAT if your git repository is private
- Click Connect
Complete your cluster creation details
- Complete standard cluster options (name, region, nodes).
- Complete the custom prompted variables:
- Each input defined in
konstruct.yamlwill appear as a form field - The prompt text guides the user on what the field is
- Tips provide example values
- Each input defined in
- Select Create Cluster.
The resulting yaml that gets committed to your gitops repository will have your tokens replaced with the values that were provided by the end user. These values will also be available on your cluster details view.
Workload Cluster Template Requirements
Your custom workload cluster template must follow these conventions:
Directory Structure
The konstruct.yaml file is required in the cluster template's top folder.
your-template-repo/any-template-folder/
├── konstruct.yaml
├── argocd-application-1.yaml
├── argocd-application-2.yaml
└── argocd-application-1/
├ ── application.yaml
└── external-secret.yaml
└── argocd-application-2/
├── application.yaml
└── external-secret.yaml
└── terraform/
├── main.tf
├── eks/
└── vpc/
Here is an example Argo CD application with a custom token
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
annotations:
argocd.argoproj.io/sync-wave: "10"
name: konstruct
namespace: argocd
spec:
destination:
name: in-cluster
namespace: konstruct
project: default
source:
chart: konstruct
repoURL: https://charts.konstruct.io
targetRevision: "<MY_CUSTOM_VERSION_TOKEN>"
syncPolicy:
automated:
prune: true
selfHeal: true
syncOptions:
- CreateNamespace=true