Example repo of extending the TKG-m ClusterClass resource with several variables for custom configurations
- TKGm management cluster is created (tested with 2.5)
- ytt installed
- kubectl installed and set to management cluster context
- Tanzu CLI
- Git CLI
This process involves creating a custom cluster class that allows for deploying worker nodes in a workload cluster that have multiple network interfaces. Creating custom clusterclasses is roughly documented here.
- In Tanzu Kubernetes Grid 2.3.0 and later, after you deploy a management cluster, you can find the default ClusterClass manifest in the ~/.config/tanzu/tkg/clusterclassconfigs folder. This is also provided for TKG 2.5 in this repo
cp ~/.config/tanzu/tkg/clusterclassconfigs/tkg-vsphere-default-v1.2.0.yaml .
- To customize your ClusterClass manifest, you create ytt overlay files alongside the manifest. Clone this repo
git clone https://github.com/logankimmel/cluster-class-extended.get
Generate the custom ClusterClass:
ytt -f default_cc.yaml -f custom/ > custom_cc.yaml
Install the custom clusterClass in the Management cluster:
kubectl apply -f custom_cc.yaml
You should see the following output when you run kubectl get clusterclasses
:
NAME AGE
tkg-vsphere-default-v1.2.0 21h
tkg-vsphere-default-v1.2.0-extended 20h
We have now created an "extended" cluster class that accepts a new variable: nfsCommon
-
Locate your configuration file you used for creating the management cluster (these are stored in:
~/.config/tanzu/tkg/clusterconfigs
). More info on the config file can be found here -
Copy the config file to your working director:
cp ~/.config/tanzu/tkg/clusterconfigs\{config_file}.yaml ./workload-1.yaml
- Generate the custom workload cluster manifest
tanzu cluster create --file workload-1.yaml --dry-run > default_cluster.yaml
Using the overlay, create the custom manifest:
ytt -f default_cluster.yaml -f cluster_overlay.yaml > custom_cluster.yaml
- Deploy
tanzu cluster create -f custom_cluster.yaml