2020年11月25日 | 1 Comment 问题: 解决: 开放端口 firewall-cmd --zone=public --add-port=6443/tcp --permanent firewall-cmd --zone=public --add-port=2379/tcp --permanent firewall-cmd --zone=public --add-port=2380/tcp --permanent firewall-cmd --zone=public --add-port=10250/tcp --permanent firewall-cmd --zone=public --add-port=10251/tcp --permanent firewall-cmd --zone=public --add-port=10252/tcp --permanent firewall-cmd --zone=public --add-port=30000-32767/tcp --permanent 1234567 firewall-cmd --zone=public --add-port=6443/tcp --permanentfirewall-cmd --zone=public --add-port=2379/tcp --permanentfirewall-cmd --zone=public --add-port=2380/tcp --permanentfirewall-cmd --zone=public --add-port=10250/tcp --permanentfirewall-cmd --zone=public --add-port=10251/tcp --permanentfirewall-cmd --zone=public --add-port=10252/tcp --permanentfirewall-cmd --zone=public --add-port=30000-32767/tcp --permanent 安装 kubeadmin cat <<EOF | sudo tee /etc/yum.repos.d/kubernetes.repo [kubernetes] name=Kubernetes 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 EOF # Set SELinux in permissive mode (effectively disabling it) sudo setenforce 0 sudo sed -i 's/^SELINUX=enforcing$/SELINUX=permissive/' /etc/selinux/config sudo yum install -y kubelet kubeadm kubectl --disableexcludes=kubernetes sudo systemctl enable --now kubelet 123456789101112131415161718 cat <<EOF | sudo tee /etc/yum.repos.d/kubernetes.repo[kubernetes]name=Kubernetesbaseurl=https://packages.cloud.google.com/yum/repos/kubernetes-el7-\$basearchenabled=1gpgcheck=1repo_gpgcheck=1gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg https://packages.cloud.google.com/yum/doc/rpm-package-key.gpgexclude=kubelet kubeadm kubectlEOF # Set SELinux in permissive mode (effectively disabling it)sudo setenforce 0sudo sed -i 's/^SELINUX=enforcing$/SELINUX=permissive/' /etc/selinux/config sudo yum install -y kubelet kubeadm kubectl --disableexcludes=kubernetes sudo systemctl enable --now kubelet 手工拉取 docker image , (国内访问不了所以需要手工拉去,否则第四步会报错) #拉取镜像 docker pull kubesphere/kube-apiserver:v1.18.6 docker pull kubesphere/kube-controller-manager:v1.18.6 docker pull kubesphere/kube-scheduler:v1.18.6 docker pull kubesphere/kube-proxy:v1.18.6 docker pull kubesphere/pause:3.2 docker pull azhu/etcd:3.4.3-0 docker pull coredns/coredns:1.6.7 #修改tag docker tag kubesphere/kube-apiserver:v1.18.6 k8s.gcr.io/kube-apiserver:v1.18.6 docker tag kubesphere/kube-controller-manager:v1.18.6 k8s.gcr.io/kube-controller-manager:v1.18.6 docker tag kubesphere/kube-scheduler:v1.18.6 k8s.gcr.io/kube-scheduler:v1.18.6 docker tag kubesphere/kube-proxy:v1.18.6 k8s.gcr.io/kube-proxy:v1.18.6 docker tag kubesphere/pause:3.2 k8s.gcr.io/pause:3.2 docker tag azhu/etcd:3.4.3-0 k8s.gcr.io/etcd:3.4.3-0 docker tag coredns/coredns:1.6.7 k8s.gcr.io/coredns:1.6.7 1234567891011121314151617 #拉取镜像docker pull kubesphere/kube-apiserver:v1.18.6docker pull kubesphere/kube-controller-manager:v1.18.6docker pull kubesphere/kube-scheduler:v1.18.6docker pull kubesphere/kube-proxy:v1.18.6docker pull kubesphere/pause:3.2docker pull azhu/etcd:3.4.3-0docker pull coredns/coredns:1.6.7 #修改tagdocker tag kubesphere/kube-apiserver:v1.18.6 k8s.gcr.io/kube-apiserver:v1.18.6docker tag kubesphere/kube-controller-manager:v1.18.6 k8s.gcr.io/kube-controller-manager:v1.18.6docker tag kubesphere/kube-scheduler:v1.18.6 k8s.gcr.io/kube-scheduler:v1.18.6docker tag kubesphere/kube-proxy:v1.18.6 k8s.gcr.io/kube-proxy:v1.18.6docker tag kubesphere/pause:3.2 k8s.gcr.io/pause:3.2docker tag azhu/etcd:3.4.3-0 k8s.gcr.io/etcd:3.4.3-0docker tag coredns/coredns:1.6.7 k8s.gcr.io/coredns:1.6.7 kubeadm init kubeadm init --pod-network-cidr=192.168.0.0/16 --service-cidr=172.10.0.0/16 --image-repository registry.aliyuncs.com/google_containers 1 kubeadm init --pod-network-cidr=192.168.0.0/16 --service-cidr=172.10.0.0/16 --image-repository registry.aliyuncs.com/google_containers config kubectl scp root@d1:/etc/kubernetes/admin.conf .\.kube\config 1 scp root@d1:/etc/kubernetes/admin.conf .\.kube\config 允许 master 节点执行 pod (单节点必备) kubectl taint nodes --all node-role.kubernetes.io/master- 1 kubectl taint nodes --all node-role.kubernetes.io/master- 配置网络 kubectl create -f https://docs.projectcalico.org/manifests/tigera-operator.yaml 1 kubectl create -f https://docs.projectcalico.org/manifests/tigera-operator.yaml add node 参考: https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/create-cluster-kubeadm/ http://www.linuxe.cn/post-580.html
也可使用 aliyun 镜像 docker pull registry.aliyuncs.com/google_containers/kube-apiserver:v1.20.0 docker pull registry.aliyuncs.com/google_containers/kube-controller-manager:v1.20.0 docker pull registry.aliyuncs.com/google_containers/kube-scheduler:v1.20.0 docker pull registry.aliyuncs.com/google_containers/kube-proxy:v1.20.0 docker pull registry.aliyuncs.com/google_containers/pause:3.2 docker pull registry.aliyuncs.com/google_containers/etcd:3.4.13-0 docker pull registry.aliyuncs.com/google_containers/coredns:1.7.0 拿下来后统一改名(master节点需要以下所有镜像) docker tag registry.aliyuncs.com/google_containers/kube-apiserver:v1.20.0 k8s.gcr.io/kube-apiserver:v1.20.0 docker tag registry.aliyuncs.com/google_containers/kube-controller-manager:v1.20.0 k8s.gcr.io/kube-controller-manager:v1.20.0 docker tag registry.aliyuncs.com/google_containers/kube-scheduler:v1.20.0 k8s.gcr.io/kube-scheduler:v1.20.0 docker tag registry.aliyuncs.com/google_containers/kube-proxy:v1.20.0 k8s.gcr.io/kube-proxy:v1.20.0 docker tag registry.aliyuncs.com/google_containers/pause:3.2 k8s.gcr.io/pause:3.2 docker tag registry.aliyuncs.com/google_containers/etcd:3.4.13-0 k8s.gcr.io/etcd:3.4.13-0 docker tag registry.aliyuncs.com/google_containers/coredns:1.7.0 k8s.gcr.io/coredns:1.7.0 回复