-
Notifications
You must be signed in to change notification settings - Fork 17
3. online deploy cluster
This project requires git
, make
, and vim
commands. You can install them by running the following command
# ubuntu
apt-get update
apt-get install git make -y
# centos
yum install git make vim -y
# Arch
pacman -Scc --noconfirm
pacman -Sy --noconfirm
pacman -S --noconfirm python3
pacman -S --noconfirm git make vim
pacman -S --noconfirm git make python-pip python3
This project uses branches to distinguish Kubernetes versions. If you want to deploy Kubernetes version 1.14, you should clone the v1.14
branch. For example, if you want to deploy Kubernetes version 1.27, you should run the following command.
git clone -b v1.27 https://github.com/buxiaomo/kubeasy.git /usr/local/src/kubeasy
cd /usr/local/src/kubeasy
make runtime
You can run the following command to create default Kubernetes parameters in the group_vars
directory. You can modify them if necessary
make -C group_vars/
The ./group_vars/all.yml
file includes the following settings
- timezone
- modprobe
- ipvs
- sysctl
- limits
The ./group_vars/kubernetes.yml
file includes the following settings
- docker
- containerd
- etcd
- kube-apiserver
- kube-controller-manager
- kube-scheduler
- kubelet
- kube-proxy
For more instructions reference inventory/README.md
for example:
# cd /usr/local/src/kubeasy
# make hosts
# cat inventory/${PROJECT_NAME}-${PROJECT_ENV}.ini
[master]
172.16.115.11
172.16.115.12
172.16.115.13
[worker]
172.16.115.14
[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", "mode": "ipvs"}
; 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.115.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 example:
# cd /usr/local/src/kubeasy
# make hosts
# cat inventory/${PROJECT_NAME}-${PROJECT_ENV}.ini
[master]
240e:369:7a65:d00:250:56ff:fe82:1a77
240e:369:7a65:d00:250:56ff:fe82:c3aa
240e:369:7a65:d00:250:56ff:fe82:9865
[worker]
240e:369:7a65:d00:250:56ff:fe82:ddd7
[kubernetes:children]
master
worker
[kubernetes:vars]
; kubernetes network config
networking={"dnsDomain": "cluster.local", "serviceSubnet": "fd00:10:96::/112", "podSubnet": "fd00:10:244::/64", "mode": "ipvs"}
; 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": "240e:369:7a65:d00:250:56ff:fe82:1111", "mask": 64 }
; 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 example:
# cd /usr/local/src/kubeasy
# make hosts
# cat inventory/${PROJECT_NAME}-${PROJECT_ENV}.ini
[master]
172.16.115.11 ipv6=fdcd:d1e9:f503:0:250:56ff:fe82:c2be
[worker]
172.16.115.12 ipv6=fdcd:d1e9:f503:0:250:56ff:fe82:bdb8
[kubernetes:children]
master
worker
[kubernetes:vars]
; kubernetes network config
networking={"dnsDomain": "cluster.local", "serviceSubnet": "10.96.0.0/12,2402:db8:42:d600::/112", "podSubnet": "10.244.0.0/16,2402:db8:42:d700::/64", "mode": "ipvs"}
; 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.115.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
if you can download file from google, you can skip this step, this step will download file from GitHub.
make prepare
make deploy
Run the following command to add asset information. Currently, only worker nodes can be expanded.
make hosts
Then execute the following command to expand the capacity, with parameters consistent with deploy, such as KUBE_VERSION
, KUBE_RUNTIME
, KUBE_NETWORK
, REGISTRY_URL
, etc
make scale
git pull
git checkout v1.28
make upgrade
make renew