Kubeadm高可用安装k8s集群最新版

Kubeadm高可用安装k8s集群最新版

第一章、节点规划

高可用Kubernetes集群规划

Kubernetes官网

最新版本kubernetes高可用官方部署文档

主机名 IP地址 说明
k8s-master-1 ~ 3 192.168.150.125 ~ 127 master节点 * 3
k8s-master-lb 192.168.150.236 keepalived虚拟IP
k8s-node-1 ~ 2 192.168.150.123 ~ 124 worker节点 * 2

Pod网段和service和宿主机网段不要重复!!!

配置信息 备注
系统版本 CentOS 7.9
Docker版本 19.03.x
Pod网段 172.16.0.0/12
Service网段 10.168.0.0/16

第二章、基础环境配置

1、Host解析配置(所有节点)

[root@k8s-master-1 ~]# cat /etc/hosts
192.168.150.125 k8s-master-1
192.168.150.126 k8s-master-2
192.168.150.127 k8s-master-3
192.168.150.236 k8s-master-lb # 如果不是高可用集群,该IP为Master-1的IP
192.168.150.123 k8s-node-1
192.168.150.124 k8s-node-2

2、推送公钥

Master-1节点免密钥登录其他节点,安装过程中生成配置文件和证书均在Master-1上操作,集群管理也在Master-1上操作,阿里云或者AWS上需要单独一台kubectl服务器。密钥配置如下:

# 使用k8s-master-1管理其他节点
# 生成秘钥对:
ssh-keygen -t rsa
# 推送公钥:
for i in k8s-master-1 k8s-master-2 k8s-master-3 k8s-node-1 k8s-node-2;do ssh-copy-id -i .ssh/id_rsa.pub $i;done

3、配置YUM源(所有节点)

curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
yum install -y yum-utils device-mapper-persistent-data lvm2
yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
cat <<EOF > /etc/yum.repos.d/kubernetes.repo
[kubernetes]
name=Kubernetes
baseurl=https://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64/
enabled=1
gpgcheck=0
repo_gpgcheck=1
gpgkey=https://mirrors.aliyun.com/kubernetes/yum/doc/yum-key.gpg https://mirrors.aliyun.com/kubernetes/yum/doc/rpm-package-key.gpg
EOF
sed -i -e '/mirrors.cloud.aliyuncs.com/d' -e '/mirrors.aliyuncs.com/d' /etc/yum.repos.d/CentOS-Base.repo

4、安装必备工具(所有节点)

yum install wget jq psmisc vim net-tools telnet yum-utils device-mapper-persistent-data lvm2 git -y

5、关闭防火墙、selinux、dnsmasq、swap分区(所有节点)

systemctl disable --now firewalld 
systemctl disable --now dnsmasq
systemctl disable --now NetworkManager

# 关闭selinux
setenforce 0
sed -i 's#SELINUX=enforcing#SELINUX=disabled#g' /etc/sysconfig/selinux
sed -i 's#SELINUX=enforcing#SELINUX=disabled#g' /etc/selinux/config

# 关闭swap分区
swapoff -a && sysctl -w vm.swappiness=0
sed -ri '/^[^#]*swap/s@^@#@' /etc/fstab

6、同步时区与时间(所有节点)

rpm -ivh http://mirrors.wlnmp.com/centos/wlnmp-release-centos.noarch.rpm
yum install ntpdate -y
ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
echo 'Asia/Shanghai' >/etc/timezone
ntpdate time2.aliyun.com
# 加入到crontab
crontab -e
*/5 * * * * /usr/sbin/ntpdate time2.aliyun.com

7、配置Limits文件(所有节点)

ulimit -SHn 65535
vim /etc/security/limits.conf
# 末尾添加如下内容
* soft nofile 65536
* hard nofile 131072
* soft nproc 65535
* hard nproc 655350
* soft memlock unlimited
* hard memlock unlimited

8、克隆源码文件(所有节点)

cd /root/ && git clone https://github.com/dotbalo/k8s-ha-install.git
# 如果无法下载就下载:
cd /root/ && git clone https://gitee.com/dukuan/k8s-ha-install.git

9、升级系统(所有节点)

# CentOS7需要升级,CentOS8可以按需升级系统
yum update -y --exclude=kernel* && reboot 

10、升级内核版本至4.19(所有节点)

# CentOS7 需要升级内核至4.18+,本地升级的版本为4.19
# 在Master-1节点下载内核:
cd /root && wget http://193.49.22.109/elrepo/kernel/el7/x86_64/RPMS/kernel-ml-devel-4.19.12-1.el7.elrepo.x86_64.rpm
wget http://193.49.22.109/elrepo/kernel/el7/x86_64/RPMS/kernel-ml-4.19.12-1.el7.elrepo.x86_64.rpm
# 从Master-1节点传到其他节点:
for i in k8s-master-2 k8s-master-3 k8s-node-1 k8s-node-2;do scp kernel-ml-4.19.12-1.el7.elrepo.x86_64.rpm kernel-ml-devel-4.19.12-1.el7.elrepo.x86_64.rpm $i:/root/ ; done

# 所有节点安装内核:
cd /root && yum localinstall -y kernel-ml*
# 所有节点更改内核启动顺序:
grub2-set-default  0 && grub2-mkconfig -o /etc/grub2.cfg
grubby --args="user_namespace.enable=1" --update-kernel="$(grubby --default-kernel)"
# 检查默认内核是不是4.19
[root@k8s-master-2 ~]# grubby --default-kernel
/boot/vmlinuz-4.19.12-1.el7.elrepo.x86_64
# 所有节点重启,然后检查内核是不是4.19
[root@k8s-master-2 ~]# uname -a
Linux k8s-master-2 4.19.12-1.el7.elrepo.x86_64 #1 SMP Fri Dec 21 11:06:36 EST 2018 x86_64 x86_64 x86_64 GNU/Linux

11、部署Ipvsadm服务(所有节点)

# 所有节点安装ipvsadm:
yum install ipvsadm ipset sysstat conntrack libseccomp -y
# 所有节点配置ipvs模块,在内核4.19+版本nf_conntrack_ipv4已经改为nf_conntrack, 4.18以下使用nf_conntrack_ipv4即可:
modprobe -- ip_vs
modprobe -- ip_vs_rr
modprobe -- ip_vs_wrr
modprobe -- ip_vs_sh
modprobe -- nf_conntrack

vim /etc/modules-load.d/ipvs.conf 
# 加入以下内容
ip_vs
ip_vs_lc
ip_vs_wlc
ip_vs_rr
ip_vs_wrr
ip_vs_lblc
ip_vs_lblcr
ip_vs_dh
ip_vs_sh
ip_vs_fo
ip_vs_nq
ip_vs_sed
ip_vs_ftp
ip_vs_sh
nf_conntrack
ip_tables
ip_set
xt_set
ipt_set
ipt_rpfilter
ipt_REJECT
ipip
# 然后执行systemctl enable --now systemd-modules-load.service即可

12、配置kubernetes内核参数(所有节点)

# 开启一些k8s集群中必须的内核参数,所有节点配置k8s内核:
cat <<EOF > /etc/sysctl.d/k8s.conf
net.ipv4.ip_forward = 1
net.bridge.bridge-nf-call-iptables = 1
net.bridge.bridge-nf-call-ip6tables = 1
fs.may_detach_mounts = 1
net.ipv4.conf.all.route_localnet = 1
vm.overcommit_memory=1
vm.panic_on_oom=0
fs.inotify.max_user_watches=89100
fs.file-max=52706963
fs.nr_open=52706963
net.netfilter.nf_conntrack_max=2310720

net.ipv4.tcp_keepalive_time = 600
net.ipv4.tcp_keepalive_probes = 3
net.ipv4.tcp_keepalive_intvl =15
net.ipv4.tcp_max_tw_buckets = 36000
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_max_orphans = 327680
net.ipv4.tcp_orphan_retries = 3
net.ipv4.tcp_syncookies = 1
net.ipv4.tcp_max_syn_backlog = 16384
net.ipv4.ip_conntrack_max = 65536
net.ipv4.tcp_max_syn_backlog = 16384
net.ipv4.tcp_timestamps = 0
net.core.somaxconn = 16384
EOF

sysctl --system

# 所有节点配置完内核后,重启服务器,保证重启后内核依旧加载
reboot
[root@k8s-master-1 ~]# lsmod | grep --color=auto -e ip_vs -e nf_conntrack
ip_vs_ftp              16384  0
nf_nat                 49152  1 ip_vs_ftp
ip_vs_sed              16384  0
ip_vs_nq               16384  0
ip_vs_fo               16384  0
ip_vs_sh               16384  0
ip_vs_dh               16384  0
ip_vs_lblcr            16384  0
ip_vs_lblc             16384  0
ip_vs_wrr              16384  0
ip_vs_rr               16384  0
ip_vs_wlc              16384  0
ip_vs_lc               16384  0
ip_vs                 159744  24 ip_vs_wlc,ip_vs_rr,ip_vs_dh,ip_vs_lblcr,ip_vs_sh,ip_vs_fo,ip_vs_nq,ip_vs_lblc,ip_vs_wrr,ip_vs_lc,ip_vs_sed,ip_vs_ftp
nf_conntrack          155648  2 nf_nat,ip_vs
nf_defrag_ipv6         24576  2 nf_conntrack,ip_vs
nf_defrag_ipv4         16384  1 nf_conntrack
libcrc32c              16384  4 nf_conntrack,nf_nat,xfs,ip_vs

第三章、Kubernetes基本组件安装部署

1、部署Docker

