diegocastro.ar

Systems Administrator | IT Infrastructure | Internal Auditor ISO/IEC 27001 | Networking | Linux & Windows servers

Run RKE2 on Single-Node

Purpose

The purpose of this document is to describe the additional system requirements and steps to deploy the Single-Node RKE2 Kubernetes Distribution.

Pre-requisites for Single-Node Installation

The prerequisites and pre-deployment phases are describe in the Deployment & Installation Guide. Complete the steps before proceeding with Single-Node Installation.

Installation Steps

Step 1: Enable Customization for Ingress-Nginx

This step is required for the Nginx Ingress Controller to allow customized configurations:

1. Create the destination folder

mkdir -p  /var/lib/rancher/rke2/server/manifests/

2. Generate the ingress-nginx controller config file so that the RKE2 server bootstraps it accordingly.

cat<<EOF| tee /var/lib/rancher/rke2/server/manifests/rke2-ingress-nginx-config.yaml
---
apiVersion: helm.cattle.io/v1
kind: HelmChartConfig
metadata:
  name: rke2-ingress-nginx
  namespace: kube-system
spec:
  valuesContent: |-
    controller:
      metrics:
        service:
          annotations:
            prometheus.io/scrape: "true"
            prometheus.io/port: "10254"
      config:
        use-forwarded-headers: "true"
      allowSnippetAnnotations: "true"
EOF

Step 2: Download the RKE2 binaries and start Installation

1. Run the below command on the master node. RKE2 will be installed on the master node.

curl -sfL https://get.rke2.io |INSTALL_RKE2_TYPE=server  sh -

2. Enable the rke2-server service

systemctl enable rke2-server.service

3. Start the service

systemctl start rke2-server.service

RKE2 server requires 10-15 minutes (at least) to bootstrap completely  You can check the status of the RKE2 Server using systemctl status rke2-server;  once it reports as running, please proceed with the rest of the steps as given below.

4. By default, RKE2 deploys all the binaries in /var/lib/rancher/rke2/bin  path.  Add this path to the system's default PATH for kubectl utility to work appropriately.

export PATH=$PATH:/var/lib/rancher/rke2/bin
export KUBECONFIG=/etc/rancher/rke2/rke2.yaml

5. Also, append these lines into the current user's .bashrc  file

echo "export PATH=$PATH:/var/lib/rancher/rke2/bin" >> $HOME/.bashrc
echo "export KUBECONFIG=/etc/rancher/rke2/rke2.yaml"  >> $HOME/.bashrc

6. and source your ~/.bashrc

source ~/.bashrc

Step 3: Bash Completion for kubectl

1. Install bash-completion package

apt-get install bash-completion
o
yum install bash-completion -y

2. Set-up autocomplete in bash into the current shell, bash-completion package should be installed first.

source <(kubectl completion bash)
echo "source <(kubectl completion bash)" >> ~/.bashrc

3. Also, add alias for short notation of kubectl

echo "alias k=kubectl"  >> ~/.bashrc
echo "complete -o default -F __start_kubectl k"  >> ~/.bashrc

4. and source your ~/.bashrc

source ~/.bashrc

Step 4: Install helm

1. Add this command in ~/.bashrc file.

echo "export KUBECONFIG=/etc/rancher/rke2/rke2.yaml" >> ~/.bashrc

2. run this in the command prompt.

source ~/.bashrc

3. Helm is a super tool to deploy external components. In order to install helm on cluster, execute the following command:

curl -fsSL https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3|bash
cd /usr/local/bin
mkdir -p $HOME/bin && cp ./helm $HOME/bin/helm && export PATH=$HOME/bin:$PATH

4. Move to the root

 cd /root

Step 5: Enable bash completion for helm

1. Generate the scripts for help bash completion

helm completion bash > /etc/bash_completion.d/helm

2. Either re-login or run this command to enable the helm bash completion instantly.

source <(helm completion bash)

Step 6: Storage for RKE2 Single-Node Installation

The recommended storage option for RKE2 Single-Node Installation is to use OpenEBS. The details of deployment of OpenEBS can be found in Installing OpenEBS.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.