高可用K8S构建3master+3node+keepalived+haproxy (5)

高可用K8S构建3master+3node+keepalived+haproxy

 

修改成自己的IP

kubectl get node

高可用K8S构建3master+3node+keepalived+haproxy

 

启动master01

高可用K8S构建3master+3node+keepalived+haproxy

 

----------------

 

查看集群状态:

kubectl get endpoints kube-controller-manager --namespace=kube-system -o yaml

高可用K8S构建3master+3node+keepalived+haproxy

 

controller-manager的工作节点是master02,其他两个阻塞状态

 

kubectl get endpoints kube-scheduler --namespace=kube-system -o yaml

高可用K8S构建3master+3node+keepalived+haproxy

kube-scheduler是matser03

 

Etcd 集群状态查看
kubectl -n kube-system exec etcd-k8s-master01 -- etcdctl \
--endpoints=https://192.168.66.10:2379 \
--ca-file=http://www.likecs.com/etc/kubernetes/pki/etcd/ca.crt \
--cert-file=http://www.likecs.com/etc/kubernetes/pki/etcd/server.crt \
--key-file=http://www.likecs.com/etc/kubernetes/pki/etcd/server.key cluster-health

指定kube-system名称空间运行 etcd-k8s-master01容器,执行容器内部命令etcdctl指定访问地址66.10:2379端口(etcd客户端连接端口 :2379内部互联端口(监听节点间通信) :2380),指定CA证书和SERVER的证书、秘钥,检查集群健康。

高可用K8S构建3master+3node+keepalived+haproxy

 

加入Node节点

node :

需要node提前装完docker,然后装K8s

cat <<EOF > /etc/yum.repos.d/kubernetes.repo
[kubernetes]
name=Kubernetes
baseurl=http://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64
enabled=1
gpgcheck=0
repo_gpgcheck=0
gpgkey=http://mirrors.aliyun.com/kubernetes/yum/doc/yum-key.gpg

EOF
yum -y install kubeadm-1.15.1 kubectl-1.15.1 kubelet-1.15.1
systemctl enable kubelet.service

 

mkdir -p /usr/local/kubernetes/install/images/

master01 : scp -r kubeadm-basic.images load-images.sh root@192.168.66.20:/usr/local/kubernetes/install/images/

cd  /usr/local/kubernetes/install/images/

vim load-images.sh

 

#!/bin/bash

cd /usr/local/kubernetes/install/images/kubeadm-basic.images
ls /usr/local/kubernetes/install/images/kubeadm-basic.images | grep -v load-images.sh > /tmp/k8s-images.txt

for i in $( cat /tmp/k8s-images.txt )
do
docker load -i $i
done

rm -rf /tmp/k8s-images.txt

 

./load-images.sh

master01:cat /usr/local/kubernetes/install/images/kubeadm-init.log

高可用K8S构建3master+3node+keepalived+haproxy

 

官网太慢,等待下完镜像或者手动从master导到Node

kubectl get pod -n kube-system -o wide 

高可用K8S构建3master+3node+keepalived+haproxy

  

kubectl get pod -n kube-system

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wpyzfd.html