# 1.所有节点安装Docker-ce 19.03:
yum install docker-ce-19.03.* docker-ce-cli-19.03.* -y

# 2.由于新版kubelet建议使用systemd,所以可以把docker的CgroupDriver改成systemd
mkdir /etc/docker
cat > /etc/docker/daemon.json <<EOF
{
  "exec-opts": ["native.cgroupdriver=systemd"]
}
EOF

# 3.所有节点设置开机自启动Docker:
systemctl daemon-reload && systemctl enable --now docker

2、部署Kubernetes组件

# 1.安装k8s组件:
yum list kubeadm.x86_64 --showduplicates | sort -r
# 2.所有节点安装最新版本kubeadm:
yum install kubeadm-1.22* kubelet-1.22* kubectl-1.22* -y
# 3.默认配置的pause镜像使用gcr.io仓库,国内可能无法访问,所以这里配置Kubelet使用阿里云的pause镜像:
cat >/etc/sysconfig/kubelet<<EOF
KUBELET_EXTRA_ARGS="--pod-infra-container-image=registry.cn-hangzhou.aliyuncs.com/google_containers/pause:3.5"
EOF
# 4.设置Kubelet开机自启动(此时kubelet无法启动,无需管理):
systemctl daemon-reload && systemctl enable --now kubelet

第四章、Kubernetes高可用组件部署

1、所有Master节点配置HAproxy和KeepAlived

注意:如果不是高可用集群,haproxykeepalived无需安装

公有云要用公有云自带的负载均衡,比如阿里云的SLB,腾讯云的ELB,用来替代haproxykeepalived,因为公有云大部分都是不支持keepalived的,另外如果用阿里云的话,kubectl控制端不能放在master节点,推荐使用腾讯云,因为阿里云的slb有回环的问题,也就是slb代理的服务器不能反向访问SLB,但是腾讯云修复了这个问题。

所有Master节点通过yum安装HAProxyKeepAlived

yum install keepalived haproxy -y

2、HAproxy服务配置

所有Master节点配置HAProxy(详细配置参考HAProxy文档,所有Master节点的HAProxy配置相同):

mkdir /etc/haproxy
vim /etc/haproxy/haproxy.cfg 
global
  maxconn  2000
  ulimit-n  16384
  log  127.0.0.1 local0 err
  stats timeout 30s

defaults
  log global
  mode  http
  option  httplog
  timeout connect 5000
  timeout client  50000
  timeout server  50000
  timeout http-request 15s
  timeout http-keep-alive 15s

frontend monitor-in
  bind *:33305
  mode http
  option httplog
  monitor-uri /monitor

frontend k8s-master
  bind 0.0.0.0:16443
  bind 127.0.0.1:16443
  mode tcp
  option tcplog
  tcp-request inspect-delay 5s
  default_backend k8s-master

backend k8s-master
  mode tcp
  option tcplog
  option tcp-check
  balance roundrobin
  default-server inter 10s downinter 5s rise 2 fall 2 slowstart 60s maxconn 250 maxqueue 256 weight 100
  server k8s-master-1	192.168.150.125:6443  check
  server k8s-master-2	192.168.150.126:6443  check
  server k8s-master-3	192.168.150.127:6443  check

3、KeepAlived服务配置

所有Master节点配KeepAlived,配置不一样,注意区分,注意每个节点的IP网卡interface参数)

3.1 Master-1节点配置

[root@k8s-master-1 ~]# cat /etc/keepalived/keepalived.conf
! Configuration File for keepalived
global_defs {
    router_id LVS_DEVEL
script_user root
    enable_script_security
}
vrrp_script chk_apiserver {
    script "/etc/keepalived/check_apiserver.sh"
    interval 5
    weight -5
    fall 2
rise 1
}
vrrp_instance VI_1 {
    state MASTER
    interface ens192
    mcast_src_ip 192.168.150.125
    virtual_router_id 51
    priority 101
    advert_int 2
    authentication {
        auth_type PASS
        auth_pass K8SHA_KA_AUTH
    }
    virtual_ipaddress {
        192.168.150.236
    }
    track_script {
       chk_apiserver
    }
}

3.2 Master-2节点配置

[root@k8s-nmaster-2 ~]# cat /etc/keepalived/keepalived.conf
! Configuration File for keepalived
global_defs {
    router_id LVS_DEVEL
script_user root
    enable_script_security
}
vrrp_script chk_apiserver {
    script "/etc/keepalived/check_apiserver.sh"
   interval 5
    weight -5
    fall 2
rise 1
}
vrrp_instance VI_1 {
    state BACKUP
    interface ens192
    mcast_src_ip 192.168.150.126
    virtual_router_id 51
    priority 100
    advert_int 2
    authentication {
        auth_type PASS
        auth_pass K8SHA_KA_AUTH
    }
    virtual_ipaddress {
        192.168.150.236
    }
    track_script {
       chk_apiserver
    }
}

3.3 Master-3节点配置

[root@k8s-master-3 ~]# cat /etc/keepalived/keepalived.conf
! Configuration File for keepalived
global_defs {
    router_id LVS_DEVEL
script_user root
    enable_script_security
}
vrrp_script chk_apiserver {
    script "/etc/keepalived/check_apiserver.sh"
 interval 5
    weight -5
    fall 2
rise 1
}
vrrp_instance VI_1 {
    state BACKUP
    interface ens192
    mcast_src_ip 192.168.150.127
    virtual_router_id 51
    priority 100
    advert_int 2
    authentication {
        auth_type PASS
        auth_pass K8SHA_KA_AUTH
    }
    virtual_ipaddress {
        192.168.150.236
    }
    track_script {
       chk_apiserver
    }
}

4、配置KeepAlived健康检查(所有Master节点)

# 所有master节点配置KeepAlived健康检查文件:
[root@k8s-master-1 keepalived]# cat /etc/keepalived/check_apiserver.sh 
#!/bin/bash
err=0
for k in $(seq 1 3)
do
    check_code=$(pgrep haproxy)
    if [[ $check_code == "" ]]; then
        err=$(expr $err + 1)
        sleep 1
        continue
    else
        err=0
        break
    fi
done

if [[ $err != "0" ]]; then
    echo "systemctl stop keepalived"
    /usr/bin/systemctl stop keepalived
    exit 1
else
    exit 0
fi

# 配置执行权限
chmod +x /etc/keepalived/check_apiserver.sh
# 启动haproxy和keepalived
[root@k8s-master-3 ~]# systemctl daemon-reload && systemctl enable --now haproxy && systemctl enable --now keepalived
Created symlink from /etc/systemd/system/multi-user.target.wants/haproxy.service to /usr/lib/systemd/system/haproxy.service.
Created symlink from /etc/systemd/system/multi-user.target.wants/keepalived.service to /usr/lib/systemd/system/keepalived.service.

# 需要测试keepalived是否是正常的:
[root@k8s-master-3 ~]# ping 192.168.150.236 -c 4
PING 192.168.150.236 (192.168.150.236) 56(84) bytes of data.
64 bytes from 192.168.150.236: icmp_seq=1 ttl=64 time=0.356 ms
64 bytes from 192.168.150.236: icmp_seq=2 ttl=64 time=0.197 ms
64 bytes from 192.168.150.236: icmp_seq=3 ttl=64 time=0.187 ms
64 bytes from 192.168.150.236: icmp_seq=4 ttl=64 time=0.214 ms

--- 192.168.150.236 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3075ms
rtt min/avg/max/mdev = 0.187/0.238/0.356/0.070 ms
[root@k8s-master-3 ~]# telnet 192.168.150.236 16443
Trying 192.168.150.236...
Connected to 192.168.150.236.
Escape character is '^]'.
Connection closed by foreign host.

image

  • 如果ping不通且telnet没有出现],则认为VIP不可以,不可在继续往下执行,需要排查keepalived的问题,比如防火墙和selinux,haproxykeepalived的状态,监听端口

  • 所有节点查看防火墙状态必须为disableinactivesystemctl status firewalld

  • 所有节点查看selinux状态,必须为disable:getenforce

  • master节点查看haproxykeepalived状态:systemctl status keepalived haproxy

  • master节点查看监听端口:netstat -lntp

第五章、Kubernetes集群初始化

官方初始化文档

1、Kubernetes集群Master-1节点

Master-1节点创建kubeadm-config.yaml配置文件如下:

