Part 2: Blueprint
What Will You Do¶
In this part of the self-paced exercise, you will create a custom cluster blueprint with a Cluster Autoscaler add-on, based on declarative specifications.
Step 1: Create Repository¶
In this step, you will create a repository in your project so that the controller can retrieve the Helm charts automatically.
- Open Terminal (on macOS/Linux) or Command Prompt (Windows) and navigate to the folder where you forked the Git repository
- Navigate to the folder "
/getstarted/autoscaler/repository"
The "autoscaler-repository.yaml" file contains the declarative specification for the repository. In this case, the specification is of type "Helm Repository" and the "endpoint" is pointing to the Kubernetes Github repository that includes the Autoscaler Helm chart.
apiVersion: config.rafay.dev/v2
kind: Repository
metadata:
name: autoscaler-repo
spec:
repositoryType: HelmRepository
endpoint: https://kubernetes.github.io/autoscaler
credentialType: CredentialTypeNotSet
Type the command below
rctl create repository -f autoscaler-repository.yaml
If you did not encounter any errors, you can optionally verify if everything was created correctly on the controller.
- Navigate to the "defaultproject" project in your Org
- Select Integrations -> Repositories
Step 2: Create Namespace¶
In this step, you will create a namespace for the Cluster Autoscaler. The "autoscaler-namespace.yaml" file contains the declarative specification
The following items may need to be updated/customized if you made changes to these or used alternate names.
- value: autoscaler-cluster
kind: ManagedNamespace
apiVersion: config.rafay.dev/v2
metadata:
name: autoscaler
description: namespace for cluster autoscaler
labels:
annotations:
spec:
type: RafayWizard
resourceQuota:
placement:
placementType: ClusterSpecific
clusterLabels:
- key: rafay.dev/clusterName
value: autoscaler-cluster
- Open Terminal (on macOS/Linux) or Command Prompt (Windows) and navigate to the folder where you forked the Git repository
- Navigate to the folder "
/getstarted/autoscaler/namespace" - Type the command below
rctl create namespace -f autoscaler-namespace.yaml
If you did not encounter any errors, you can optionally verify if everything was created correctly on the controller.
- Navigate to the "defaultproject" project in your Org
- Select Infrastructure -> Namespaces
- You should see an namesapce called "autoscaler"
Step 3: Create Addon¶
In this step, you will create a custom addon for the Cluster Autoscaler. The "autoscaler-addon.yaml" file contains the declarative specification
If you plan to use a different name or AWS region for the cluster other than "autoscaler-cluster" and "us-west-1", you must update the "custom-values.yaml" file located in the folder "
The following details are used to build the declarative specification.
- "v1" because this is our first version
- The addon is part of the "defaultproject"
- Name of addon is "autoscaler-addon"
- The addon will be deployed to a namespace called "autoscaler"
- You will be using a "custom-values.yaml" as an override which is located in the folder "
/getstarted/autoscaler/addon" - The "cluster-autoscaler" chart will be used from the previously created repository named "autoscaler-repo"
The following items may need to be updated/customized if you made changes to these or used alternate names.
- repository_ref: "autoscaler-repo"
kind: AddonVersion
metadata:
name: v1
project: defaultproject
spec:
addon: autoscaler-addon
namespace: autoscaler
template:
type: Helm3
valuesFile: custom-values.yaml
repository_ref: autoscaler-repo
repo_artifact_meta:
helm:
chartName: cluster-autoscaler
- Open Terminal (on macOS/Linux) or Command Prompt (Windows) and navigate to the folder where you forked the Git repository
- Navigate to the folder "
/getstarted/autoscaler/addon" - Type the command below
rctl create addon version -f autoscaler-addon.yaml
If you did not encounter any errors, you can optionally verify if everything was created correctly on the controller.
- Navigate to the "defaultproject" project in your Org
- Select Infrastructure -> Addons
- You should see an addon called "autoscaler-addon"
Step 4: Create Blueprint¶
In this step, you will create a custom cluster blueprint with the Cluster Autoscaler addon. The "autoscaler-blueprint.yaml" file contains the declarative specification.
- Open Terminal (on macOS/Linux) or Command Prompt (Windows) and navigate to the folder where you forked the Git repository
- Navigate to the folder "
/getstarted/autoscaler/blueprint"
The following items may need to be updated/customized if you made changes to these or used alternate names.
- project: "defaultproject"
kind: Blueprint
metadata:
# blueprint name
name: autoscaler-blueprint
#project name
project: defaultproject
- Type the command below
rctl create blueprint -f autoscaler-blueprint.yaml
If you did not encounter any errors, you can optionally verify if everything was created correctly on the controller.
- Navigate to the "defaultproject" project in your Org
- Select Infrastructure -> Blueprint
- You should see an blueprint called "autoscaler-blueprint
New Version¶
Although we have a custom blueprint, we have not provided any details on what it comprises. In this step, you will create and add a new version to the custom blueprint. The YAML below is a declarative spec for the new version.
The following items may need to be updated/customized if you made changes to these or used alternate names.
- project: "defaultproject"
- blueprint: "autoscaler-blueprint"
- name: "autoscaler-addon"
- version: "v1"
kind: BlueprintVersion
metadata:
name: v1
project: defaultproject
description: Autoscaler
spec:
blueprint: autoscaler-blueprint
baseSystemBlueprint: default
baseSystemBlueprintVersion: ""
addons:
- name: autoscaler-addon
version: v1
# cluster-scoped or namespace-scoped
pspScope: cluster-scoped
rafayIngress: true
rafayMonitoringAndAlerting: true
# BlockAndNotify or DetectAndNotify
driftAction: BlockAndNotify
- Type the command below to add a new version
rctl create blueprint version -f autoscaler-blueprint-v1.yaml
If you did not encounter any errors, you can optionally verify if everything was created correctly on the controller.
- Navigate to the "defaultproject" project in your Org
- Select Infrastructure -> Blueprint
- Click on the "autoscaler-blueprint" custom cluster blueprint
Recap¶
As of this step, you have created a "cluster blueprint" with Cluster Autoscaler as one of the addons. You are now ready to move onto the next step where you will provision an EKS cluster with this custom cluster blueprint.