(14) Kubernetes cluster environment construction-cluster installation

  1. Prepare the cluster mirror
    reference blog
    Before installing the kubernetes cluster, you must prepare the required mirror in advance. The required mirror can be viewed by the following command
kubeadm config images list

Insert picture description here
Download mirror

#此镜像在kubernets的仓库中,由于网络原因,无法连接,下面提供一种替代方案
images=(
    kube-apiserver:v1.17.4
    kube-controller-manager:v1.17.4
    kube-scheduler:v1.17.4
    kube-proxy:v1.17.4
    pause:3.1
    etcd:3.4.3-0
    coredns:1.6.5
)

for imageName in ${images[@]} ; do
    docker pull registry.cn-hangzhou.aliyuncs.com/google_containers/$imageName
    docker tag registry.cn-hangzhou.aliyuncs.com/google_containers/$imageName k8s.gcr.io/$imageName
    docker rmi registry.cn-hangzhou.aliyuncs.com/google_containers/$imageName
done

Pull the mirror legend to
Insert picture description here
view the mirror

docker images

Insert picture description here

  1. Cluster initialization
    Next, start to initialize the cluster, and add the node node to the cluster.
    The following operations only need to be performed on the master node, and only need to modify the apiserver-advertise-address to the master ip.
kubeadm init --kubernetes-version=v1.17.4 --pod-network-cidr=10.244.0.0/16 --service-cidr=10.96.0.0/12 --apiserver-advertise-address=192.168.247.100

Insert picture description here

#按照上面提示执行
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config

Insert picture description here
At this time, there is no node node under the master:
Insert picture description here

The following operations are performed on the node node:

#将node节点加入到master控制中, 在node1和node2中执行下面操作
kubeadm join 192.168.247.100:6443 --token my24rq.fv7eq2ckezbq880u \
    --discovery-token-ca-cert-hash sha256:386b0ae5294482295c8593afd9a721e58c7a1ff0ecebeabbc6a3f902113a5d4b

Check the nodes on the master: At
Insert picture description here
this time, the network is not installed. The above picture is NotReady, which means that communication between nodes is not possible.

》》》Bloggers update their learning experience for a long time, recommend likes and follow! ! !
》》》If there is something wrong, please leave a message in the comment area, thank you! ! !

Guess you like

Origin blog.csdn.net/qq_41622739/article/details/113856533