Last modified November 6, 2026
Creating a base template for your workload cluster
In Giant Swarm the interface to define a workload cluster is built on top of Helm and Flux. A Flux HelmRelease installs the release chart of your provider, for example release-aws, and an OCIRepository pulls that chart from oci://gsoci.azurecr.io/charts/giantswarm/release-aws. The chart version is the Giant Swarm release version. The HelmRelease contains the specification and configuration of the cluster in this format:
apiVersion: helm.toolkit.fluxcd.io/v2
kind: HelmRelease
metadata:
name: mycluster
namespace: org-myorg
spec:
chartRef:
kind: OCIRepository
name: mycluster
namespace: org-myorg
valuesFrom:
- kind: ConfigMap
name: mycluster-config
valuesKey: values
...
So creating a cluster means delivering an OCIRepository and a configured HelmRelease to the platform API, also known as the management cluster API, where your cluster will run.
The release chart provides the defaults, and you layer your own values on top through the HelmRelease resource’s valuesFrom list. Flux merges the entries in the order of the list, so a later entry overrides an earlier one. To learn how the cluster-<provider> chart chain produces the defaults, read cluster configuration.
If your bases still deploy clusters with an App resource, read App Platform deprecation to learn how to move them to a HelmRelease.
To avoid code duplication, the bases and overlays pattern uses Kustomize to enhance the cluster configuration.
Create a cluster template base
The shared cluster template base shouldn’t serve as a standalone base for cluster creation, it’s only abstracting the OCIRepository and HelmRelease resources common to all clusters versions. It’s then used as a base for other bases, which provide an overlay with a specific configuration. That way you avoid code duplication across bases.
Note: This isn’t a complete guide of how to create a perfect base, but a summary of the basic steps needed to move forward. Instructions here won’t always be precise in telling you what to change. The right answer depends on the resources involved and how much of them you want to include in a base.
You can create bases for workload clusters easily thanks to the kubectl gs command:
kubectl gs gitops add base --provider capa
This command will create the folder structure and the specific folder for the provider capa (AWS flavour), including the template files in the template folder. cluster.yaml holds the OCIRepository and the HelmRelease, and cluster_config.yaml holds the cluster values that kustomization.yaml turns into the ${cluster_name}-config ConfigMap. The structure would be:
bases
└── clusters
└── capa
└── template
├── cluster_config.yaml
├── cluster.yaml
└── kustomization.yaml
The current possible values for the providers can be checked in the command reference.
Create versioned base (optional)
Versioning cluster template bases is a good practice to avoid breaking changes in values.yaml schema affecting your clusters.
The kubectl-gs base command for templating configuration only generates configuration for the most recent schema. If you configure a base for an older release, it’s advised to check what’s generated against the version-specific values.yaml.
In this example you create a custom version for AWS base:
Create a directory structure:
mkdir -p bases/clusters/capa/v36.1.1Use the kubectl gs template cluster to template cluster resources, see an example for the
capaprovider below. Use arbitrary values for the mandatory fields, we will configure them later in our process. Set--releaseto a release that’s published as arelease-awschart, so the values match the release chart and leave out the release version. The command renders aConfigMapwith the cluster values, anOCIRepositoryand aHelmRelease. Keep only the values of theConfigMapin a newcluster_config.yamlfile in your version folder:kubectl gs template cluster \ --name mywcl \ --organization myorg \ --release 36.1.1 \ --provider capa \ | yq 'select(.kind == "ConfigMap") | .data.values' > bases/clusters/capa/v36.1.1/cluster_config.yamlCheck the content of the file. It looks like this:
global: connectivity: availabilityZoneUsageLimit: 3 network: {} topology: {} controlPlane: {} metadata: name: mywcl organization: myorg preventDeletion: false servicePriority: highest nodePools: nodepool0: instanceType: m5.xlarge maxSize: 10 minSize: 3 rootVolumeSizeGB: 8 providerSpecific: {}Replace
mywcl,myorgvalues from the previous step with variables. The single quotes keep your shell from expanding the variables, as Flux substitutes them later:sed -i 's/myorg/${organization}/g' bases/clusters/capa/v36.1.1/cluster_config.yaml sed -i 's/mywcl/${cluster_name}/g' bases/clusters/capa/v36.1.1/cluster_config.yamlNote that on macOS,
sed -ineeds an empty suffix argument:sed -i '' 's/myorg/${organization}/g' ....Check
cluster_config.yamlagainst the version-specificvalues.yaml, and tweak it if necessary to match the expected schema. At this point you may also provide extra configuration, like additional availability zones, node pools, etc. If you usedkubectl gs templateto get the values, this should be aligned with the latest version. If you were trying to create a different version, you might need to check proper values for that version.Create a patch for the cluster
HelmReleaseresource to provide the newly created configuration. For this create a filepatch_config.yamlwith this content:- op: add path: /spec/valuesFrom/- value: kind: ConfigMap name: ${cluster_name}-version-config valuesKey: valuesThis JSON 6902 patch appends the ConfigMap to the end of
valuesFrom, so its values override the values of the template. Note that a merge patch would replace the wholevaluesFromlist instead.Create the
kustomization.yaml, referencing the template, and generating the ConfigMap out ofcluster_config.yaml:apiVersion: kustomize.config.k8s.io/v1beta1 configMapGenerator: - files: - values=cluster_config.yaml name: ${cluster_name}-version-config namespace: org-${organization} generatorOptions: disableNameSuffixHash: true kind: Kustomization patches: - path: patch_config.yaml target: group: helm.toolkit.fluxcd.io kind: HelmRelease name: \$\{cluster_name\} resources: - ../templateThe ConfigMap gets its own name, because the template already generates
${cluster_name}-config. The patch target name is a regular expression, so it escapes the${cluster_name}variable that Flux substitutes later.
Now learn how to create workload clusters using these bases.
Need help, got feedback?
We listen to your Slack support channel. You can also reach us at support@giantswarm.io. And of course, we welcome your pull requests!