Master-1:(# 注意,如果不是高可用集群,192.168.150.236:16443改为Master-1的地址,16443改为apiserver的端口,默认是6443,注意更改kubernetesVersion的值和自己服务器kubeadm的版本一致:kubeadm version

# 1.查看Kubeadm版本
[root@k8s-master-1 ~]# kubeadm version
# 2.配置Kubeadm配置文件:
[root@k8s-master-1 ~]# cat kubeadm-config.yaml
apiVersion: kubeadm.k8s.io/v1beta2
bootstrapTokens:
- groups:
  - system:bootstrappers:kubeadm:default-node-token
  token: 7t2weq.bjbawausm0jaxury
  ttl: 24h0m0s
  usages:
  - signing
  - authentication
kind: InitConfiguration
localAPIEndpoint:
  advertiseAddress: 192.168.150.125
  bindPort: 6443
nodeRegistration:
  criSocket: /var/run/dockershim.sock
  name: k8s-master-1
  taints:
  - effect: NoSchedule
    key: node-role.kubernetes.io/master
---
apiServer:
  certSANs:
  - 192.168.150.236
  timeoutForControlPlane: 4m0s
apiVersion: kubeadm.k8s.io/v1beta2
certificatesDir: /etc/kubernetes/pki
clusterName: kubernetes
controlPlaneEndpoint: 192.168.150.236:16443
controllerManager: {}
dns:
  type: CoreDNS
etcd:
  local:
    dataDir: /var/lib/etcd
imageRepository: registry.cn-hangzhou.aliyuncs.com/google_containers
kind: ClusterConfiguration
kubernetesVersion: v1.22.5
networking:
  dnsDomain: cluster.local
  podSubnet: 172.16.0.0/12
  serviceSubnet: 10.168.0.0/16
scheduler: {}

# 3.更新kubeadm文件
kubeadm config migrate --old-config kubeadm-config.yaml --new-config new.yaml

# 4.将new.yaml文件复制到其他master节点,
for i in k8s-master-2 k8s-master-3; do scp new.yaml $i:/root/; done

# 5.所有Master节点下载镜像(其他节点不需要更改任何配置,包括IP地址也不需要更改):
kubeadm config images pull --config /root/new.yaml 

# 6.所有节点设置开机自启动kubelet
systemctl enable --now kubelet(如果启动失败无需管理,初始化成功以后即可启动)

# Master-1节点初始化,初始化以后会在/etc/kubernetes目录下生成对应的证书和配置文件,之后其他Master节点加入Master-1即可:
kubeadm init --config /root/new.yaml  --upload-certs

# 如果初始化失败,重置后再次初始化,命令如下:
kubeadm reset -f ; ipvsadm --clear  ; rm -rf ~/.kube
# 初始化成功以后,会产生Token值,用于其他节点加入时使用,因此要记录下初始化成功生成的token值(令牌值):
Your Kubernetes control-plane has initialized successfully!

To start using your cluster, you need to run the following as a regular user:

  mkdir -p $HOME/.kube
  sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
  sudo chown $(id -u):$(id -g) $HOME/.kube/config

Alternatively, if you are the root user, you can run:

  export KUBECONFIG=/etc/kubernetes/admin.conf

You should now deploy a pod network to the cluster.
Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at:
  https://kubernetes.io/docs/concepts/cluster-administration/addons/

You can now join any number of the control-plane node running the following command on each as root:

  kubeadm join 192.168.150.236:16443 --token 7t2weq.bjbawausm0jaxury \
 --discovery-token-ca-cert-hash sha256:1d8f95f9abee66db6387489f14def796566d52a31c20536779cb7d3bd65cf750 \
 --control-plane --certificate-key 1dcebbf426c15c80a1e1e01d9c462d4cd1176c58a582098bcd4c4240760f0afc

Please note that the certificate-key gives access to cluster sensitive data, keep it secret!
As a safeguard, uploaded-certs will be deleted in two hours; If necessary, you can use
"kubeadm init phase upload-certs --upload-certs" to reload certs afterward.

Then you can join any number of worker nodes by running the following on each as root:

kubeadm join 192.168.150.236:16443 --token 7t2weq.bjbawausm0jaxury \
 --discovery-token-ca-cert-hash sha256:1d8f95f9abee66db6387489f14def796566d52a31c20536779cb7d3bd65cf750 

# Master-1节点配置环境变量,用于访问Kubernetes集群:
cat <<EOF >> /root/.bashrc
export KUBECONFIG=/etc/kubernetes/admin.conf
EOF
source /root/.bashrc
# 查看节点状态:
[root@k8s-master-1 ~]# kubectl get node
NAME           STATUS     ROLES                  AGE   VERSION
k8s-master-1   NotReady   control-plane,master   18m   v1.22.5

image

采用初始化安装方式,所有的系统组件均以容器的方式运行并且在kube-system命名空间内,此时可以查看Pod状态:

[root@k8s-master-1 ~]# kubectl get po -n kube-system
NAME                                   READY   STATUS    RESTARTS   AGE
coredns-7d89d9b6b8-d8z2q               0/1     Pending   0          19m
coredns-7d89d9b6b8-qc2t2               0/1     Pending   0          19m
etcd-k8s-master-1                      1/1     Running   3          19m
kube-apiserver-k8s-master-1            1/1     Running   3          19m
kube-controller-manager-k8s-master-1   1/1     Running   3          19m
kube-proxy-jkrpg                       1/1     Running   0          19m
kube-scheduler-k8s-master-1            1/1     Running   3          19m

image

第六章、Kubernetes高可用Master

1、Token过期

注意:以下步骤是上述init命令产生的Token过期了才需要执行以下步骤,如果没有过期不需要执行

# Token过期后生成新的token:
kubeadm token create --print-join-command

# Master需要生成--certificate-key
kubeadm init phase upload-certs  --upload-certs

2、其他Master加入集群

Token没有过期直接执行Join就行了

其他master加入集群,master-2master-3分别执行:

kubeadm join 192.168.150.236:16443 --token 7t2weq.bjbawausm0jaxury \
 --discovery-token-ca-cert-hash sha256:1d8f95f9abee66db6387489f14def796566d52a31c20536779cb7d3bd65cf750 \
 --control-plane --certificate-key 1dcebbf426c15c80a1e1e01d9c462d4cd1176c58a582098bcd4c4240760f0afc

Master-2节点

[root@k8s-master-2 ~]# kubeadm join 192.168.150.236:16443 --token 7t2weq.bjbawausm0jaxury \
>  --discovery-token-ca-cert-hash sha256:1d8f95f9abee66db6387489f14def796566d52a31c20536779cb7d3bd65cf750 \
>  --control-plane --certificate-key 1dcebbf426c15c80a1e1e01d9c462d4cd1176c58a582098bcd4c4240760f0afc
[preflight] Running pre-flight checks
[preflight] Reading configuration from the cluster...
[preflight] FYI: You can look at this config file with 'kubectl -n kube-system get cm kubeadm-config -o yaml'
[preflight] Running pre-flight checks before initializing the new control plane instance
[preflight] Pulling images required for setting up a Kubernetes cluster
[preflight] This might take a minute or two, depending on the speed of your internet connection
[preflight] You can also perform this action in beforehand using 'kubeadm config images pull'
[download-certs] Downloading the certificates in Secret "kubeadm-certs" in the "kube-system" Namespace
[certs] Using certificateDir folder "/etc/kubernetes/pki"
[certs] Generating "front-proxy-client" certificate and key
[certs] Generating "apiserver-kubelet-client" certificate and key
[certs] Generating "apiserver" certificate and key
[certs] apiserver serving cert is signed for DNS names [k8s-master-2 kubernetes kubernetes.default kubernetes.default.svc kubernetes.default.svc.cluster.local] and IPs [10.168.0.1 192.168.150.126 192.168.150.236]
[certs] Generating "etcd/server" certificate and key
[certs] etcd/server serving cert is signed for DNS names [k8s-master-2 localhost] and IPs [192.168.150.126 127.0.0.1 ::1]
[certs] Generating "etcd/healthcheck-client" certificate and key
[certs] Generating "apiserver-etcd-client" certificate and key
[certs] Generating "etcd/peer" certificate and key
[certs] etcd/peer serving cert is signed for DNS names [k8s-master-2 localhost] and IPs [192.168.150.126 127.0.0.1 ::1]
[certs] Valid certificates and keys now exist in "/etc/kubernetes/pki"
[certs] Using the existing "sa" key
[kubeconfig] Generating kubeconfig files
[kubeconfig] Using kubeconfig folder "/etc/kubernetes"
[endpoint] WARNING: port specified in controlPlaneEndpoint overrides bindPort in the controlplane address
[kubeconfig] Writing "admin.conf" kubeconfig file
[endpoint] WARNING: port specified in controlPlaneEndpoint overrides bindPort in the controlplane address
[kubeconfig] Writing "controller-manager.conf" kubeconfig file
[endpoint] WARNING: port specified in controlPlaneEndpoint overrides bindPort in the controlplane address
[kubeconfig] Writing "scheduler.conf" kubeconfig file
[control-plane] Using manifest folder "/etc/kubernetes/manifests"
[control-plane] Creating static Pod manifest for "kube-apiserver"
[control-plane] Creating static Pod manifest for "kube-controller-manager"
[control-plane] Creating static Pod manifest for "kube-scheduler"
[check-etcd] Checking that the etcd cluster is healthy
[kubelet-start] Writing kubelet configuration to file "/var/lib/kubelet/config.yaml"
[kubelet-start] Writing kubelet environment file with flags to file "/var/lib/kubelet/kubeadm-flags.env"
[kubelet-start] Starting the kubelet
[kubelet-start] Waiting for the kubelet to perform the TLS Bootstrap...
[etcd] Announced new etcd member joining to the existing etcd cluster
[etcd] Creating static Pod manifest for "etcd"
[etcd] Waiting for the new etcd member to join the cluster. This can take up to 40s
The 'update-status' phase is deprecated and will be removed in a future release. Currently it performs no operation
[mark-control-plane] Marking the node k8s-master-2 as control-plane by adding the labels: [node-role.kubernetes.io/master(deprecated) node-role.kubernetes.io/control-plane node.kubernetes.io/exclude-from-external-load-balancers]
[mark-control-plane] Marking the node k8s-master-2 as control-plane by adding the taints [node-role.kubernetes.io/master:NoSchedule]

This node has joined the cluster and a new control plane instance was created:

* Certificate signing request was sent to apiserver and approval was received.
* The Kubelet was informed of the new secure connection details.
* Control plane (master) label and taint were applied to the new node.
* The Kubernetes control plane instances scaled up.
* A new etcd member was added to the local/stacked etcd cluster.

To start administering your cluster from this node, you need to run the following as a regular user:

	mkdir -p $HOME/.kube
	sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
	sudo chown $(id -u):$(id -g) $HOME/.kube/config

Run 'kubectl get nodes' to see this node join the cluster.

Master-3节点

[root@k8s-master-3 ~]# kubeadm join 192.168.150.236:16443 --token 7t2weq.bjbawausm0jaxury \
>  --discovery-token-ca-cert-hash sha256:1d8f95f9abee66db6387489f14def796566d52a31c20536779cb7d3bd65cf750 \
>  --control-plane --certificate-key 1dcebbf426c15c80a1e1e01d9c462d4cd1176c58a582098bcd4c4240760f0afc
[preflight] Running pre-flight checks
[preflight] Reading configuration from the cluster...
[preflight] FYI: You can look at this config file with 'kubectl -n kube-system get cm kubeadm-config -o yaml'
[preflight] Running pre-flight checks before initializing the new control plane instance
[preflight] Pulling images required for setting up a Kubernetes cluster
[preflight] This might take a minute or two, depending on the speed of your internet connection
[preflight] You can also perform this action in beforehand using 'kubeadm config images pull'
[download-certs] Downloading the certificates in Secret "kubeadm-certs" in the "kube-system" Namespace
[certs] Using certificateDir folder "/etc/kubernetes/pki"
[certs] Generating "apiserver" certificate and key
[certs] apiserver serving cert is signed for DNS names [k8s-master-3 kubernetes kubernetes.default kubernetes.default.svc kubernetes.default.svc.cluster.local] and IPs [10.168.0.1 192.168.150.127 192.168.150.236]
[certs] Generating "apiserver-kubelet-client" certificate and key
[certs] Generating "front-proxy-client" certificate and key
[certs] Generating "etcd/healthcheck-client" certificate and key
[certs] Generating "etcd/peer" certificate and key
[certs] etcd/peer serving cert is signed for DNS names [k8s-master-3 localhost] and IPs [192.168.150.127 127.0.0.1 ::1]
[certs] Generating "apiserver-etcd-client" certificate and key
[certs] Generating "etcd/server" certificate and key
[certs] etcd/server serving cert is signed for DNS names [k8s-master-3 localhost] and IPs [192.168.150.127 127.0.0.1 ::1]
[certs] Valid certificates and keys now exist in "/etc/kubernetes/pki"
[certs] Using the existing "sa" key
[kubeconfig] Generating kubeconfig files
[kubeconfig] Using kubeconfig folder "/etc/kubernetes"
[endpoint] WARNING: port specified in controlPlaneEndpoint overrides bindPort in the controlplane address
[kubeconfig] Writing "admin.conf" kubeconfig file
[endpoint] WARNING: port specified in controlPlaneEndpoint overrides bindPort in the controlplane address
[kubeconfig] Writing "controller-manager.conf" kubeconfig file
[endpoint] WARNING: port specified in controlPlaneEndpoint overrides bindPort in the controlplane address
[kubeconfig] Writing "scheduler.conf" kubeconfig file
[control-plane] Using manifest folder "/etc/kubernetes/manifests"
[control-plane] Creating static Pod manifest for "kube-apiserver"
[control-plane] Creating static Pod manifest for "kube-controller-manager"
[control-plane] Creating static Pod manifest for "kube-scheduler"
[check-etcd] Checking that the etcd cluster is healthy
[kubelet-start] Writing kubelet configuration to file "/var/lib/kubelet/config.yaml"
[kubelet-start] Writing kubelet environment file with flags to file "/var/lib/kubelet/kubeadm-flags.env"
[kubelet-start] Starting the kubelet
[kubelet-start] Waiting for the kubelet to perform the TLS Bootstrap...
[etcd] Announced new etcd member joining to the existing etcd cluster
[etcd] Creating static Pod manifest for "etcd"
[etcd] Waiting for the new etcd member to join the cluster. This can take up to 40s
The 'update-status' phase is deprecated and will be removed in a future release. Currently it performs no operation
[mark-control-plane] Marking the node k8s-master-3 as control-plane by adding the labels: [node-role.kubernetes.io/master(deprecated) node-role.kubernetes.io/control-plane node.kubernetes.io/exclude-from-external-load-balancers]
[mark-control-plane] Marking the node k8s-master-3 as control-plane by adding the taints [node-role.kubernetes.io/master:NoSchedule]

This node has joined the cluster and a new control plane instance was created:

* Certificate signing request was sent to apiserver and approval was received.
* The Kubelet was informed of the new secure connection details.
* Control plane (master) label and taint were applied to the new node.
* The Kubernetes control plane instances scaled up.
* A new etcd member was added to the local/stacked etcd cluster.

To start administering your cluster from this node, you need to run the following as a regular user:

	mkdir -p $HOME/.kube
	sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
	sudo chown $(id -u):$(id -g) $HOME/.kube/config

Run 'kubectl get nodes' to see this node join the cluster.

查看当前状态:

[root@k8s-master-1 ~]# kubectl get node
NAME           STATUS     ROLES                  AGE    VERSION
k8s-master-1   NotReady   control-plane,master   38m    v1.22.5
k8s-master-2   NotReady   control-plane,master   115s   v1.22.5
k8s-master-3   NotReady   control-plane,master   56s    v1.22.5

image

至此,Kubernetes高可用Master集群部署完成。

第七章、Node节点加入Kubernetes集群

Node节点上主要部署公司的一些业务应用,生产环境中不建议Master节点部署系统组件之外的其他Pod,测试环境可以允许Master节点部署Pod以节省系统资源。

Node加入Kubernetes集群,k8s-node-1k8s-node-2节点分别执行:

kubeadm join 192.168.150.236:16443 --token 7t2weq.bjbawausm0jaxury \
>  --discovery-token-ca-cert-hash sha256:1d8f95f9abee66db6387489f14def796566d52a31c20536779cb7d3bd65cf750

k8s-node-1节点:

[root@k8s-node-1 ~]# kubeadm join 192.168.150.236:16443 --token 7t2weq.bjbawausm0jaxury \
>  --discovery-token-ca-cert-hash sha256:1d8f95f9abee66db6387489f14def796566d52a31c20536779cb7d3bd65cf750
[preflight] Running pre-flight checks
[preflight] Reading configuration from the cluster...
[preflight] FYI: You can look at this config file with 'kubectl -n kube-system get cm kubeadm-config -o yaml'
[kubelet-start] Writing kubelet configuration to file "/var/lib/kubelet/config.yaml"
[kubelet-start] Writing kubelet environment file with flags to file "/var/lib/kubelet/kubeadm-flags.env"
[kubelet-start] Starting the kubelet
[kubelet-start] Waiting for the kubelet to perform the TLS Bootstrap...

This node has joined the cluster:
* Certificate signing request was sent to apiserver and a response was received.
* The Kubelet was informed of the new secure connection details.

Run 'kubectl get nodes' on the control-plane to see this node join the cluster.

k8s-node-2节点:

[root@k8s-node-2 ~]# kubeadm join 192.168.150.236:16443 --token 7t2weq.bjbawausm0jaxury \
>  --discovery-token-ca-cert-hash sha256:1d8f95f9abee66db6387489f14def796566d52a31c20536779cb7d3bd65cf750
[preflight] Running pre-flight checks
[preflight] Reading configuration from the cluster...
[preflight] FYI: You can look at this config file with 'kubectl -n kube-system get cm kubeadm-config -o yaml'
[kubelet-start] Writing kubelet configuration to file "/var/lib/kubelet/config.yaml"
[kubelet-start] Writing kubelet environment file with flags to file "/var/lib/kubelet/kubeadm-flags.env"
[kubelet-start] Starting the kubelet
[kubelet-start] Waiting for the kubelet to perform the TLS Bootstrap...

This node has joined the cluster:
* Certificate signing request was sent to apiserver and a response was received.
* The Kubelet was informed of the new secure connection details.

Run 'kubectl get nodes' on the control-plane to see this node join the cluster.

所有节点初始化完成后,查看集群状态:

[root@k8s-master-1 ~]# kubectl get node
NAME           STATUS     ROLES                  AGE   VERSION
k8s-master-1   NotReady   control-plane,master   48m   v1.22.5
k8s-master-2   NotReady   control-plane,master   11m   v1.22.5
k8s-master-3   NotReady   control-plane,master   10m   v1.22.5
k8s-node-1     NotReady   <none>                 29s   v1.22.5
k8s-node-2     NotReady   <none>                 24s   v1.22.5

image

至此,Kubernetes高可用集群部署完毕。

第八章、Kubernetes集群Calico组件安装部署

该步骤只在Master-1执行

[root@k8s-master-1 ~/k8s-ha-install]# cd /root/k8s-ha-install && git checkout manual-installation-v1.21.x && cd calico/
分支 manual-installation-v1.21.x 设置为跟踪来自 origin 的远程分支 manual-installation-v1.21.x。
切换到一个新分支 'manual-installation-v1.21.x'

修改calico-etcd.yaml的以下位置

sed -i 's#etcd_endpoints: "http://<ETCD_IP>:<ETCD_PORT>"#etcd_endpoints: "https://192.168.150.125:2379,https://192.168.150.126:2379,https://192.168.150.127:2379"#g' /root/k8s-ha-install/calico/calico-etcd.yaml
ETCD_CA=`cat /etc/kubernetes/pki/etcd/ca.crt | base64 | tr -d '\n'`
ETCD_CERT=`cat /etc/kubernetes/pki/etcd/server.crt | base64 | tr -d '\n'`
ETCD_KEY=`cat /etc/kubernetes/pki/etcd/server.key | base64 | tr -d '\n'`
sed -i "s@# etcd-key: null@etcd-key: ${ETCD_KEY}@g; s@# etcd-cert: null@etcd-cert: ${ETCD_CERT}@g; s@# etcd-ca: null@etcd-ca: ${ETCD_CA}@g" /root/k8s-ha-install/calico/calico-etcd.yaml
sed -i 's#etcd_ca: ""#etcd_ca: "/calico-secrets/etcd-ca"#g; s#etcd_cert: ""#etcd_cert: "/calico-secrets/etcd-cert"#g; s#etcd_key: "" #etcd_key: "/calico-secrets/etcd-key" #g' /root/k8s-ha-install/calico/calico-etcd.yaml

POD_SUBNET=`cat /etc/kubernetes/manifests/kube-controller-manager.yaml | grep cluster-cidr= | awk -F= '{print $NF}'`

注意下面的这个步骤是把calico-etcd.yaml文件里面的CALICO_IPV4POOL_CIDR下的网段改成自己的Pod网段,也就是把192.168.x.x/16改成自己的集群网段,并打开注释(注意缩进关系):

image

sed -i 's@# - name: CALICO_IPV4POOL_CIDR@- name: CALICO_IPV4POOL_CIDR@g; s@#   value: "10.168.0.0/16"@  value: '"${POD_SUBNET}"'@g' calico-etcd.yaml

image

安装Calico组件:

[root@k8s-master-1 ~/k8s-ha-install/calico]# kubectl apply -f calico-etcd.yaml
secret/calico-etcd-secrets unchanged
configmap/calico-config unchanged
clusterrole.rbac.authorization.k8s.io/calico-kube-controllers unchanged
clusterrolebinding.rbac.authorization.k8s.io/calico-kube-controllers unchanged
clusterrole.rbac.authorization.k8s.io/calico-node unchanged
clusterrolebinding.rbac.authorization.k8s.io/calico-node unchanged
daemonset.apps/calico-node created
serviceaccount/calico-node created
deployment.apps/calico-kube-controllers created
serviceaccount/calico-kube-controllers created

查看容器和节点状态

[root@k8s-master-1 ~/k8s-ha-install/calico]# kubectl get po -n kube-system
NAME                                      READY   STATUS    RESTARTS        AGE
calico-kube-controllers-cdd5755b9-n6nmw   1/1     Running   0               3m40s
calico-node-27tfg                         1/1     Running   0               3m40s
calico-node-58hmw                         1/1     Running   0               3m40s
calico-node-d755v                         1/1     Running   0               3m40s
calico-node-tf5lf                         1/1     Running   0               3m40s
calico-node-v5pkb                         1/1     Running   0               3m40s
coredns-7d89d9b6b8-d8z2q                  1/1     Running   0               95m
coredns-7d89d9b6b8-qc2t2                  1/1     Running   0               95m
etcd-k8s-master-1                         1/1     Running   3               95m
etcd-k8s-master-2                         1/1     Running   0               58m
etcd-k8s-master-3                         1/1     Running   0               57m
kube-apiserver-k8s-master-1               1/1     Running   4 (57s ago)     95m
kube-apiserver-k8s-master-2               1/1     Running   0               58m
kube-apiserver-k8s-master-3               1/1     Running   1 (57m ago)     57m
kube-controller-manager-k8s-master-1      1/1     Running   6 (2m8s ago)    95m
kube-controller-manager-k8s-master-2      1/1     Running   1 (2m49s ago)   58m
kube-controller-manager-k8s-master-3      1/1     Running   1 (59s ago)     56m
kube-proxy-8n2pg                          1/1     Running   0               47m
kube-proxy-jkrpg                          1/1     Running   0               95m
kube-proxy-qfbqd                          1/1     Running   0               57m
kube-proxy-ss2sf                          1/1     Running   0               58m
kube-proxy-whd5p                          1/1     Running   0               47m
kube-scheduler-k8s-master-1               1/1     Running   5 (2m8s ago)    95m
kube-scheduler-k8s-master-2               1/1     Running   1 (3m12s ago)   58m
kube-scheduler-k8s-master-3               1/1     Running   1 (59s ago)     56m

image

[root@k8s-master-1 ~/k8s-ha-install/calico]# kubectl get node
NAME           STATUS   ROLES                  AGE   VERSION
k8s-master-1   Ready    control-plane,master   96m   v1.22.5
k8s-master-2   Ready    control-plane,master   59m   v1.22.5
k8s-master-3   Ready    control-plane,master   58m   v1.22.5
k8s-node-1     Ready    <none>                 48m   v1.22.5
k8s-node-2     Ready    <none>                 48m   v1.22.5

image

第九章、Kubernetes集群部署Metrics、Dbshboard

1、Kubernetes集群部署Metrics服务

在新版的Kubernetes中系统资源的采集均使用Metrics-server,可以通过Metrics采集节点和Pod的内存、磁盘、CPU和网络的使用率。

Master-1节点的front-proxy-ca.crt复制到所有Node节点

scp /etc/kubernetes/pki/front-proxy-ca.crt k8s-node-1:/etc/kubernetes/pki/front-proxy-ca.crt
scp /etc/kubernetes/pki/front-proxy-ca.crt k8s-node-2:/etc/kubernetes/pki/front-proxy-ca.crt

安装Metrics-Server

[root@k8s-master-1 ~]# cd /root/k8s-ha-install/metrics-server-0.4.x-kubeadm/
[root@k8s-master-1 ~/k8s-ha-install/metrics-server-0.4.x-kubeadm]# kubectl  create -f comp.yaml
serviceaccount/metrics-server created
clusterrole.rbac.authorization.k8s.io/system:aggregated-metrics-reader created
clusterrole.rbac.authorization.k8s.io/system:metrics-server created
rolebinding.rbac.authorization.k8s.io/metrics-server-auth-reader created
clusterrolebinding.rbac.authorization.k8s.io/metrics-server:system:auth-delegator created
clusterrolebinding.rbac.authorization.k8s.io/system:metrics-server created
service/metrics-server created
deployment.apps/metrics-server created
apiservice.apiregistration.k8s.io/v1beta1.metrics.k8s.io created

查看状态

[root@k8s-master-1 ~/k8s-ha-install/metrics-server-0.4.x-kubeadm]# kubectl get po -n kube-system -l k8s-app=metrics-server
NAME                             READY   STATUS    RESTARTS   AGE
metrics-server-d6c46b546-znmb5   1/1     Running   0          118s

image

[root@k8s-master-1 ~/k8s-ha-install/metrics-server-0.4.x-kubeadm]# kubectl top node --use-protocol-buffers
NAME           CPU(cores)   CPU%   MEMORY(bytes)   MEMORY%
k8s-master-1   181m         4%     1734Mi          10%
k8s-master-2   156m         7%     1339Mi          17%
k8s-master-3   176m         8%     1335Mi          16%
k8s-node-1     87m          4%     908Mi           23%
k8s-node-2     119m         5%     1178Mi          30%

image

[root@k8s-master-1 ~/k8s-ha-install/metrics-server-0.4.x-kubeadm]# kubectl top po --use-protocol-buffers -A
NAMESPACE     NAME                                      CPU(cores)   MEMORY(bytes)
kube-system   calico-kube-controllers-cdd5755b9-n6nmw   2m           21Mi
kube-system   calico-node-27tfg                         22m          72Mi
kube-system   calico-node-58hmw                         24m          75Mi
kube-system   calico-node-d755v                         21m          78Mi
kube-system   calico-node-tf5lf                         21m          74Mi
kube-system   calico-node-v5pkb                         19m          76Mi
kube-system   coredns-7d89d9b6b8-d8z2q                  2m           20Mi
kube-system   coredns-7d89d9b6b8-qc2t2                  2m           17Mi
kube-system   etcd-k8s-master-1                         27m          98Mi
kube-system   etcd-k8s-master-2                         31m          91Mi
kube-system   etcd-k8s-master-3                         28m          95Mi
kube-system   kube-apiserver-k8s-master-1               50m          261Mi
kube-system   kube-apiserver-k8s-master-2               54m          306Mi
kube-system   kube-apiserver-k8s-master-3               50m          288Mi
kube-system   kube-controller-manager-k8s-master-1      11m          55Mi
kube-system   kube-controller-manager-k8s-master-2      2m           27Mi
kube-system   kube-controller-manager-k8s-master-3      1m           28Mi
kube-system   kube-proxy-8n2pg                          1m           20Mi
kube-system   kube-proxy-jkrpg                          1m           21Mi
kube-system   kube-proxy-qfbqd                          1m           19Mi
kube-system   kube-proxy-ss2sf                          1m           17Mi
kube-system   kube-proxy-whd5p                          1m           16Mi
kube-system   kube-scheduler-k8s-master-1               3m           28Mi
kube-system   kube-scheduler-k8s-master-2               3m           25Mi
kube-system   kube-scheduler-k8s-master-3               2m           24Mi
kube-system   metrics-server-d6c46b546-znmb5            4m           13Mi

image

2、Kubernetes集群部署Dashboard服务

Dashboard用于展示集群中的各类资源,同时也可以通过Dashboard实时查看Pod的日志和在容器中执行一些命令等。

2.1 Kubernetes集群部署指定版本Dashboard服务

cd /root/k8s-ha-install/dashboard/

[root@k8s-master-1 ~/k8s-ha-install/dashboard]# kubectl create -f .
serviceaccount/admin-user created
clusterrolebinding.rbac.authorization.k8s.io/admin-user created
namespace/kubernetes-dashboard created
serviceaccount/kubernetes-dashboard created
service/kubernetes-dashboard created
secret/kubernetes-dashboard-certs created
secret/kubernetes-dashboard-csrf created
secret/kubernetes-dashboard-key-holder created
configmap/kubernetes-dashboard-settings created
role.rbac.authorization.k8s.io/kubernetes-dashboard created
clusterrole.rbac.authorization.k8s.io/kubernetes-dashboard created
rolebinding.rbac.authorization.k8s.io/kubernetes-dashboard created
clusterrolebinding.rbac.authorization.k8s.io/kubernetes-dashboard created
deployment.apps/kubernetes-dashboard created
service/dashboard-metrics-scraper created
Warning: spec.template.metadata.annotations[seccomp.security.alpha.kubernetes.io/pod]: deprecated since v1.19; use the "seccompProfile" field instead
deployment.apps/dashboard-metrics-scraper created

登录dashboard

在谷歌浏览器(Chrome)启动文件中加入启动参数,用于解决无法访问Dashboard的问题,windows系统参考图1-1:

图1-1 谷歌浏览器 Chrome的配置

--test-type --ignore-certificate-errors

image
mac系统参考图1-2:
image

具体配置步骤如下:

# 1.打开 Terminal 进入终端状态,默认的提示符应该是 $; 
# 2.进入 Chrome.app 目录输入:
cd "/Applications/Google Chrome.app/Contents/MacOS/"
# 3.将原先的启动脚本改个名字;
mv "Google Chrome" Google.real 
# 4.使用管道操作创建新的启动脚本,注意其中加入你所需要的启动参数:
printf '#!/bin/bash\ncd "/Applications/Google Chrome.app/Contents/MacOS"\n"/Applications/Google Chrome.app/Contents/MacOS/Google.real" --test-type --ignore-certificate-errors "$@"\n' > Google\ Chrome
# 5.给新的脚本加上运行权限:
chmod u+x "Google Chrome" 
配置完成后重新启动 Google Chrome 就是可以了。

更改dashboardsvcNodePort

kubectl edit svc kubernetes-dashboard -n kubernetes-dashboard
type: NodePort
# 保存方式:shift+zz

image

ClusterIP更改为NodePort(如果已经为NodePort忽略此步骤):

image

查看端口号:

[root@k8s-master-1 ~]# kubectl get svc kubernetes-dashboard -n kubernetes-dashboard
NAME                   TYPE       CLUSTER-IP      EXTERNAL-IP   PORT(S)         AGE
kubernetes-dashboard   NodePort   10.168.97.176   <none>        443:30666/TCP   55m

image

根据自己的实例端口号,通过任意安装了kube-proxy的宿主机的IP+端口即可访问到dashboard:访问Dashboardhttps://192.168.150.236:30666(请更改30666为自己的端口),选择登录方式为令牌(即token方式),参考图1-2

image

查看Token

[root@k8s-master-1 ~]# kubectl -n kube-system describe secret $(kubectl -n kube-system get secret | grep admin-user | awk '{print $1}')
Name:         admin-user-token-sb7d9
Namespace:    kube-system
Labels:       <none>
Annotations:  kubernetes.io/service-account.name: admin-user
              kubernetes.io/service-account.uid: 9e408711-23c9-4d9d-87bc-0810a3ef74f0

Type:  kubernetes.io/service-account-token

Data
====
ca.crt:     1099 bytes
namespace:  11 bytes
token:      eyJhbGciOiJSUzI1NiIsImtpZCI6IlR0NlFraVdsalVUQ3dSZ01DWUF5eXJVZnhFR29zZ1dIdU5wN090OFd0Y0EifQ.eyJpc3MiOiJrdWJlcm5ldGVzL3NlcnZpY2VhY2NvdW50Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9uYW1lc3BhY2UiOiJrdWJlLXN5c3RlbSIsImt1YmVybmV0ZXMuaW8vc2VydmljZWFjY291bnQvc2VjcmV0Lm5hbWUiOiJhZG1pbi11c2VyLXRva2VuLXNiN2Q5Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9zZXJ2aWNlLWFjY291bnQubmFtZSI6ImFkbWluLXVzZXIiLCJrdWJlcm5ldGVzLmlvL3NlcnZpY2VhY2NvdW50L3NlcnZpY2UtYWNjb3VudC51aWQiOiI5ZTQwODcxMS0yM2M5LTRkOWQtODdiYy0wODEwYTNlZjc0ZjAiLCJzdWIiOiJzeXN0ZW06c2VydmljZWFjY291bnQ6a3ViZS1zeXN0ZW06YWRtaW4tdXNlciJ9.Ov0Aq6iwWSzaCMprRC85qQcoM2XtqlYDUx9SE1X9Tg03RIeMxz0Ue0zd4hibhvYqxvre6wel8cuwgk1t7IbjHV9U7BgroXN2wjh40TUQuDyDoU5PAy2y9EqMnbnTMmCOmUse9Z74Eeprvja6IBFLeuvDNapoJXhYYMCht9wsJBxE_unO4iRW2Ad7vAcVhYS1D1DgolC3B9AD8T4wI8cbcV_esDBYuIuWNd4R6_nMhbli10qIJ44vE5fQj32Qd2zeBiwh4C_eGAwXB5Z89-VswGPIJBlZvKsofNoLy5kxEUmVMDT1KjfmjLAaFScZB8SaQIWu3AeNiqFt_ZQieHuURQ

token值输入到令牌后,单击登录即可访问Dashboard

image

第十章、配置IPVS

Kube-proxy改为ipvs模式,因为在初始化集群的时候注释了ipvs配置,因此需要自行修改一下,在Master-1节点执行:

kubectl edit cm kube-proxy -n kube-system
mode: "ipvs"

更新Kube-ProxyPod

kubectl patch daemonset kube-proxy -p "{\"spec\":{\"template\":{\"metadata\":{\"annotations\":{\"date\":\"`date +'%s'`\"}}}}}" -n kube-system

验证Kube-Proxy模式:

[root@k8s-master-1 ~]# curl 127.0.0.1:10249/proxyMode
ipvs

第十一章、Kubernetes集群验证

1、所有Namespace容器查看

[root@k8s-master-1 ~]# kubectl get po --all-namespaces
NAMESPACE              NAME                                         READY   STATUS    RESTARTS        AGE
kube-system            calico-kube-controllers-cdd5755b9-n6nmw      1/1     Running   0               6h50m
kube-system            calico-node-27tfg                            1/1     Running   0               6h50m
kube-system            calico-node-58hmw                            1/1     Running   0               6h50m
kube-system            calico-node-d755v                            1/1     Running   0               6h50m
kube-system            calico-node-tf5lf                            1/1     Running   0               6h50m
kube-system            calico-node-v5pkb                            1/1     Running   0               6h50m
kube-system            coredns-7d89d9b6b8-d8z2q                     1/1     Running   0               8h
kube-system            coredns-7d89d9b6b8-qc2t2                     1/1     Running   0               8h
kube-system            etcd-k8s-master-1                            1/1     Running   3               8h
kube-system            etcd-k8s-master-2                            1/1     Running   0               7h45m
kube-system            etcd-k8s-master-3                            1/1     Running   0               7h44m
kube-system            kube-apiserver-k8s-master-1                  1/1     Running   4 (6h47m ago)   8h
kube-system            kube-apiserver-k8s-master-2                  1/1     Running   0               7h45m
kube-system            kube-apiserver-k8s-master-3                  1/1     Running   1 (7h44m ago)   7h43m
kube-system            kube-controller-manager-k8s-master-1         1/1     Running   7 (4h42m ago)   8h
kube-system            kube-controller-manager-k8s-master-2         1/1     Running   1 (6h49m ago)   7h45m
kube-system            kube-controller-manager-k8s-master-3         1/1     Running   1 (6h47m ago)   7h43m
kube-system            kube-proxy-46jd9                             1/1     Running   0               34m
kube-system            kube-proxy-bs9rl                             1/1     Running   0               34m
kube-system            kube-proxy-cs5rn                             1/1     Running   0               34m
kube-system            kube-proxy-gh9jx                             1/1     Running   0               34m
kube-system            kube-proxy-n6tzc                             1/1     Running   0               34m
kube-system            kube-scheduler-k8s-master-1                  1/1     Running   6 (4h42m ago)   8h
kube-system            kube-scheduler-k8s-master-2                  1/1     Running   1 (6h49m ago)   7h45m
kube-system            kube-scheduler-k8s-master-3                  1/1     Running   1 (6h47m ago)   7h43m
kube-system            metrics-server-d6c46b546-znmb5               1/1     Running   0               4h57m
kubernetes-dashboard   dashboard-metrics-scraper-86bb69c5f6-85lvs   1/1     Running   0               4h42m
kubernetes-dashboard   kubernetes-dashboard-6576c84894-nbtd6        1/1     Running   0               4h42m

image

2、查看CPU、内存监控数据

[root@k8s-master-1 ~]# kubectl top po -n kube-system
NAME                                      CPU(cores)   MEMORY(bytes)
calico-kube-controllers-cdd5755b9-n6nmw   2m           21Mi
calico-node-27tfg                         26m          72Mi
calico-node-58hmw                         17m          76Mi
calico-node-d755v                         23m          79Mi
calico-node-tf5lf                         23m          75Mi
calico-node-v5pkb                         28m          76Mi
coredns-7d89d9b6b8-d8z2q                  2m           20Mi
coredns-7d89d9b6b8-qc2t2                  2m           18Mi
etcd-k8s-master-1                         30m          97Mi
etcd-k8s-master-2                         31m          88Mi
etcd-k8s-master-3                         26m          93Mi
kube-apiserver-k8s-master-1               46m          295Mi
kube-apiserver-k8s-master-2               45m          313Mi
kube-apiserver-k8s-master-3               45m          314Mi
kube-controller-manager-k8s-master-1      2m           28Mi
kube-controller-manager-k8s-master-2      2m           27Mi
kube-controller-manager-k8s-master-3      11m          61Mi
kube-proxy-46jd9                          11m          22Mi
kube-proxy-bs9rl                          11m          21Mi
kube-proxy-cs5rn                          11m          20Mi
kube-proxy-gh9jx                          1m           21Mi
kube-proxy-n6tzc                          14m          22Mi
kube-scheduler-k8s-master-1               3m           27Mi
kube-scheduler-k8s-master-2               3m           27Mi
kube-scheduler-k8s-master-3               2m           25Mi
metrics-server-d6c46b546-znmb5            4m           20Mi

image

3、Kubernetes集群svc网络验证

# 1.查看Kubernetes集群第一个svc网络: 
[root@k8s-master-1 ~]# kubectl get svc
NAME         TYPE        CLUSTER-IP   EXTERNAL-IP   PORT(S)   AGE
kubernetes   ClusterIP   10.168.0.1   <none>        443/TCP   19h

# 2.查看Kubernetes集群第十个svc网络地址: 
[root@k8s-master-1 ~]# kubectl get svc -n kube-system
NAME             TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)                  AGE
kube-dns         ClusterIP   10.168.0.10     <none>        53/UDP,53/TCP,9153/TCP   20h
metrics-server   ClusterIP   10.168.192.33   <none>        443/TCP                  16h

