K8S 1.22.0 部署
1. 打开 /etc/fstab 注释掉 swap行2. 打开 /etc/sysconfig/selinux,将SELINUX=enforcing修改为SELINUX=disabled3. systemctl disable firewalld && systemctl stop firewalld4.echo 1 > /proc/sys/net/bridge/bridge-
1. 打开 /etc/fstab 注释掉 swap行
2. 打开 /etc/sysconfig/selinux,将SELINUX=enforcing修改为SELINUX=disabled
3. systemctl disable firewalld && systemctl stop firewalld
4.echo 1 > /proc/sys/net/bridge/bridge-nf-call-iptables
5. 安装docker
a, yum install -y yum-utils device-mapper-persistent-data lvm2
b, yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
yum list docker-ce --showduplicates | sort -r
yum install docker-ce-<VERSION_STRING> docker-ce-cli-<VERSION_STRING> containerd.io
version_string 我选择20.10.8
6. systemctl enable docker & systemctl start docker;
7. echo 1 > /proc/sys/net/bridge/bridge-nf-call-iptables
8. 在/etc/yum.repos.d/kubernetes.repo增加以下内容:[kubernetes]
name=Kubernetes Repository
baseurl=https://packages.cloud.google.com/yum/repos/kubernetes-el7-\$basearch
enabled=1
gpgcheck=1
repo_gpgcheck=1
gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg
exclude=kubelet kubeadm kubectl
如果无法访问官方的yum源,可以使用国内的yum源,比如:http://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64/
yum makecache fast
yum install -y kubelet kubeadm kubectl --disableexcludes=kubernetes
systemctl enable kubelet & systemctl start kubelet
kubeadm config print init-defaults > init-config.yaml
imageRepository: k8s.gcr.io替换为imageRepository: registry.aliyuncs.com/google_containers
kubeadm config images pull --config=init-config.yaml
运行kubeadm init安装master节点
kubeadm init --apiserver-advertise-address 192.168.137.220 --apiserver-bind-port=6443 --pod-network-cidr=10.244.0.0/16 --service-cidr=10.96.0.0/12 --kubernetes-version=1.22.0 --image-repository registry.aliyuncs.com/google_containers
kubeadm token list
kubeadm token create --ttl 0 #创建永久的token
# 获取ca证书sha256编码hash值
openssl x509 -pubkey -in /etc/kubernetes/pki/ca.crt | openssl rsa -pubin -outform der 2>/dev/null | openssl dgst -sha256 -hex | sed 's/^.* //'2cc3029123db737f234186636330e87b5510c173c669f513a9c0e0da395515b0
# node 节点加入
kubeadm join 10.167.11.153:6443 --token o4avtg.65ji6b778nyacw68 --discovery-token-ca-cert-hash sha256:2cc3029123db737f234186636330e87b5510c173c669f513a9c0e0da395515b0
安装node节点
# 该命令来自master安装成功后的最后两行信息
kubeadm join 192.168.137.220:6443 --token c32t70.x1atw35sha5mrnvc \
--discovery-token-ca-cert-hash sha256:e053a0c73fbf74d5486784ef828650fe9cd9db95d3f6228832faee88fb8b199a
- 安装网络插件
# 安装Calico CNI插件 kubectl apply -f "https://docs.projectcalico.org/manifests/calico.yaml" # 安装weave插件 kubectl apply -f "https://cloud.weave.works/k8s/net?k8s-version=$(kubectl version | base64 | tr -d '\n')"
问题
docker-compose up -d 启动不起来,报下面的错误:
Cannot start service zk: oci runtime error: container_linux.go:235: starting container process caused "process_linux.go:258: applying cgroup configuration for process caused "Cannot set property TasksAccounting, or unknown property.""
解决方法:
yum update systemd
service docker restart
更多推荐
所有评论(0)