Create Clusters - RKE2

How to Create RKE2 Clusters using Frontier CLI

To perform tasks within the frontier CLI application, you are required to authenticate using your organization’s OIDC provider. Refer to the Authentication using Frontier CLI guide if you need assistance on logging in for use of Frontier services.

Frontier administrators may want to create new objects within their organization’s management cluster.

RKE2 Cluster Creation Guide

Within projects, clusters will need to be created to fulfill tasks the organization is working on. Cluster, project, and frontier administrators have a wide variety of options to choose from how they would like their cluster to be created. You could always run the command to see what clusters are currently running in the project you are working on:

frontier get cluster all -n <project-name>

To being creating your new cluster, we will start off by navigating to this feature. When you run frontier, you should see a list of capabilites using Frontier-CLI.

Frontier CLI Main Menu

You can see all the actions you are able to perform within your Frontier-CLI menu options. We will run frontier create to see the creating options within the interface. The only roles who will have access to view the create menu are cluster administrators and above.

Frontier CLI Create Menu

Cluster, project, and frontier administrators are able to create clusters using the create actions. Run the following command below to view creation options:

frontier create cluster

Expected output:

Frontier CLI Create Cluster Options

These new clusters can be created upon different Kubernetes platforms. The currently supported Kubernetes platforms for FKP clusters are K3s, RKE2, and MicroK8s. This guide will cover RKE2 cluster creation. We can use -h flag to bring up the help menu. To see the help menu for creating RKE2 clusters, run the following command below:

frontier create cluster rke2 -h

Expected output:

Frontier CLI Create RKE2 Cluster Help

NOTE: Cluster Administrators are restricted in deploying new workload clusters only to the projects that they are assigned to.

Cluster Creation Options

When creating RKE2 clusters through Frontier services, the client is provided with a large variety of options in how they would like their cluster to be created. However, these options only expand to the MAAS workload cluster provider. In this section, we will cover each of the specific flags pertaining through the RKE2 clusters that are either required or optional to MAAS CAPI deployments.

MAAS Logo

Metal-as-a-Service Flags

As mentioned previously, MAAS is the only current supported provider to deploy RKE2 workload clusters using Frontier services. MAAS is a service that treats physical servers like virtual machines (instances) in the cloud. MAAS comprehensively meets the need to rapidly deploy, destroy, and reconfigure constellations of bare metal. Any application that requires frequently rearranging the server topology will benefit. This makes it a suitable option for workload clusters managed by your Frontier Management Cluster (FMC). Below are flags specified to create clusters through a MAAS provider:

  • --cp-cpucount: An integer containing the minimum desired number of vCPUs for each control plane node
  • --cp-memory: An integer containing the minimum desired memory size of each control plane node (in MBs)
  • --wk-cpucount: An integer containing the minimum desired number of vCPUs for each worker node
  • --wk-memory: An integer containing the minimum desired memory size of each worker node (in MBs)
  • --svclb: A string value containing the minimum desired service load balancer for the cluster

Although there are not any required flags, users are still given the opportunity of how they would like their MAAS workload clusters to be configured. The CPU count for control plane and worker nodes, as well as their memory size, can be specified prior to cluster creation. MAAS will auto-select machines that are best fitted for your minimum specified requirements upon each type of node whether it is on an AMD64 or ARM64 machine. If no minimum requirements are specified, FKP offers a recommended minimum for the machine specifications:

  • --cp-cpucount - Default Value: 4
  • --cp-memory - Default Value: 4096
  • --wk-cpucount - Default Value: 4
  • --wk-memory - Default Value: 4096

Although RKE2 is lightweight Kubernetes distribution, it is not as lightweight as K3s. Therefore, there will at least need to be a minimum of 2 CPUs and 4096 MB of memory required for all control plane nodes within an RKE2 cluster. You will not be able to insert values below those minimum requirements to prevent any errors on your new RKE2 workload cluster deployment using Frontier services. Outside of machine specifications, users also have the option to modify their service load balancer for metal nodes. For MAAS, users will have two options to choose from:

  • --svclb: Service load balancer
    • metallb
    • none
    • Default Value: metallb

FKP recommends using metallb for your service load balancer when using a MAAS cluster provider. This will allow the user to freely assign IP addresses or IP address pools based within their machine’s local network for their services within the cluster.

Global Flags

