Setting Up a Rancher Cluster

This section describes how to setup an existing Rancher cluster for DKube installation.

To install DKube on a system, it is assumed that:

  • A Rancher Server has been created

  • All the nodes have a static IP address

  • Docker CE has been installed on the installation node

Note

The instructions to set up the cluster above assume an existing on-prem or VM cluster

Setting up the Rancher Cluster

Execute the Rancher Server Run Command

In order to create k8s on the DKube cluster, the Run command must be executed on each node in the DKube cluster. The Run command is generated during the Add Cluster procedure on the Rancher Server, and can be obtained later from the Edit screen as shown below.

_images/Rancher-Cluster-Edit.png _images/Rancher-Run-Command.png

The execution of the Run command on the DKube node will initiate activity on the Rancher Server. When the activities have been complete the Rancher Server will show an “Active” status.

_images/Rancher-Active.png

Copying the Kubeconfig file to the DKube Cluster Master Node

The Kubeconfig file from the Rancher Server must be copied to the installation node (either a remote installation node or the master node in the cluster). The Kubeconfig file can be found by selecting the cluster name.

_images/Rancher-Kubeconfig.png

The contents of the Kubeconfig file should be put into the file $HOME/.dkube/kubeconfig on the installation node.

Note

Note that the name kubeconfig must be all lower case

Preparing the Rancher Cluster

This section describes how to prepare the Rancher cluster for DKube installation. The steps are executed from the $HOME/.dkube folder. The k8s.ini file needs to be edited in order do the setup command.

Editing the k8s ini File

The k8s.ini file has the following format:

_images/k8s-ini-file-Rancher.png

Only the following fields should be filled in:

Field

Value

provider

onprem

distro

Operating system type

nodes

Node names from the Rancher server UI

STORAGE_TYPE

Type of DKube storage

user

The user name for the DKube cluster account

User

This is the DKube cluster user account name. It can be a root or non-root account, but the same account must be available on all cluster nodes, and must have passwordless access through an ssh key and sudoers permissions.

Cluster Access from the Installation Node

In order to run the installation, the installation node needs to be able to access each node in the cluster without requiring a password. In each case, sudoers account access must be provided.

The sudoers file on each node must include the DKube cluster account name with the necessary access. This can be accomplished using the visudo command, and adding the following line:

<username> ALL=(ALL) NOPASSWD:ALL

Platform-Specific Cluster Access

The cluster access instructions depend upon the type of cluster.

If DKube is going to be installed on an AWS cluster, the pem file from that cluster is used to provide access.

  • Copy the .pem key to the $HOME/.dkube folder

  • Use the following commands in the $HOME/.dkube folder to set up cluster access

sudo chmod 400 <pem file> sudo ./setup-ssh.sh --key=<pem file>

Final Access Verification

After the security access steps have been taken, the user should ensure that each node in the cluster can be properly accessed by the installation node without a password.

The installation process should not move ahead if this verification step is not successful.

sudo ssh -i ssh-rsa <username>@<Master Node IP Address>

Node Setup

Before installing DKube, the necessary software packages need to be added to each node in the DKube cluster. The k8s.ini file was configured to provide the information necessary. The following command will install the packages required.

sudo ./dkubeadm node setup

Installing DKube

DKube is installed using Helm. Continue the installation at Installing DKube

DKube Installation