# 3.测试Kubernetes集群所有主机对svc网络是否能Telnet通:
# Master-1节点测试:
[root@k8s-master-1 ~]# telnet 10.168.0.1 443
Trying 10.168.0.1...
Connected to 10.168.0.1.
Escape character is '^]'.
[root@k8s-master-1 ~]# telnet 10.168.0.10 53
Trying 10.168.0.10...
Connected to 10.168.0.10.
Escape character is '^]'.
Connection closed by foreign host.
# Master-2节点测试:
[root@k8s-master-2 ~]# telnet 10.168.0.1 443
Trying 10.168.0.1...
Connected to 10.168.0.1.
Escape character is '^]'.
^CConnection closed by foreign host.
您在 /var/spool/mail/root 中有新邮件
[root@k8s-master-2 ~]# telnet 10.168.0.10 53
Trying 10.168.0.10...
Connected to 10.168.0.10.
Escape character is '^]'.
Connection closed by foreign host.
# Master-3节点测试:
[root@k8s-master-3 ~]# telnet 10.168.0.1 443
Trying 10.168.0.1...
Connected to 10.168.0.1.
Escape character is '^]'.
^CConnection closed by foreign host.
[root@k8s-master-3 ~]# telnet 10.168.0.10 53
Trying 10.168.0.10...
Connected to 10.168.0.10.
Escape character is '^]'.
Connection closed by foreign host.
# Node节点测试:
[root@k8s-node-1 ~]# telnet 10.168.0.10 53
Trying 10.168.0.10...
Connected to 10.168.0.10.
Escape character is '^]'.
Connection closed by foreign host.
[root@k8s-node-1 ~]# telnet 10.168.0.1 443
Trying 10.168.0.1...
Connected to 10.168.0.1.
Escape character is '^]'.
^CConnection closed by foreign host.
[root@k8s-node-2 ~]# telnet 10.168.0.1 443
Trying 10.168.0.1...
Connected to 10.168.0.1.
Escape character is '^]'.
^CConnection closed by foreign host.
[root@k8s-node-2 ~]# telnet 10.168.0.10 53
Trying 10.168.0.10...
Connected to 10.168.0.10.
Escape character is '^]'.
Connection closed by foreign host.

