Rancher Kubernetes Engine (RKE) installation - A single-node RKE cluster

Rancher Kubernetes Engine (RKE) installation - A single-node RKE cluster

In this article we will learn how to install RKE single node cluster.

Rancher Kubernetes Engine (RKE) is a fully Docker-based Kubernetes distribution that has received CNCF certification. By eliminating the majority of host requirements and providing a consistent path for deployment, upgrades, and rollbacks, it resolves the usual annoyance associated with Kubernetes installation complexity.

RKE makes it simple to automate Kubernetes' functioning, which is also totally independent of the platform and operating system you're using. You can deploy and use Kubernetes with RKE as long as you can run a supported version of Docker. It quickly creates a cluster with a single command, and Kubernetes upgrades are atomic and safe because to its declarative setup.

Rancher's command-line tool for setting up, maintaining, and updating Kubernetes clusters is known as RKE, or Rancher Kubernetes Engine. You may run rke up and have RKE construct a Kubernetes cluster based on the information you gave in your setup by producing a straightforward YAML cluster configuration file, which is called cluster.yml by default. New users frequently believe that RKE will handle Rancher installation for them. RKE is utilised by Rancher internally, but it may also be used independently to build Kubernetes clusters.

Like Rancher, RKE is developed in Golang and will speak to the nodes using the built-in libraries. This means that all you need to install locally to start your cluster is the RKE binary. After authenticating with the specified user and SSH private key and connecting to the host's Docker instance via the socket file, RKE will connect to the cluster hosts using a local SSH library (made accessible through SSH with socket forwarding). The containers necessary to set up the cluster will then be launched using the Docker socket.

SUSE, a leading open source innovator, acquired Rancher in 2020.

Install helm

prayag2223@rke-rancher-server:~$ curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3
prayag2223@rke-rancher-server:~$ chmod 700 get_helm.sh
prayag2223@rke-rancher-server:~$ ./get_helm.sh
Downloading https://get.helm.sh/helm-v3.9.4-linux-amd64.tar.gz
Verifying checksum... Done.
Preparing to install helm into /usr/local/bin
helm installed into /usr/local/bin/helm
prayag2223@rke-rancher-server:~$ which helm
/usr/local/bin/helm
prayag2223@rke-rancher-server:~$ helm version
version.BuildInfo{Version:"v3.9.4", GitCommit:"dbc6d8e20fe1d58d50e6ed30f09a04a77e4c68db", GitTreeState:"clean", GoVersion:"go1.17.13"}
prayag2223@rke-rancher-server:~$        

Install kubectl


prayag2223@rke-rancher-server:~$ curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
? % Total? ? % Received % Xferd? Average Speed? ?Time? ? Time? ? ?Time? Current
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?Dload? Upload? ?Total? ?Spent? ? Left? Speed
100? ?138? 100? ?138? ? 0? ? ?0? ?2421? ? ? 0 --:--:-- --:--:-- --:--:--? 2464
100 42.9M? 100 42.9M? ? 0? ? ?0? ?135M? ? ? 0 --:--:-- --:--:-- --:--:--? 135M
prayag2223@rke-rancher-server:~$ sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl
prayag2223@rke-rancher-server:~$ chmod +x kubectl
prayag2223@rke-rancher-server:~$ mkdir -p ~/.local/bin
prayag2223@rke-rancher-server:~$ mv ./kubectl ~/.local/bin/kubectl
prayag2223@rke-rancher-server:~$ kubectl version --client
WARNING: This version information is deprecated and will be replaced with the output from kubectl version --short.? Use --output=yaml|json to get the full version.
Client Version: version.Info{Major:"1", Minor:"25", GitVersion:"v1.25.1", GitCommit:"e4d4e1ab7cf1bf15273ef97303551b279f0920a9", GitTreeState:"clean", BuildDate:"2022-09-14T19:49:27Z", GoVersion:"go1.19.1", Compiler:"gc", Platform:"linux/amd64"}
Kustomize Version: v4.5.7
prayag2223@rke-rancher-server:~$ which kubectl
/usr/local/bin/kubectl
prayag2223@rke-rancher-server:~$ kubectl version
WARNING: This version information is deprecated and will be replaced with the output from kubectl version --short.? Use --output=yaml|json to get the full version.
Client Version: version.Info{Major:"1", Minor:"25", GitVersion:"v1.25.1", GitCommit:"e4d4e1ab7cf1bf15273ef97303551b279f0920a9", GitTreeState:"clean", BuildDate:"2022-09-14T19:49:27Z", GoVersion:"go1.19.1", Compiler:"gc", Platform:"linux/amd64"}
Kustomize Version: v4.5.7
The connection to the server localhost:8080 was refused - did you specify the right host or port?
prayag2223@rke-rancher-server:~$?
        

