配置下载源仅供参考
cat sources.list |grep -v '#'
deb http://mirrors.cloud.aliyuncs.com/ubuntu/ xenial main restricted
deb-src http://mirrors.cloud.aliyuncs.com/ubuntu/ xenial main restricted
deb http://mirrors.cloud.aliyuncs.com/ubuntu/ xenial-updates main restricted
deb-src http://mirrors.cloud.aliyuncs.com/ubuntu/ xenial-updates main restricted
deb http://mirrors.cloud.aliyuncs.com/ubuntu/ xenial universe
deb-src http://mirrors.cloud.aliyuncs.com/ubuntu/ xenial universe
deb http://mirrors.cloud.aliyuncs.com/ubuntu/ xenial-updates universe
deb-src http://mirrors.cloud.aliyuncs.com/ubuntu/ xenial-updates universe
deb http://mirrors.cloud.aliyuncs.com/ubuntu/ xenial multiverse
deb-src http://mirrors.cloud.aliyuncs.com/ubuntu/ xenial multiverse
deb http://mirrors.cloud.aliyuncs.com/ubuntu/ xenial-updates multiverse
deb-src http://mirrors.cloud.aliyuncs.com/ubuntu/ xenial-updates multiverse
deb http://mirrors.cloud.aliyuncs.com/ubuntu/ xenial-backports main restricted universe multiverse
deb-src http://mirrors.cloud.aliyuncs.com/ubuntu/ xenial-backports main restricted universe multiverse
deb http://mirrors.cloud.aliyuncs.com/ubuntu xenial-security main restricted
deb-src http://mirrors.cloud.aliyuncs.com/ubuntu xenial-security main restricted
deb http://mirrors.cloud.aliyuncs.com/ubuntu xenial-security universe
deb-src http://mirrors.cloud.aliyuncs.com/ubuntu xenial-security universe
deb https://mirrors.aliyun.com/kubernetes/apt kubernetes-xenial main
apt-get install docker.io`
docker -v
安装kubeadm,kubelet,kubectl三个模块
kubeadm : 用来初始化集群的指令
kubelet : 在集群中的每个节点上用来启动 pod 和 container 等
kubectl: 用来与集群通信的命令行工具
apt-get update && apt-get install -y apt-transport-https curl
apt-get install -y kubelet kubeadm kubectl --allow-unauthenticated
设置开机自启动
sudo systemctl enable kubelet && sudo systemctl start kubelet
#重置kubeadm
root@iZ2zeitsosbk244anybs5yZ:/etc/apt# kubeadm reset
kubeadm init --apiserver-advertise-address=172.17.0.1 --image-repository registry.aliyuncs.com/google_containers --kubernetes-version v1.22.2 --service-cidr=10.1.0.0/16 --pod-network-cidr=10.244.0.0/16
—CgroupDriver变量表示使用哪个Cgroup驱动,有两种驱动,分别是cgroupfs和systemd,默认使用cgroupfs
docker info |grep -i cgroup
Cgroup Driver: cgroupfs
cat /etc/systemd/system/kubelet.service.d/10-kubeadm.conf`
Environment="KUBELET_KUBECONFIG_ARGS=--bootstrap-kubeconfig=/etc/kubernetes/bootstrap-kubelet.conf --kubeconfig=/etc/kubernetes/kubelet.conf --cgroup-driver=cgroupfs"