image

image

image

image

image

4、Kubernetes集群所有主机对容器IP是否通

# 1.查看所有服务部署所在节点:
[root@k8s-master-1 ~]# kubectl get po --all-namespaces -owide
NAMESPACE              NAME                                         READY   STATUS    RESTARTS      AGE   IP                NODE           NOMINATED NODE   READINESS GATES
kube-system            calico-kube-controllers-cdd5755b9-n6nmw      1/1     Running   0             18h   192.168.150.124   k8s-node-2     <none>           <none>
kube-system            calico-node-27tfg                            1/1     Running   0             18h   192.168.150.124   k8s-node-2     <none>           <none>
kube-system            calico-node-58hmw                            1/1     Running   0             18h   192.168.150.127   k8s-master-3   <none>           <none>
kube-system            calico-node-d755v                            1/1     Running   0             18h   192.168.150.126   k8s-master-2   <none>           <none>
kube-system            calico-node-tf5lf                            1/1     Running   0             18h   192.168.150.123   k8s-node-1     <none>           <none>
kube-system            calico-node-v5pkb                            1/1     Running   0             18h   192.168.150.125   k8s-master-1   <none>           <none>
kube-system            coredns-7d89d9b6b8-d8z2q                     1/1     Running   0             20h   172.20.140.65     k8s-node-2     <none>           <none>
kube-system            coredns-7d89d9b6b8-qc2t2                     1/1     Running   0             20h   172.20.140.66     k8s-node-2     <none>           <none>
kube-system            etcd-k8s-master-1                            1/1     Running   3             20h   192.168.150.125   k8s-master-1   <none>           <none>
kube-system            etcd-k8s-master-2                            1/1     Running   0             19h   192.168.150.126   k8s-master-2   <none>           <none>
kube-system            etcd-k8s-master-3                            1/1     Running   0             19h   192.168.150.127   k8s-master-3   <none>           <none>
kube-system            kube-apiserver-k8s-master-1                  1/1     Running   4 (18h ago)   20h   192.168.150.125   k8s-master-1   <none>           <none>
kube-system            kube-apiserver-k8s-master-2                  1/1     Running   0             19h   192.168.150.126   k8s-master-2   <none>           <none>
kube-system            kube-apiserver-k8s-master-3                  1/1     Running   1 (19h ago)   19h   192.168.150.127   k8s-master-3   <none>           <none>
kube-system            kube-controller-manager-k8s-master-1         1/1     Running   7 (16h ago)   20h   192.168.150.125   k8s-master-1   <none>           <none>
kube-system            kube-controller-manager-k8s-master-2         1/1     Running   1 (18h ago)   19h   192.168.150.126   k8s-master-2   <none>           <none>
kube-system            kube-controller-manager-k8s-master-3         1/1     Running   1 (18h ago)   19h   192.168.150.127   k8s-master-3   <none>           <none>
kube-system            kube-proxy-46jd9                             1/1     Running   0             12h   192.168.150.123   k8s-node-1     <none>           <none>
kube-system            kube-proxy-bs9rl                             1/1     Running   0             12h   192.168.150.125   k8s-master-1   <none>           <none>
kube-system            kube-proxy-cs5rn                             1/1     Running   0             12h   192.168.150.126   k8s-master-2   <none>           <none>
kube-system            kube-proxy-gh9jx                             1/1     Running   0             12h   192.168.150.127   k8s-master-3   <none>           <none>
kube-system            kube-proxy-n6tzc                             1/1     Running   0             12h   192.168.150.124   k8s-node-2     <none>           <none>
kube-system            kube-scheduler-k8s-master-1                  1/1     Running   6 (16h ago)   20h   192.168.150.125   k8s-master-1   <none>           <none>
kube-system            kube-scheduler-k8s-master-2                  1/1     Running   1 (18h ago)   19h   192.168.150.126   k8s-master-2   <none>           <none>
kube-system            kube-scheduler-k8s-master-3                  1/1     Running   1 (18h ago)   19h   192.168.150.127   k8s-master-3   <none>           <none>
kube-system            metrics-server-d6c46b546-znmb5               1/1     Running   0             17h   172.17.201.1      k8s-node-1     <none>           <none>
kubernetes-dashboard   dashboard-metrics-scraper-86bb69c5f6-85lvs   1/1     Running   0             16h   172.17.251.194    k8s-master-1   <none>           <none>
kubernetes-dashboard   kubernetes-dashboard-6576c84894-nbtd6        1/1     Running   0             16h   172.17.251.193    k8s-master-1   <none>           <none>

