Deploy Rancher Kubernetes Engine

peterlee peterlee Oct 10, 2021
Deploy Rancher Kubernetes Engine

Why I use Rancker to deploy Kubernetes Cluster?

RKE is more easily and configurable. If we use kubeadm, we need to config many components by ourself. (like kube-dns, coredns, flannel, storageClass).

Upgrade is also a difficult job. Especially, one of my server is running Ubuntu 20.04.3 LTS, another is running Centos 7. Although this is not a good choice to use two different OS. With Rancher is more comfortable to deal with different environment.

Rancher using ssh to config each nodes. You don’t need to set worker node join to master node one by one.

This is a RKE example config cluster.yml.

    - address:
      user: node
        - controlplane
        - etcd
        - worker
    - address:
      user: node
        - worker
      ssh_key_path: /home/node/.ssh/udoo
        app: ingress

cluster_name: mycluster
ignore_docker_version: false
ssh_key_path: /home/node/.ssh/rke_rsa
ssh_cert_path: /home/node/.ssh/
kubernetes_version: "v1.20.11-rancher1-2"

  provider: nginx
  network_mode: hostPort
  http_port: 8888
  https_port: 9999
    app: ingress

     - url: registry.DOAMIN_NAME
       user: USER_NAME
       password: USER_PASSWORD 
       is_default: false
  1. controlplane, etcd, worker (master+worker)
  2. worker, ingress (worker)

Ingress will run on “”.

Get the latest RKE binary.

RKE Binary

Installation note

  1. Start build cluster. Ensure you have your own cluster.yml in same folder.
    RKE runs on almost any Linux OS with Docker installed.
    $ ./rke up
    INFO[0000] Building Kubernetes cluster
    INFO[0101] Finished building Kubernetes cluster successfully
  2. After RKE init our new kubernetes clsuter. kubectl will use this secret to connect our cluster.
    $ cp kube_config_cluster.yml ~/.kube/config

    By default, kubectl checks ~/.kube/config for a kubeconfig file, but you can use any directory you want using the –kubeconfig flag. For example:

    kubectl --kubeconfig /custom/path/kube.config get pods
  3. Let’s check nodes status.
    ➜  $ kubectl get node
    NAME            STATUS   ROLES                      AGE   VERSION   Ready    worker                     36d   v1.20.11   Ready    controlplane,etcd,worker   36d   v1.20.11