Skip to main content
Version: 1.0.0

Configure Smart Karpenter with Rancher on Linode

This topic describes the steps to deploy Smart Karpenter with Rancher on a Linode cluster.

Deploy Smart Karpenter

note

Use the following command to encode the values to base64:

echo -n '<value>' | base64 -w0

The following are the steps to deploy Smart Karpenter:

  1. Connect to the Rancher worker node using SSH.

  2. Use the following command to get the RKE controller server and the token:

    # cat /etc/rancher/rke2/config.yaml.d/50-rancher.yaml 
    {
    "node-label": [
    "rke.cattle.io/machine=d459c182-ba22-46e4-a1a9-97400437eace"
    ],
    "private-registry": "/etc/rancher/rke2/registries.yaml",
    "protect-kernel-defaults": false,
    "server": "https://[IP_ADDR]:9345",
    "token": "TOKEN"
  3. Update the charts.yaml or values.yaml with the RKE controller URL and the token.

    rancherLinode:
    cluster:
    server: "" #base64 of "https://[IP_ADDR]:9345"
    token: "" #base64 of the RKE. See /etc/rancher/rke2/config.yaml.d/50-rancher.yaml of an existing worker node
    rootPass: "" #base64 of the root Password on the nodes. Please make sure the password meets linode requiremets
    linodeToken: "" #base64 of the linode token. Make sure the Linode token has enough rights.
  4. Add the repository using the following commands:

    helm repo add smartscaler https://smartscaler.nexus.aveshalabs.io/repository/smartscaler-helm-ent-prod
    helm repo update
  5. Use the following command to deploy Smart Karpenter:

    helm install karpenter smartscaler/avesha-karpenter -f values.yaml --namespace smart-scaler --create-namespace

Create a NodeClass

Use the following command to create a NodeClass:

cat <<EOF |  kubectl apply -f -
apiVersion: karpenter.multicould.sh/v1alpha1
kind: LinodeNodeClass
metadata:
name: default
spec:
imageName: linode/ubuntu20.04
rke2Version: "v1.30.7+rke2r1"
privateIP: True
#scriptUrl: "https://get.rke2.io" #optional
#subnetID: <subnetID> - #optional
#firewallID: <firewallID> - #optional
EOF

Create a NodePool

Use the following command to create a NodePool:

cat <<EOF |  kubectl apply -f -
apiVersion: karpenter.sh/v1
kind: NodePool
metadata:
name: default
spec:
template:
spec:
requirements:
- key: kubernetes.io/arch
operator: In
values: ["amd64"]
- key: kubernetes.io/os
operator: In
values: ["linux"]
- key: topology.kubernetes.io/zone
operator: In
#values: ["eu-west", "eu-central", "se-sto", "de-fra-2"]
values: ["de-fra-2"]
nodeClassRef:
name: default
kind: LinodeNodeClass
group: karpenter.multicould.sh
expireAfter: 720h # 30 * 24h = 720h
limits:
cpu: 1000
disruption:
consolidationPolicy: WhenEmptyOrUnderutilized
consolidateAfter: 2m
EOF

Update the System Agent Upgrader

Rancher System Agent Upgrader continuously deploys short-live pods on Smart Karpenter's nodes, and Smart Karpenter cannot disrupt those nodes even where no user pods are running. The nodes seem never to be empty to Smart Karpenter.

To stop the Rancher System Agent Upgrader from deploying short-lived pods on Smart Karpenter-managed nodes, follow these steps:

  1. Use the following command to edit the plan:

    kubectl -n cattle-system edit plan system-agent-upgrader
  2. Use the following command to add add the node.kubernetes.io/instance-type node selector:

    spec:
    concurrency: 10
    nodeSelector:
    matchExpressions:
    - key: kubernetes.io/os
    operator: In
    values:
    - linux
    - key: node.kubernetes.io/instance-type
    operator: In
    values:
    - rke2