Download RKE


prayag2223@rke-rancher-server:~$ curl -LO https://github.com/rancher/rke/releases/download/v1.3.14/rke_linux-amd64
? % Total? ? % Received % Xferd? Average Speed? ?Time? ? Time? ? ?Time? Current
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?Dload? Upload? ?Total? ?Spent? ? Left? Speed
? 0? ? ?0? ? 0? ? ?0? ? 0? ? ?0? ? ? 0? ? ? 0 --:--:-- --:--:-- --:--:--? ? ?0
100 51.9M? 100 51.9M? ? 0? ? ?0? 20.2M? ? ? 0? 0:00:02? 0:00:02 --:--:-- 27.6M
prayag2223@rke-rancher-server:~$?
        

Copy RKE to /usr/local/bin


prayag2223@rke-rancher-server:~$ mv rke_linux-amd64 rke
prayag2223@rke-rancher-server:~$ chmod +x rke
prayag2223@rke-rancher-server:~$ mv rke /usr/local/bin
prayag2223@rke-rancher-server:~$ which rke
/usr/local/bin/rke
prayag2223@rke-rancher-server:~$ rke --version
rke version v1.3.14
prayag2223@rke-rancher-server:~$?
        

Create ssh pair


prayag2223@rke-rancher-server:~$ ssh-keygen -t rsa -b 4096
Generating public/private rsa key pair.
Enter file in which to save the key (/home/prayag2223/.ssh/id_rsa):?
Enter passphrase (empty for no passphrase):?
Enter same passphrase again:?
Your identification has been saved in /home/prayag2223/.ssh/id_rsa
Your public key has been saved in /home/prayag2223/.ssh/id_rsa.pub
The key fingerprint is:
SHA256:mrYtpFozDXtXDMGupHestFVdgUNJgMgi8ocPPxzPvks prayag2223@rke-rancher-server
The key's randomart image is:
+---[RSA 4096]----+
|? ? ?. o...+oo.. |
|. . . o o.? + .? |
| o o . ..? . o? ?|
|? + o . .o. .? ? |
|? ?*.* oS.o? ? ? |
|? ? *+Bo+.? ? ? ?|
|? ? =BE=.? ? ? ? |
|? ?..*=+? ? ? ? ?|
|? ..? ++.? ? ? ? |
+----[SHA256]-----+
prayag2223@rke-rancher-server:~$?
        

Install docker


prayag2223@rke-rancher-server:~$ sudo apt update
prayag2223@rke-rancher-server:~$ sudo apt -y install docker.io
        

To deploy the cluster, we must create a configuration file called "cluster.yml."To generate the cluster.yml file, run "rke config" and then respond to the prompts. This file contains all the relevant information, such as node connection information and the responsibilities that should be given to each node, such as controlplane, etcd, and worker. As many nodes as are required should be created; in this example, only one node is utilised.


prayag2223@rke-rancher-server:~$ rke config --name cluster.yml
[+] Cluster Level SSH Private Key Path [~/.ssh/id_rsa]:?
[+] Number of Hosts [1]:?
[+] SSH Address of host (1) [none]: 10.182.0.5
[+] SSH Port of host (1) [22]:?
[+] SSH Private Key Path of host () [none]:?
[-] You have entered empty SSH key path, trying fetch from SSH key parameter
[+] SSH Private Key of host () [none]:?
[-] You have entered empty SSH key, defaulting to cluster level SSH key: ~/.ssh/id_rsa
[+] SSH User of host () [ubuntu]: prayag2223
[+] Is host () a Control Plane host (y/n)? [y]:?
[+] Is host () a Worker host (y/n)? [n]: y
[+] Is host () an etcd host (y/n)? [n]: y
[+] Override Hostname of host () [none]:?
[+] Internal IP of host () [none]: 10.182.0.5
[+] Docker socket path on host () [/var/run/docker.sock]:?
[+] Network Plugin Type (flannel, calico, weave, canal, aci) [canal]:?
[+] Authentication Strategy [x509]:?
[+] Authorization Mode (rbac, none) [rbac]:?
[+] Kubernetes Docker image [rancher/hyperkube:v1.24.4-rancher1]:?
[+] Cluster domain [cluster.local]:?
[+] Service Cluster IP Range [10.43.0.0/16]:?
[+] Enable PodSecurityPolicy [n]:?
[+] Cluster Network CIDR [10.42.0.0/16]:?
[+] Cluster DNS Service IP [10.43.0.10]:?
[+] Add addon manifest URLs or YAML files [no]:?
prayag2223@rke-rancher-server:~$?
        

