variables:
stage:
- setup-k8s
setup-k8s:
stage: setup-k8s
script:
- sudo ufw disable
- sudo apt install selinux-utils
- sudo setenforce 0
- sudo bash -c 'echo 'SELINUX=disabled' > /etc/selinux/conifg'
- sudo bash -c 'echo '/usr/sbin/iptables -P FORWARD ACCEPT' >> /etc/rc.local'
- sudo iptables -P FORWARD ACCEPT
- sudo sed -i 's/.*swap.*/#&/' /etc/fstab
- |
sudo tee /etc/sysctl.d/k8s.conf <<-'EOF'
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
net.ipv4.ip_forward = 1
EOF
- sudo modprobe br_netfilter
- sudo sysctl --system
- sudo apt install -y apt-transport-https ca-certificates curl software-properties-common
- |
sudo su - && sudo curl -fsSL https://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | sudo apt-key add - && sudo apt install -y docker-ce && sudo add-apt-repository "deb [arch=amd64] https://mirrors.aliyun.com/docker-ce/linux/ubuntu $(lsb_release -cs) stable" && sudo apt update && sudo curl https://mirrors.aliyun.com/kubernetes/apt/doc/apt-key.gpg | sudo apt-key add -
- sudo curl -o kubernetes.list https://raw.githubusercontent.com/fofcn/go-devops/main/release/pipeline/k8s/aliyun-kubernetes.list
- sudo mv kubernetes.list /etc/apt/sources.list.d/kubernetes.list
- sudo apt update
- sudo apt-cache madison kubelet
- sudo apt-cache madison kubectl | grep 1.18.4-00
- sudo apt install -y kubelet=1.18.4-00 kubeadm=1.18.4-00 kubectl=1.18.4-00
- sudo systemctl enable kubelet
- sudo systemctl start kubelet
tag:
- cluster: test-cluster
node:
- test-node-1
Kubernetes Ubuntu 20安装(pipeline)(可逐行执行)
最新推荐文章于 2024-03-14 23:57:51 发布