Skip to content

buxiaomo/kubeasy

Repository files navigation

kubeasy

This project will used ansible to deployment kubernetes.

Read the documentation to see how the project is used

kubeasy passed the cncf conformance test, because k8s-conformance does not allow submission of personal projects, please check here for details

Cloud Support

  • Raspberry Pi
  • Azure
  • Aliyun
  • Aws (APIServer HA use the CLB)
  • GCP (APIServer HA use the TCP Load balancing)

Architecture Support

  • aarch64 (only download from official)
  • x86_64

OS Support

all node please install python.

  • UnionTech OS
  • Arch Linux
  • CentOS (7.*, 8.*)
  • Ubuntu (16.*, 18.*, 20.*, 21.*, 22.*)
  • Debian (10.*, 11.*)
  • OpenSUSE 15
  • Alma Linux 9
  • Amazon Linux 2
  • Rocky Linux (8, 9)
  • Red Hat Enterprise Linux (7, 8)
  • SUSE Linux Enterprise Server 15

kubeasy installs the version corresponding to the k8s component

Kubernetes Etcd Docker Containerd CNI CoreDNS metrics-server pause
1.14.x v3.3.10 v19.03.9 v1.5.13 v0.7.5 v1.3.1 v0.5.2 3.1
1.15.x v3.3.10 v19.03.9 v1.5.13 v0.7.5 v1.3.1 v0.5.2 3.1
1.16.x v3.3.15 v19.03.9 v1.5.13 v0.7.5 v1.6.2 v0.5.2 3.1
1.17.x v3.4.3 v19.03.9 v1.5.13 v0.7.5 v1.6.5 v0.5.2 3.1
1.18.x v3.4.3 v19.03.9 v1.5.13 v0.8.5 v1.6.7 v0.5.2 3.2
1.19.x v3.4.13 v19.03.9 v1.5.13 v0.8.6 v1.7.0 v0.5.2 3.2
1.20.x v3.4.13 v19.03.9 v1.5.13 v0.8.7 v1.7.0 v0.6.1 3.2
1.21.x v3.4.13 v20.10.17 v1.5.13 v1.1.1 v1.8.0 v0.6.1 3.4.1
1.22.x v3.5.0 v20.10.17 v1.6.15 v1.1.1 v1.8.4 v0.6.2 3.5
1.23.x v3.5.1 v20.10.17 v1.6.15 v1.2.0 v1.8.6 v0.6.2 3.6
1.24.x v3.5.3 N/A v1.6.15 v1.2.0 v1.8.6 v0.6.2 3.6
1.25.x v3.5.4 N/A v1.6.15 v1.2.0 v1.9.3 v0.6.2 3.8
1.26.x v3.5.6 N/A v1.6.15 v1.2.0 v1.9.3 v0.6.2 3.9

How to use

The playbook depends on python2 or python3 , all nodes need to install python

online

Clone code

Gitee: https://gitee.com/buxiaomo/kubeasy.git

Gitlab: https://gitlab.com/buxiaomo/kubeasy.git

Github: https://github.com/buxiaomo/kubeasy.git

JiHulab: https://jihulab.com/buxiaomo/kubeasy.git

# ubuntu
apt-get update
apt-get install git make -y

# centos
yum install git make vim -y

# Install ansible
git clone -b v1.26 https://github.com/buxiaomo/kubeasy.git /usr/local/src/kubeasy
cd /usr/local/src/kubeasy

Install ansible

cd /usr/local/src/kubeasy
make runtime

Configuration parameters

Please modify the parameters on group_vars directory if you need

Configuration inventory

cd /usr/local/src/kubeasy
make hosts

for example:

[master]
172.16.114.11
172.16.114.12
172.16.114.13

[worker]
172.16.114.14
172.16.114.15
172.16.114.16
172.16.114.17

[kubernetes:children]
master
worker

[kubernetes:vars]
; kubernetes network config
networking={"dnsDomain": "cluster.local", "serviceSubnet": "10.96.0.0/12", "podSubnet": "10.244.0.0/16"}