# 2.验证所有节点对容器:kubernetes-dashboard-6576c84894-nbtd6 IP:172.17.251.193是否能ping通:
# Master-1节点:
[root@k8s-master-1 ~]# ping 172.17.251.193
PING 172.17.251.193 (172.17.251.193) 56(84) bytes of data.
64 bytes from 172.17.251.193: icmp_seq=1 ttl=64 time=0.068 ms
64 bytes from 172.17.251.193: icmp_seq=2 ttl=64 time=0.088 ms
64 bytes from 172.17.251.193: icmp_seq=3 ttl=64 time=0.041 ms
# Master-2节点:
[root@k8s-master-2 ~]# ping 172.17.251.193
PING 172.17.251.193 (172.17.251.193) 56(84) bytes of data.
64 bytes from 172.17.251.193: icmp_seq=1 ttl=63 time=0.310 ms
64 bytes from 172.17.251.193: icmp_seq=2 ttl=63 time=0.170 ms
# Master-3节点:
[root@k8s-master-3 ~]# ping 172.17.251.193
PING 172.17.251.193 (172.17.251.193) 56(84) bytes of data.
64 bytes from 172.17.251.193: icmp_seq=1 ttl=63 time=0.232 ms
64 bytes from 172.17.251.193: icmp_seq=2 ttl=63 time=0.228 ms
# Node-1节点:
[root@k8s-node-1 ~]# ping 172.17.251.193
PING 172.17.251.193 (172.17.251.193) 56(84) bytes of data.
64 bytes from 172.17.251.193: icmp_seq=1 ttl=63 time=0.491 ms
64 bytes from 172.17.251.193: icmp_seq=2 ttl=63 time=0.378 ms
# Node-2节点:
[root@k8s-node-2 ~]# ping 172.17.251.193
PING 172.17.251.193 (172.17.251.193) 56(84) bytes of data.
64 bytes from 172.17.251.193: icmp_seq=1 ttl=63 time=0.542 ms
64 bytes from 172.17.251.193: icmp_seq=2 ttl=63 time=0.300 ms

