DEV Community

Cover image for Rancher 101 - Creating the Cluster Configuration File
Muhammad Abdur Rofi
Muhammad Abdur Rofi

Posted on

Rancher 101 - Creating the Cluster Configuration File

Creating the Cluster Configuration File

The next step is to generate the configuration file that RKE uses to install Kubernetes. This file is called cluster.ymlby default.

One way to do this is to use the minimal configuration file supplied by Rancher, which showsthat you can build a Kubernetes cluster with nothing more than a single node definition that contains an address, a user, and all three roles: etcd, controlplane, and worker.

Technically that makes it a single node cluster.

Because it only has a single node, it's not a clusterin the true sense of the word, but it's a full installation of Kubernetes, ready to go.

One of the most amazing things about RKE is its ability to redefine the cluster on the fly. If you start with a single node cluster, you can turn it into a three-nodeHA cluster by adding two more hosts to the configuration and running rke upagain.

The other way to generate the RKE configuration is to run rke configand follow the walkthrough. This gives you the option to set public and private addresses, which is necessary if you're deploying a cluster in someplace like AWS, where the nodes don't know their public addresses.

What are you Learning?

In this lab you will createa Rancher Kubernetes Engine (RKE) configuration filewith the rke config command.

Why is it important?

The RKE configuration file is your Kubernetes cluster represented asInfrastructure as Code(IaC)with YAML. You may use this file to support continuous delivery of changes to your Kubernetes cluster with practices like GitOps. Furthermore, as your needs change and grow, this configuration file allowsyou to declarativelychange the structure and functionality of you Kubernetes cluster.

Use rke config to Create a Configuration File

You’ll use this configuration file in Lab 3 to create a single node Kubernetes Cluster. Provision a single virtual machine from a cloud provider or internal on-premises lab environment. Don’t use an ephemeral environment like an EC2 spot instanceas you will need this environment for future labs.

1.Use rke config to create a RKE configuration file.
2.Configure it according to your desired configuration options.
3.When this is completed you should have a cluster.yaml file.

Testing That It Works

1.You will use this configuration file in Lab 3 to create an RKE Cluster.You cluster configuration will vary based on the options you selected. See the Example Cluster YAMLspage for an example.


Discussion (0)