Giter Club home page Giter Club logo

kubeasy's Introduction

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

kubeasy's People

Contributors

actions-user avatar buxiaomo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

kubeasy's Issues

[raspberrypi] error: Following Cgroup subsystem not mounted: [memory]

If OS is Ubuntu 20.04.4 LTS, add cgroup_enable=memory cgroup_memory=1 to /boot/firmware/cmdline.txt

like this

root@raspberrypi:/usr/local/src/kube-ansible# cat /boot/firmware/cmdline.txt
elevator=deadline net.ifnames=0 console=serial0,115200 dwc_otg.lpm_enable=0 console=tty1 root=LABEL=writable rootfstype=ext4 rootwait fixrtc quiet splash cgroup_enable=memory cgroup_memory=1

then reboot system

个人部署记录

#建议
至少应该把make deploy拆分成三个,否则一旦中间环节有错误,就要从头开始,漫长地等待。。。
1、prepare
2、master+worker(kube-apiserver+kubelet...)
3、add-on(calico+coredns+metric)


#bug:
1、含空格的文件
ll ./roles/chrony/vars/openSUSE\ Leap.yml

2、添加AlmaLinux9.0支持:
vim scripts/runtime.sh
添加
grep -Eq "AlmaLinux|almalinux" /etc/*-release

3、metrics报错:
error: resource mapping not found for name: "metrics-server" namespace: "kube-system" from "/etc/kubernetes/apps/metrics.yaml": no matches for kind "PodDisruptionBudget" in version "policy/v1beta1"
ensure CRDs are installed first

sed -i 's#policy/v1beta1#policy/v1#g' /usr/local/src/kubeasy/roles/add-on/templates/metrics.yaml.j2

4、calico问题
calico问题:

vim /usr/local/src/kubeasy/roles/add-on/templates/calico.yaml.j2
添加
- name: IP_AUTODETECTION_METHOD
value: "interface=ens.*"


####个人部署后,coredns+calico+metrics,没有一个是正常的。

[Bug]: Kubelet fails to start on Ubuntu 22.04 - Failed to start ContainerManager failed to get rootfs info: unable to find data in memory cache

Your Environment

Operating System: Ubuntu 22.04
Kubernetes version: v1.18.20
Kubernetes Container runtime: docker
Kubernetes Container networks: flannel

group_vars/all.yml file content?

default

group_vars/kubernetes.yml file ?

default

Context

No response

Log Information

Mar 07 19:57:09 vm117011 kubelet[25981]: F0307 19:57:09.159866   25981 kubelet.go:1399] Failed to start ContainerManager failed to get rootfs info: unable to find data in memory cache

更新这么频繁,太拼命了!

Your Environment

有没有QQ群可以讨论的地方

group_vars/all.yml file content?

.

group_vars/kubernetes.yml file ?

.

Context

.

Log Information

.

不支持多网卡

大量使用 ansible_default_ipv4.address 在多网卡下会有问题

harbor方面的需求

个人觉得应该增加一个安装选项:
将kubeasy-offline-v1.25.4.tar.gz的镜像推送至 本地Harbor 仓库(增加一个推送脚本)

   make deploy harbor_url=harbor.xxx.com

[Bug]: error: externally-managed-environment

Your Environment

Operating System: Ubuntu 23.10
Kubernetes version: 1.26
Kubernetes Container runtime: none
Kubernetes Container networks: none

group_vars/all.yml file content?

default

group_vars/kubernetes.yml file ?

default

Context

No response

Log Information

error: externally-managed-environment

× This environment is externally managed
╰─> To install Python packages system-wide, try apt install
    python3-xyz, where xyz is the package you are trying to
    install.

    If you wish to install a non-Debian-packaged Python package,
    create a virtual environment using python3 -m venv path/to/venv.
    Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make
    sure you have python3-full installed.

    If you wish to install a non-Debian packaged Python application,
    it may be easiest to use pipx install xyz, which will manage a
    virtual environment for you. Make sure you have pipx installed.

    See /usr/share/doc/python3.11/README.venv for more information.

Kubelet: mountpoint for cpu not found

systemd.unified_cgroup_hierarchy=0 to GRUB_CMDLINE_LINUX in /etc/default/grub.

After a update-grub2 && reboot or grub2-mkconfig -o /etc/grub2.cfg everything worked fine.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.