image

image

image

image

image

5、测试Kubernetes集群Pod与Pod之间是否通

# 1.查看所有Pod节点部署所在的节点位置:
[root@k8s-master-1 ~]# kubectl get po --all-namespaces -owide
NAMESPACE              NAME                                         READY   STATUS    RESTARTS      AGE   IP                NODE           NOMINATED NODE   READINESS GATES
kube-system            calico-kube-controllers-cdd5755b9-n6nmw      1/1     Running   0             19h   192.168.150.124   k8s-node-2     <none>           <none>
kube-system            calico-node-27tfg                            1/1     Running   0             19h   192.168.150.124   k8s-node-2     <none>           <none>
kube-system            calico-node-58hmw                            1/1     Running   0             19h   192.168.150.127   k8s-master-3   <none>           <none>
kube-system            calico-node-d755v                            1/1     Running   0             19h   192.168.150.126   k8s-master-2   <none>           <none>
kube-system            calico-node-tf5lf                            1/1     Running   0             19h   192.168.150.123   k8s-node-1     <none>           <none>
kube-system            calico-node-v5pkb                            1/1     Running   0             19h   192.168.150.125   k8s-master-1   <none>           <none>
kube-system            coredns-7d89d9b6b8-d8z2q                     1/1     Running   0             20h   172.20.140.65     k8s-node-2     <none>           <none>
kube-system            coredns-7d89d9b6b8-qc2t2                     1/1     Running   0             20h   172.20.140.66     k8s-node-2     <none>           <none>
kube-system            etcd-k8s-master-1                            1/1     Running   3             20h   192.168.150.125   k8s-master-1   <none>           <none>
kube-system            etcd-k8s-master-2                            1/1     Running   0             20h   192.168.150.126   k8s-master-2   <none>           <none>
kube-system            etcd-k8s-master-3                            1/1     Running   0             20h   192.168.150.127   k8s-master-3   <none>           <none>
kube-system            kube-apiserver-k8s-master-1                  1/1     Running   4 (19h ago)   20h   192.168.150.125   k8s-master-1   <none>           <none>
kube-system            kube-apiserver-k8s-master-2                  1/1     Running   0             20h   192.168.150.126   k8s-master-2   <none>           <none>
kube-system            kube-apiserver-k8s-master-3                  1/1     Running   1 (20h ago)   20h   192.168.150.127   k8s-master-3   <none>           <none>
kube-system            kube-controller-manager-k8s-master-1         1/1     Running   7 (17h ago)   20h   192.168.150.125   k8s-master-1   <none>           <none>
kube-system            kube-controller-manager-k8s-master-2         1/1     Running   1 (19h ago)   20h   192.168.150.126   k8s-master-2   <none>           <none>
kube-system            kube-controller-manager-k8s-master-3         1/1     Running   1 (19h ago)   20h   192.168.150.127   k8s-master-3   <none>           <none>
kube-system            kube-proxy-46jd9                             1/1     Running   0             12h   192.168.150.123   k8s-node-1     <none>           <none>
kube-system            kube-proxy-bs9rl                             1/1     Running   0             12h   192.168.150.125   k8s-master-1   <none>           <none>
kube-system            kube-proxy-cs5rn                             1/1     Running   0             12h   192.168.150.126   k8s-master-2   <none>           <none>
kube-system            kube-proxy-gh9jx                             1/1     Running   0             12h   192.168.150.127   k8s-master-3   <none>           <none>
kube-system            kube-proxy-n6tzc                             1/1     Running   0             12h   192.168.150.124   k8s-node-2     <none>           <none>
kube-system            kube-scheduler-k8s-master-1                  1/1     Running   6 (17h ago)   20h   192.168.150.125   k8s-master-1   <none>           <none>
kube-system            kube-scheduler-k8s-master-2                  1/1     Running   1 (19h ago)   20h   192.168.150.126   k8s-master-2   <none>           <none>
kube-system            kube-scheduler-k8s-master-3                  1/1     Running   1 (19h ago)   20h   192.168.150.127   k8s-master-3   <none>           <none>
kube-system            metrics-server-d6c46b546-znmb5               1/1     Running   0             17h   172.17.201.1      k8s-node-1     <none>           <none>
kubernetes-dashboard   dashboard-metrics-scraper-86bb69c5f6-85lvs   1/1     Running   0             17h   172.17.251.194    k8s-master-1   <none>           <none>
kubernetes-dashboard   kubernetes-dashboard-6576c84894-nbtd6        1/1     Running   0             17h   172.17.251.193    k8s-master-1   <none>           <none>