; ha config
; slb is software load balancing, will install harpoxy and keepalived on master node
; clb is cloud load balancing, will use cloud load balancing
ha={"type": "slb", "vip": "172.16.114.10", "mask": 16 }

; loadBalancing is 4 layer forwarding to ingress by haproxy, only used in slb
loadBalancing={"http": {"src": 80, "dest": 30001}, "https": {"src": 443, "dest": 30002}}

[all:vars]
ansible_ssh_port=22
ansible_ssh_user=root
ansible_ssh_pass=root
# ansible_sudo_user=root
# ansible_sudo_pass=root

For more instructions reference inventory/README.md

Kubernetes management

Deploy

asciicast

cd /usr/local/src/kubeasy
make deploy
Scale

asciicast

cd /usr/local/src/kubeasy
make scale
Update kubernetes configuration
cd /usr/local/src/kubeasy
make update
Renew kubernetes certificates
cd /usr/local/src/kubeasy
make renew
Upgrade kubernetes version

For version upgrades, reference here

cd /usr/local/src/kubeasy
git pull
git checkout v1.27
make upgrade KUBE_VERSION=<New Version>

offline

Offline installation is divided into the following four files, Download the corresponding files for your needs.

  1. kubeasy-v${KUBEASY_VERSION}.tar.gz
    • software packages and Pod images will be downloaded from the Internet
  2. kubeasy-binary-v${KUBEASY_VERSION}.tar.gz
    • software packages required to deploy kubernetes
  3. kubeasy-registry-v${KUBEASY_VERSION}.tar.gz
    • Pod images required to deploy kubernetes
  4. kubeasy-offline-v${KUBEASY_VERSION}.tar.gz
    • Using Docker to run kubeasy, kubernetes can be installed completely offline

If use the kubeasy-offline-v${KUBEASY_VERSION}.tar.gz, you need a deployment server. docker restarts and the deployment container is aborted because the installed docker and kubeasy methods are different.

used kubeasy-binary or kubeasy-registry file

asciicast

KUBEASY_VERSION=1.26.0
wget https://github.com/buxiaomo/kubeasy/releases/download/v${KUBEASY_VERSION}/kubeasy-v${KUBEASY_VERSION}.tar.gz -O /usr/local/src/kubeasy-v${KUBEASY_VERSION}.tar.gz
tar -zxf /usr/local/src/kubeasy-v${KUBEASY_VERSION}.tar.gz -C /usr/local/src
wget https://github.com/buxiaomo/kubeasy/releases/download/v${KUBEASY_VERSION}/kubeasy-registry-v${KUBEASY_VERSION}.tar.gz -O /usr/local/src/kubeasy/scripts/src/kubeasy-registry-v${KUBEASY_VERSION}.tar.gz
wget https://github.com/buxiaomo/kubeasy/releases/download/v${KUBEASY_VERSION}/kubeasy-binary-v${KUBEASY_VERSION}.tar.gz -O /usr/local/src/kubeasy/scripts/src/kubeasy-binary-v${KUBEASY_VERSION}.tar.gz

cd /usr/local/src/kubeasy
ls -l ./scripts/src/
make runtime
make hosts
make prepare
make deploy REGISTRY_URL=http://<IP Addr>:5000

use kubeasy-offline

asciicast

KUBEASY_VERSION=1.26.0
wget https://github.com/buxiaomo/kubeasy/releases/download/v${KUBEASY_VERSION}/kubeasy-offline-v${KUBEASY_VERSION}.tar.gz -O /usr/local/src/kubeasy-offline-v${KUBEASY_VERSION}.tar.gz
tar -zxf /usr/local/src/kubeasy-offline-v${KUBEASY_VERSION}.tar.gz -C /usr/local/src
cd /usr/local/src/kubeasy-offline-v${KUBEASY_VERSION}
./main.sh

Known Issues

  • error: Following Cgroup subsystem not mounted: [memory], see here

knowledge