Build RKE single node cluster


prayag2223@rke-rancher-server:~$ rke up
INFO[0000] Running RKE version: v1.3.14? ? ? ? ? ? ? ? ?
INFO[0000] Initiating Kubernetes cluster? ? ? ? ? ? ? ??
INFO[0000] [certificates] GenerateServingCertificate is disabled, checking if there are unused kubelet certificates?
INFO[0000] [certificates] Generating admin certificates and kubeconfig?
INFO[0000] Successfully Deployed state file at [./cluster.rkestate]?
INFO[0000] Building Kubernetes cluster? ? ? ? ? ? ? ? ??
INFO[0000] [dialer] Setup tunnel for host [10.182.0.5]??
INFO[0000] [network] Deploying port listener containers?
INFO[0000] Pulling image [rancher/rke-tools:v0.1.87] on host [10.182.0.5], try #1?
INFO[0008] Image [rancher/rke-tools:v0.1.87] exists on host [10.182.0.5]?
INFO[0010] Starting container [rke-etcd-port-listener] on host [10.182.0.5], try #1?
INFO[0011] [network] Successfully started [rke-etcd-port-listener] container on host [10.182.0.5]?
INFO[0011] Image [rancher/rke-tools:v0.1.87] exists on host [10.182.0.5]?
INFO[0011] Starting container [rke-cp-port-listener] on host [10.182.0.5], try #1?
INFO[0012] [network] Successfully started [rke-cp-port-listener] container on host [10.182.0.5]?
INFO[0012] Image [rancher/rke-tools:v0.1.87] exists on host [10.182.0.5]?
INFO[0012] Starting container [rke-worker-port-listener] on host [10.182.0.5], try #1?
INFO[0013] [network] Successfully started [rke-worker-port-listener] container on host [10.182.0.5]?
INFO[0013] [network] Port listener containers deployed successfully?
INFO[0013] [network] Running control plane -> etcd port checks?
INFO[0013] [network] Checking if host [10.182.0.5] can connect to host(s) [10.182.0.5] on port(s) [2379], try #1?
INFO[0013] Image [rancher/rke-tools:v0.1.87] exists on host [10.182.0.5]?
INFO[0013] Starting container [rke-port-checker] on host [10.182.0.5], try #1?
INFO[0013] [network] Successfully started [rke-port-checker] container on host [10.182.0.5]?
INFO[0013] Removing container [rke-port-checker] on host [10.182.0.5], try #1?
INFO[0013] [network] Running control plane -> worker port checks?
INFO[0013] [network] Checking if host [10.182.0.5] can connect to host(s) [10.182.0.5] on port(s) [10250], try #1?
INFO[0013] Image [rancher/rke-tools:v0.1.87] exists on host [10.182.0.5]?
INFO[0014] Starting container [rke-port-checker] on host [10.182.0.5], try #1?
INFO[0014] [network] Successfully started [rke-port-checker] container on host [10.182.0.5]?
INFO[0014] Removing container [rke-port-checker] on host [10.182.0.5], try #1?
INFO[0014] [network] Running workers -> control plane port checks?
INFO[0014] [network] Checking if host [10.182.0.5] can connect to host(s) [10.182.0.5] on port(s) [6443], try #1?
INFO[0014] Image [rancher/rke-tools:v0.1.87] exists on host [10.182.0.5]?
INFO[0015] Starting container [rke-port-checker] on host [10.182.0.5], try #1?
INFO[0015] [network] Successfully started [rke-port-checker] container on host [10.182.0.5]?
INFO[0015] Removing container [rke-port-checker] on host [10.182.0.5], try #1?
INFO[0015] [network] Checking KubeAPI port Control Plane hosts?
INFO[0015] [network] Removing port listener containers??
INFO[0015] Removing container [rke-etcd-port-listener] on host [10.182.0.5], try #1?
INFO[0015] [remove/rke-etcd-port-listener] Successfully removed container on host [10.182.0.5]?
INFO[0015] Removing container [rke-cp-port-listener] on host [10.182.0.5], try #1?
INFO[0015] [remove/rke-cp-port-listener] Successfully removed container on host [10.182.0.5]?
INFO[0015] Removing container [rke-worker-port-listener] on host [10.182.0.5], try #1?
INFO[0016] [remove/rke-worker-port-listener] Successfully removed container on host [10.182.0.5]?
INFO[0016] [network] Port listener containers removed successfully?
INFO[0016] [certificates] Deploying kubernetes certificates to Cluster nodes?
INFO[0016] Finding container [cert-deployer] on host [10.182.0.5], try #1?
INFO[0016] Image [rancher/rke-tools:v0.1.87] exists on host [10.182.0.5]?
INFO[0016] Starting container [cert-deployer] on host [10.182.0.5], try #1?
INFO[0017] Finding container [cert-deployer] on host [10.182.0.5], try #1?
INFO[0022] Finding container [cert-deployer] on host [10.182.0.5], try #1?
INFO[0022] Removing container [cert-deployer] on host [10.182.0.5], try #1?
INFO[0022] [reconcile] Rebuilding and updating local kube config?
INFO[0022] Successfully Deployed local admin kubeconfig at [./kube_config_cluster.yml]?
WARN[0022] [reconcile] host [10.182.0.5] is a control plane node without reachable Kubernetes API endpoint in the cluster?
WARN[0022] [reconcile] no control plane node with reachable Kubernetes API endpoint in the cluster found?
INFO[0022] [certificates] Successfully deployed kubernetes certificates to Cluster nodes?
INFO[0022] [file-deploy] Deploying file [/etc/kubernetes/audit-policy.yaml] to node [10.182.0.5]?
INFO[0022] Image [rancher/rke-tools:v0.1.87] exists on host [10.182.0.5]?
INFO[0022] Starting container [file-deployer] on host [10.182.0.5], try #1?
INFO[0022] Successfully started [file-deployer] container on host [10.182.0.5]?
INFO[0022] Waiting for [file-deployer] container to exit on host [10.182.0.5]?
INFO[0022] Waiting for [file-deployer] container to exit on host [10.182.0.5]?
INFO[0022] Container [file-deployer] is still running on host [10.182.0.5]: stderr: [], stdout: []?
INFO[0023] Removing container [file-deployer] on host [10.182.0.5], try #1?
INFO[0023] [remove/file-deployer] Successfully removed container on host [10.182.0.5]?
INFO[0023] [/etc/kubernetes/audit-policy.yaml] Successfully deployed audit policy file to Cluster control nodes?
INFO[0023] [reconcile] Reconciling cluster state? ? ? ??
INFO[0023] [reconcile] This is newly generated cluster??
INFO[0023] Pre-pulling kubernetes images? ? ? ? ? ? ? ??
INFO[0023] Pulling image [rancher/hyperkube:v1.24.4-rancher1] on host [10.182.0.5], try #1?
INFO[0080] Image [rancher/hyperkube:v1.24.4-rancher1] exists on host [10.182.0.5]?
INFO[0080] Kubernetes images pulled successfully? ? ? ??
INFO[0080] [etcd] Building up etcd plane..? ? ? ? ? ? ??
INFO[0080] Image [rancher/rke-tools:v0.1.87] exists on host [10.182.0.5]?
INFO[0086] Starting container [etcd-fix-perm] on host [10.182.0.5], try #1?
INFO[0087] Successfully started [etcd-fix-perm] container on host [10.182.0.5]?
INFO[0087] Waiting for [etcd-fix-perm] container to exit on host [10.182.0.5]?
INFO[0087] Waiting for [etcd-fix-perm] container to exit on host [10.182.0.5]?
INFO[0087] Container [etcd-fix-perm] is still running on host [10.182.0.5]: stderr: [], stdout: []?
INFO[0088] Removing container [etcd-fix-perm] on host [10.182.0.5], try #1?
INFO[0088] [remove/etcd-fix-perm] Successfully removed container on host [10.182.0.5]?
INFO[0088] Pulling image [rancher/mirrored-coreos-etcd:v3.5.4] on host [10.182.0.5], try #1?
INFO[0095] Image [rancher/mirrored-coreos-etcd:v3.5.4] exists on host [10.182.0.5]?
INFO[0096] Starting container [etcd] on host [10.182.0.5], try #1?
INFO[0096] [etcd] Successfully started [etcd] container on host [10.182.0.5]?
INFO[0096] [etcd] Running rolling snapshot container [etcd-snapshot-once] on host [10.182.0.5]?
INFO[0096] Image [rancher/rke-tools:v0.1.87] exists on host [10.182.0.5]?
INFO[0097] Starting container [etcd-rolling-snapshots] on host [10.182.0.5], try #1?
INFO[0097] [etcd] Successfully started [etcd-rolling-snapshots] container on host [10.182.0.5]?
INFO[0102] Image [rancher/rke-tools:v0.1.87] exists on host [10.182.0.5]?
INFO[0102] Starting container [rke-bundle-cert] on host [10.182.0.5], try #1?
INFO[0103] [certificates] Successfully started [rke-bundle-cert] container on host [10.182.0.5]?
INFO[0103] Waiting for [rke-bundle-cert] container to exit on host [10.182.0.5]?
INFO[0103] [certificates] successfully saved certificate bundle [/opt/rke/etcd-snapshots//pki.bundle.tar.gz] on host [10.182.0.5]?
INFO[0103] Removing container [rke-bundle-cert] on host [10.182.0.5], try #1?
INFO[0103] Image [rancher/rke-tools:v0.1.87] exists on host [10.182.0.5]?
INFO[0104] Starting container [rke-log-linker] on host [10.182.0.5], try #1?
INFO[0104] [etcd] Successfully started [rke-log-linker] container on host [10.182.0.5]?
INFO[0104] Removing container [rke-log-linker] on host [10.182.0.5], try #1?
INFO[0104] [remove/rke-log-linker] Successfully removed container on host [10.182.0.5]?
INFO[0104] Image [rancher/rke-tools:v0.1.87] exists on host [10.182.0.5]?
INFO[0105] Starting container [rke-log-linker] on host [10.182.0.5], try #1?
INFO[0105] [etcd] Successfully started [rke-log-linker] container on host [10.182.0.5]?
INFO[0105] Removing container [rke-log-linker] on host [10.182.0.5], try #1?
INFO[0105] [remove/rke-log-linker] Successfully removed container on host [10.182.0.5]?
INFO[0105] [etcd] Successfully started etcd plane.. Checking etcd cluster health?
INFO[0106] [etcd] etcd host [10.182.0.5] reported healthy=true?
INFO[0106] [controlplane] Building up Controller Plane..?
INFO[0106] Finding container [service-sidekick] on host [10.182.0.5], try #1?
INFO[0106] Image [rancher/rke-tools:v0.1.87] exists on host [10.182.0.5]?
INFO[0106] Image [rancher/hyperkube:v1.24.4-rancher1] exists on host [10.182.0.5]?
INFO[0106] Starting container [kube-apiserver] on host [10.182.0.5], try #1?
INFO[0106] [controlplane] Successfully started [kube-apiserver] container on host [10.182.0.5]?
INFO[0106] [healthcheck] Start Healthcheck on service [kube-apiserver] on host [10.182.0.5]?
INFO[0115] [healthcheck] service [kube-apiserver] on host [10.182.0.5] is healthy?
INFO[0115] Image [rancher/rke-tools:v0.1.87] exists on host [10.182.0.5]?
INFO[0116] Starting container [rke-log-linker] on host [10.182.0.5], try #1?
INFO[0116] [controlplane] Successfully started [rke-log-linker] container on host [10.182.0.5]?
INFO[0116] Removing container [rke-log-linker] on host [10.182.0.5], try #1?
INFO[0116] [remove/rke-log-linker] Successfully removed container on host [10.182.0.5]?
INFO[0116] Image [rancher/hyperkube:v1.24.4-rancher1] exists on host [10.182.0.5]?
INFO[0116] Starting container [kube-controller-manager] on host [10.182.0.5], try #1?
INFO[0117] [controlplane] Successfully started [kube-controller-manager] container on host [10.182.0.5]?
INFO[0117] [healthcheck] Start Healthcheck on service [kube-controller-manager] on host [10.182.0.5]?
INFO[0123] [healthcheck] service [kube-controller-manager] on host [10.182.0.5] is healthy?
INFO[0123] Image [rancher/rke-tools:v0.1.87] exists on host [10.182.0.5]?
INFO[0123] Starting container [rke-log-linker] on host [10.182.0.5], try #1?
INFO[0123] [controlplane] Successfully started [rke-log-linker] container on host [10.182.0.5]?
INFO[0124] Removing container [rke-log-linker] on host [10.182.0.5], try #1?
INFO[0124] [remove/rke-log-linker] Successfully removed container on host [10.182.0.5]?
INFO[0124] Image [rancher/hyperkube:v1.24.4-rancher1] exists on host [10.182.0.5]?
INFO[0124] Starting container [kube-scheduler] on host [10.182.0.5], try #1?
INFO[0124] [controlplane] Successfully started [kube-scheduler] container on host [10.182.0.5]?
INFO[0124] [healthcheck] Start Healthcheck on service [kube-scheduler] on host [10.182.0.5]?
INFO[0129] [healthcheck] service [kube-scheduler] on host [10.182.0.5] is healthy?
INFO[0129] Image [rancher/rke-tools:v0.1.87] exists on host [10.182.0.5]?
INFO[0130] Starting container [rke-log-linker] on host [10.182.0.5], try #1?
INFO[0130] [controlplane] Successfully started [rke-log-linker] container on host [10.182.0.5]?
INFO[0130] Removing container [rke-log-linker] on host [10.182.0.5], try #1?
INFO[0131] [remove/rke-log-linker] Successfully removed container on host [10.182.0.5]?
INFO[0131] [controlplane] Successfully started Controller Plane..?
INFO[0131] [authz] Creating rke-job-deployer ServiceAccount?
INFO[0131] [authz] rke-job-deployer ServiceAccount created successfully?
INFO[0131] [authz] Creating system:node ClusterRoleBinding?
INFO[0131] [authz] system:node ClusterRoleBinding created successfully?
INFO[0131] [authz] Creating kube-apiserver proxy ClusterRole and ClusterRoleBinding?
INFO[0131] [authz] kube-apiserver proxy ClusterRole and ClusterRoleBinding created successfully?
INFO[0131] Successfully Deployed state file at [./cluster.rkestate]?
INFO[0131] [state] Saving full cluster state to Kubernetes?
INFO[0131] [state] Successfully Saved full cluster state to Kubernetes ConfigMap: full-cluster-state?
INFO[0131] [worker] Building up Worker Plane..? ? ? ? ??
INFO[0131] Finding container [service-sidekick] on host [10.182.0.5], try #1?
INFO[0131] [sidekick] Sidekick container already created on host [10.182.0.5]?
INFO[0131] Image [rancher/hyperkube:v1.24.4-rancher1] exists on host [10.182.0.5]?
INFO[0131] Starting container [kubelet] on host [10.182.0.5], try #1?
INFO[0131] [worker] Successfully started [kubelet] container on host [10.182.0.5]?
INFO[0131] [healthcheck] Start Healthcheck on service [kubelet] on host [10.182.0.5]?
INFO[0148] [healthcheck] service [kubelet] on host [10.182.0.5] is healthy?
INFO[0148] Image [rancher/rke-tools:v0.1.87] exists on host [10.182.0.5]?
INFO[0149] Starting container [rke-log-linker] on host [10.182.0.5], try #1?
INFO[0149] [worker] Successfully started [rke-log-linker] container on host [10.182.0.5]?
INFO[0149] Removing container [rke-log-linker] on host [10.182.0.5], try #1?
INFO[0149] [remove/rke-log-linker] Successfully removed container on host [10.182.0.5]?
INFO[0149] Image [rancher/hyperkube:v1.24.4-rancher1] exists on host [10.182.0.5]?
INFO[0149] Starting container [kube-proxy] on host [10.182.0.5], try #1?
INFO[0149] [worker] Successfully started [kube-proxy] container on host [10.182.0.5]?
INFO[0149] [healthcheck] Start Healthcheck on service [kube-proxy] on host [10.182.0.5]?
INFO[0150] [healthcheck] service [kube-proxy] on host [10.182.0.5] is healthy?
INFO[0150] Image [rancher/rke-tools:v0.1.87] exists on host [10.182.0.5]?
INFO[0151] Starting container [rke-log-linker] on host [10.182.0.5], try #1?
INFO[0151] [worker] Successfully started [rke-log-linker] container on host [10.182.0.5]?
INFO[0151] Removing container [rke-log-linker] on host [10.182.0.5], try #1?
INFO[0151] [remove/rke-log-linker] Successfully removed container on host [10.182.0.5]?
INFO[0151] [worker] Successfully started Worker Plane..?
INFO[0151] Image [rancher/rke-tools:v0.1.87] exists on host [10.182.0.5]?
INFO[0152] Starting container [rke-log-cleaner] on host [10.182.0.5], try #1?
INFO[0152] [cleanup] Successfully started [rke-log-cleaner] container on host [10.182.0.5]?
INFO[0152] Removing container [rke-log-cleaner] on host [10.182.0.5], try #1?
INFO[0152] [remove/rke-log-cleaner] Successfully removed container on host [10.182.0.5]?
INFO[0152] [sync] Syncing nodes Labels and Taints? ? ? ?
INFO[0152] [sync] Successfully synced nodes Labels and Taints?
INFO[0152] [network] Setting up network plugin: canal? ?
INFO[0152] [addons] Saving ConfigMap for addon rke-network-plugin to Kubernetes?
INFO[0153] [addons] Successfully saved ConfigMap for addon rke-network-plugin to Kubernetes?
INFO[0153] [addons] Executing deploy job rke-network-plugin?
INFO[0163] [addons] Setting up coredns? ? ? ? ? ? ? ? ??
INFO[0163] [addons] Saving ConfigMap for addon rke-coredns-addon to Kubernetes?
INFO[0163] [addons] Successfully saved ConfigMap for addon rke-coredns-addon to Kubernetes?
INFO[0163] [addons] Executing deploy job rke-coredns-addon?
INFO[0173] [addons] CoreDNS deployed successfully? ? ? ?
INFO[0173] [dns] DNS provider coredns deployed successfully?
INFO[0173] [addons] Setting up Metrics Server? ? ? ? ? ?
INFO[0173] [addons] Saving ConfigMap for addon rke-metrics-addon to Kubernetes?
INFO[0173] [addons] Successfully saved ConfigMap for addon rke-metrics-addon to Kubernetes?
INFO[0173] [addons] Executing deploy job rke-metrics-addon?
INFO[0183] [addons] Metrics Server deployed successfully?
INFO[0183] [ingress] Setting up nginx ingress controller?
INFO[0183] [ingress] removing admission batch jobs if they exist?
INFO[0183] [addons] Saving ConfigMap for addon rke-ingress-controller to Kubernetes?
INFO[0183] [addons] Successfully saved ConfigMap for addon rke-ingress-controller to Kubernetes?
INFO[0183] [addons] Executing deploy job rke-ingress-controller?
INFO[0198] [ingress] removing default backend service and deployment if they exist?
INFO[0198] [ingress] ingress controller nginx deployed successfully?
INFO[0198] [addons] Setting up user addons? ? ? ? ? ? ??
INFO[0198] [addons] no user addons defined? ? ? ? ? ? ??

INFO[0198] Finished building Kubernetes cluster successfully?
prayag2223@rke-rancher-server:~$?
        

Kubeconfig file configuration to access the cluster?


prayag2223@rke-rancher-server:~$ ls
cluster.rkestate? cluster.yml? get_helm.sh? kube_config_cluster.yml
prayag2223@rke-rancher-server:~$ mkdir .kube
prayag2223@rke-rancher-server:~$ cp kube_config_cluster.yml /$HOME/.kube/config
prayag2223@rke-rancher-server:~$ ls -ld .kube/config?
-rw------- 1 prayag2223 prayag2223 5501 Sep 16 11:53 .kube/config
        

Get Kubernetes node details


prayag2223@rke-rancher-server:~$ kubectl get nodes
NAME? ? ? ? ?STATUS? ?ROLES? ? ? ? ? ? ? ? ? ? ? AGE? ? ?VERSION
10.182.0.5? ?Ready? ? controlplane,etcd,worker? ?5m49s? ?v1.24.4
prayag2223@rke-rancher-server:~$ kubectl get nodes -o wide
NAME? ? ? ? ?STATUS? ?ROLES? ? ? ? ? ? ? ? ? ? ? AGE? ? ?VERSION? ?INTERNAL-IP? ?EXTERNAL-IP? ?OS-IMAGE? ? ? ? ? ? ?KERNEL-VERSION? ? CONTAINER-RUNTIME
10.182.0.5? ?Ready? ? controlplane,etcd,worker? ?5m55s? ?v1.24.4? ?10.182.0.5? ? <none>? ? ? ? Ubuntu 20.04.5 LTS? ?5.15.0-1017-gcp? ?docker://20.10.12
prayag2223@rke-rancher-server:~$?
        

Deployment of http server to check if the cluster is working


prayag2223@rke-rancher-server:~$ kubectl create deployment http-server --image=httpd
deployment.apps/http-server created
prayag2223@rke-rancher-server:~$


prayag2223@rke-rancher-server:~$ kubectl create service nodeport http-server --tcp=80:80
service/http-server created
prayag2223@rke-rancher-server:~$ kubectl get all
NAME? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?READY? ?STATUS? ? RESTARTS? ?AGE
pod/http-server-6bdc55d74d-lrrb4? ?1/1? ? ?Running? ?0? ? ? ? ? 3m49s


NAME? ? ? ? ? ? ? ? ? TYPE? ? ? ? CLUSTER-IP? ? ? EXTERNAL-IP? ?PORT(S)? ? ? ? AGE
service/http-server? ?NodePort? ? 10.43.210.205? ?<none>? ? ? ? 80:31910/TCP? ?6s
service/kubernetes? ? ClusterIP? ?10.43.0.1? ? ? ?<none>? ? ? ? 443/TCP? ? ? ? 21m


NAME? ? ? ? ? ? ? ? ? ? ? ? ? READY? ?UP-TO-DATE? ?AVAILABLE? ?AGE
deployment.apps/http-server? ?1/1? ? ?1? ? ? ? ? ? 1? ? ? ? ? ?3m49s


NAME? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?DESIRED? ?CURRENT? ?READY? ?AGE
replicaset.apps/http-server-6bdc55d74d? ?1? ? ? ? ?1? ? ? ? ?1? ? ? ?3m49s
prayag2223@rke-rancher-server:~$ curl localhost:31910
<html><body><h1>It works!</h1></body></html>
prayag2223@rke-rancher-server:~$?
        

One more example - Deployment of nginx server to check if the cluster is working


prayag2223@rke-rancher-server:~$ kubectl create deployment nginx-depl --image=nginx:1.19
deployment.apps/nginx-depl created
prayag2223@rke-rancher-server:~$ kubectl create service nodeport nginx-depl --tcp=80:80
service/nginx-depl created
prayag2223@rke-rancher-server:~$ kubectl get all
NAME? ? ? ? ? ? ? ? ? ? ? ? ? ? ? READY? ?STATUS? ? RESTARTS? ?AGE
pod/nginx-depl-55584b6fcf-lqnql? ?1/1? ? ?Running? ?0? ? ? ? ? 29s


NAME? ? ? ? ? ? ? ? ?TYPE? ? ? ? CLUSTER-IP? ? EXTERNAL-IP? ?PORT(S)? ? ? ? AGE
service/kubernetes? ?ClusterIP? ?10.43.0.1? ? ?<none>? ? ? ? 443/TCP? ? ? ? 26m
service/nginx-depl? ?NodePort? ? 10.43.12.59? ?<none>? ? ? ? 80:32043/TCP? ?5s


NAME? ? ? ? ? ? ? ? ? ? ? ? ?READY? ?UP-TO-DATE? ?AVAILABLE? ?AGE
deployment.apps/nginx-depl? ?1/1? ? ?1? ? ? ? ? ? 1? ? ? ? ? ?29s


NAME? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? DESIRED? ?CURRENT? ?READY? ?AGE
replicaset.apps/nginx-depl-55584b6fcf? ?1? ? ? ? ?1? ? ? ? ?1? ? ? ?29s
prayag2223@rke-rancher-server:~$ curl localhost:32043
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>
? ? body {
? ? ? ? width: 35em;
? ? ? ? margin: 0 auto;
? ? ? ? font-family: Tahoma, Verdana, Arial, sans-serif;
? ? }
</style>
</head>
<body>
<h1>Welcome to nginx!</h1>
<p>If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.</p>


<p>For online documentation and support please refer to
<a >nginx.org</a>.<br/>
Commercial support is available at
<a >nginx.com</a>.</p>


<p><em>Thank you for using nginx.</em></p>
</body>
</html>
prayag2223@rke-rancher-server:~$
        

I hope you found this to be useful in some way. I’ll be back with some more interesting new Kubernetes, Cloud and Devops articles soon.

Jairo Queiroz

LPIC-3 | CKA | IT Analyst

1 年

How to setup with containerd instead of docker?

要查看或添加评论,请登录

社区洞察

其他会员也浏览了