# 2.测试Pod:calico-node-58hmw容器内弄否ping通Pod:dashboard-metrics-scraper-86bb69c5f6-85lvs的IP:172.17.251.194
[root@k8s-master-1 ~]# kubectl exec -it calico-node-58hmw -n kube-system -- sh
Defaulted container "calico-node" out of: calico-node, install-cni (init), flexvol-driver (init)
sh-4.4# ping 172.17.251.194
PING 172.17.251.194 (172.17.251.194) 56(84) bytes of data.
64 bytes from 172.17.251.194: icmp_seq=1 ttl=63 time=0.203 ms
64 bytes from 172.17.251.194: icmp_seq=2 ttl=63 time=0.179 ms
64 bytes from 172.17.251.194: icmp_seq=3 ttl=63 time=0.241 ms

image

6、测试Kubernetes集群任意节点登录Dashboard页面

# 1.
[root@k8s-master-1 ~]# kubectl get svc -n kubernetes-dashboard
NAME                        TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)         AGE
dashboard-metrics-scraper   ClusterIP   10.168.4.85     <none>        8000/TCP        17h
kubernetes-dashboard        NodePort    10.168.97.176   <none>        443:30666/TCP   17h
# 2.变更类型为NodeProt(变更过就不需要更改)
[root@k8s-master-1 ~]# kubectl edit svc -n kubernetes-dashboard -n !$
type: NodePort
# 3.查看端口:
[root@k8s-master-1 ~]# kubectl get svc -n kubernetes-dashboard
NAME                        TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)         AGE
dashboard-metrics-scraper   ClusterIP   10.168.4.85     <none>        8000/TCP        17h
kubernetes-dashboard        NodePort    10.168.97.176   <none>        443:30666/TCP   17h
# 4.打开Google Chrome浏览器测试:https://192.168.150.125:30666
# 5.查看Token:
[root@k8s-master-1 ~]# kubectl -n kube-system describe secret $(kubectl -n kube-system get secret | grep admin-user | awk '{print $1}')
Name:         admin-user-token-sb7d9
Namespace:    kube-system
Labels:       <none>
Annotations:  kubernetes.io/service-account.name: admin-user
              kubernetes.io/service-account.uid: 9e408711-23c9-4d9d-87bc-0810a3ef74f0

Type:  kubernetes.io/service-account-token

Data
====
ca.crt:     1099 bytes
namespace:  11 bytes
token:      eyJhbGciOiJSUzI1NiIsImtpZCI6IlR0NlFraVdsalVUQ3dSZ01DWUF5eXJVZnhFR29zZ1dIdU5wN090OFd0Y0EifQ.eyJpc3MiOiJrdWJlcm5ldGVzL3NlcnZpY2VhY2NvdW50Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9uYW1lc3BhY2UiOiJrdWJlLXN5c3RlbSIsImt1YmVybmV0ZXMuaW8vc2VydmljZWFjY291bnQvc2VjcmV0Lm5hbWUiOiJhZG1pbi11c2VyLXRva2VuLXNiN2Q5Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9zZXJ2aWNlLWFjY291bnQubmFtZSI6ImFkbWluLXVzZXIiLCJrdWJlcm5ldGVzLmlvL3NlcnZpY2VhY2NvdW50L3NlcnZpY2UtYWNjb3VudC51aWQiOiI5ZTQwODcxMS0yM2M5LTRkOWQtODdiYy0wODEwYTNlZjc0ZjAiLCJzdWIiOiJzeXN0ZW06c2VydmljZWFjY291bnQ6a3ViZS1zeXN0ZW06YWRtaW4tdXNlciJ9.Ov0Aq6iwWSzaCMprRC85qQcoM2XtqlYDUx9SE1X9Tg03RIeMxz0Ue0zd4hibhvYqxvre6wel8cuwgk1t7IbjHV9U7BgroXN2wjh40TUQuDyDoU5PAy2y9EqMnbnTMmCOmUse9Z74Eeprvja6IBFLeuvDNapoJXhYYMCht9wsJBxE_unO4iRW2Ad7vAcVhYS1D1DgolC3B9AD8T4wI8cbcV_esDBYuIuWNd4R6_nMhbli10qIJ44vE5fQj32Qd2zeBiwh4C_eGAwXB5Z89-VswGPIJBlZvKsofNoLy5kxEUmVMDT1KjfmjLAaFScZB8SaQIWu3AeNiqFt_ZQieHuURQ

image

image

posted @ 2021-12-30 11:19  婷婷~玉立  阅读(13)  评论(0编辑  收藏  举报