[K8S&K3S]Single node deployment for K3S

Single node deployment for K3S

The content of this experiment is the experiment of K3S deployment with kubeadm single node in ubuntu18.04 2 core 4G memory environment

Environment Introduction

why use ubuntu ?

centos7 ubuntu18,.04 and win10 ,They are popular operating systems that support kbueadm

Our next experiment is a test under the same environment as K3S
K3s is not perfect for Centos and does not support Win10
so we use ubuntu18.04 to test.

why use 2core and 4G memory Run the configure ?

Because this is the limit min configure of one single k8s requirements.
But the k3s is requeirement 1core and 512MB to run.

Environment construction

I use vmvare in a Windows10 environment
Because the virtual machine environment for configuration upgrade cloning and server rollback is very convenient compared to the physical computer is more suitable for rapid experiments.

Of course, if you have the ability or try to choose a physical machine for the experiment

The experimental steps

  1. Start experimenting from remote SSH entry to the server
  2. install docker
    1. Due to the special network environment in China added by Aliyun, China's accelerated foreign users can not join -mirror Aliyun environment
curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun

It is recommended that the virtual machine after docker installation should be used for snapshot storage in subsequent experiments. We can quickly clone the current environment
2. Use the official script for the installation

curl -sfL https://get.k3s.io | sh -

K3s provides customized installation scripts for special environments for Chinese users

curl -sfL https://docs.rancher.cn/k3s/k3s-install.sh | INSTALL_K3S_MIRROR=cn sh -
  1. K3s USES Containerd as the container by default.
    For comparison with K8S, we used Docker

After installation, we need to adjust K3S 'service profile to switch K3S' default container engine from Containerd to Docker.

vim /etc/systemd/system/multi-user.target.wants/k3s.service

Here, we need to modify the value of ExecStart and change it to:

/usr/local/bin/k3s server --docker --no-deploy traefik
  1. Save the exit and execute the command to reload the new service configuration file
   systemctl daemon-reload

Restart k3s

service k3s restart
  1. Verify that the K3S cluster is ready
   k3s kubectl get node

if it is success we will see ready

NAME                  STATUS   ROLES    AGE     VERSION
k3s01.ilemonrain.io   Ready    <none>   3m34s   v1.14.1-k3s.4

Then, K3S cluster startup is successful.

  1. K3s can directly use the kubectl command in K8S
    kubectl get node
NAME                  STATUS   ROLES    AGE     VERSION
k3s01.ilemonrain.io   Ready    <none>   3m34s   v1.14.1-k3s.4

The experimental conclusion

### The installation script is very slow
use Chinese mirror that is so fast for me

curl -sfL https://docs.rancher.cn/k3s/k3s-install.sh | INSTALL_K3S_MIRROR=cn sh -

The default use of Containerd does not pull the image

Docker can be used to configure The Chinese environment mirror site