Global flags remain to be a part of every workload cluster, regardless of the cluster provider specified to be in use. We will take a look at these options below:

  • --cluster-name: A Required string value containing the name of the cluster
  • -n, --project-name: A Required string value containing the name of the project for the new cluster
  • --provider: A Required string value containing the name of the provider for the new cluster
  • --kube-version: A string value containing the desired version of Kubernetes respective to the kube-type
  • --cp-replicas: An integer containing the desired number of control plane nodes
  • --wk-replicas: An integer containing the desired number of vCPUs for each worker node
  • --cni: A string value containing the desired Container Network Interface (CNI) for the cluster
  • --csi: A string value containing the desired Container Storage Interface (CSI) for the cluster
  • --ingress: A string value containing the desired ingress controller for the cluster
  • --os-image: A string value containing the desired operating system for the nodes of the cluster
  • -h, --help: help for cluster

The only required values to create a cluster using Frontier services is the name of the cluster, name of the project the cluster will reside in. All other flags are optional and can be changed if mentioned by the client upon creation. These following points will cover over string and integer-based value modifications with their default value. Each workload cluster will have a variety of different options to select for their version of Kubernetes respective to their type whether it is K3s, RKE2, or MicroK8s. The version can be specified by this flag:

  • --kube-version - Default Value: v1.28.3

Please ensure the version is typed correctly to avoid any possible errors. Additionally, cluster administrators will be able to set the number of replicas they desire for each of their nodes. These flags can be adjusted to the client’s preference as long as the value is the control plane replica count greater than 0:

  • --cp-replicas - Default Value: 3
  • --wk-replicas - Default Value: 3

For frontier workload cluster add-ons, it is required to have at least 1 replica for control plane and 2 replicas of the worker nodes for all containers and services to successfully run. It is encouraged to run 3 or more control plane replica nodes if you desire high availability for your newly created cluster. For cluster tools and plug-ins, these following points will cover over any supported features provided within Frontier services in each string value option along with their recommended default value:

  • --cni: Container Network Interface (CNI)
    • flannel
    • calico
    • none
    • Default Value: flannel
  • --csi: Container Storage Interface (CSI)
    • openebs
    • none
    • Default Value: openebs
  • --ingress: Ingress controller
    • ingress-nginx
    • none
    • Default Value: ingress-nginx
  • --os-image: Operating System
    • ubuntu/focal
    • TBD
    • Default Value: ubuntu/focal

If you need help refering to these options within the CLI, you can run frontier create cluster rke2 -h to view all flags and supported values upon cluster creation.

Basic Cluster Creation

As mentioned previously, you are only required to fill in the cluster-name and project-name flags to create a cluster using Frontier services. To create a simple cluster, you can run the following command below:

frontier create cluster rke2 --cluster-name=<cluster-name> --project-name=<project-name>

For an example, we will use the value cli-rke2-maas for the cluster-name. In the project creation tutorial guide, we created a project by the name of frontier-test. We will use this project to satisfy the value of project-name. For this example, we will demonstrate the structure for all providers:

frontier create cluster rke2 --cluster-name=cli-rke2-maas --project-name=frontier-test --provider=maas

Expected output:

Frontier CLI Create MAAS RKE2 Cluster Example Output

This photo showcases an example where a cluster was created by the name of cli-rke2-maas within the frontier-test project with the default options recommended by Frontier Kubernetes Platform (FKP).

Customizable Cluster Creation

If you would like to create a cluster with modified options, you can refer to the cluster creation options section as a guide for supported tools and plug-ins on your new cluster. For a completely customizable Frontier cluster, you can run the following command below:

frontier create cluster rke2 --cluster-name=<cluster-name> --project-name=<project-name> --cp-replicas=<replica-count> --cp-cpucount=<cpu-count> --cp-memory=<memory-size> --wk-replicas=<replica-count> --wk-cpucount=<cpu-count> --wk-memory=<memory-size> --ingress=<ingress-name> --cni=<cni-name> --csi=<csi-name> --svclb=<svclb-name> --os-image=<os-name>

For an example, we will use the value cli-rke2-maas for the cluster-name. In the project creation tutorial guide, we created a project by the name of frontier-test. We will use this project to satisfy the value of project-name.

frontier create cluster rke2 --cluster-name=cli-rke2-maas --project-name=frontier-test --cp-replicas=3 --cp-cpucount=2 --cp-memory=4096 --wk-replicas=3 --wk-cpucount=4 --wk-memory=6144 --ingress=ingress-nginx --cni=calico --csi=openebs --svclb=metallb --os-image=ubuntu/focal 

Expected output:

Frontier CLI Create MAAS RKE2 Cluster Example Output

TThis photo showcases an example where a cluster was created by the name of cli-rke2-maas within the frontier-test project using the new options desired by the client’s command. The flags and options that can be modified strings are strict and must be in the exact same format as provided in the CLI help for RKE2 cluster creation. If these flags and options are not in the same format, the creation request will be denied. A response with the reason of denial will follow after the request has been made to help you troubleshoot any errors.