Learn KOP - Amazon Cluster Auto Scaler Blueprint - Rafay Product Documentation

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.

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.


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.

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
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.


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 "/getstarted/autoscaler/addon" with the name of the cluster or region

The following details are used to build the declarative specification.

The following items may need to be updated/customized if you made changes to these or used alternate names.

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
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.


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.

The following items may need to be updated/customized if you made changes to these or used alternate names.

kind: Blueprint
metadata:
  name: autoscaler-blueprint
  project: defaultproject
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.


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.

kind: BlueprintVersion
metadata:
  name: v1
  project: defaultproject
  description: Autoscaler
spec:
  blueprint: autoscaler-blueprint
  baseSystemBlueprint: default
  baseSystemBlueprintVersion: ""
  addons:
    - name: autoscaler-addon
      version: v1
  pspScope: cluster-scoped
  rafayIngress: true
  rafayMonitoringAndAlerting: true
  driftAction: BlockAndNotify
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.


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.