0

我在虚拟机虚拟机上使用 Kubeadm 创建了一个 Kubernetes 集群。我正在尝试从 v1.18.0 升级到 v1.20.5。但我只是为了获得升级计划而遇到问题。该问题与etcd有关。下面解释。

簇:

  • 2个主节点
  • 2 个子节点
  • 两个主节点中的 2 个 ETCD 成员
  • 1个负载均衡器

ETCD 成员列表 集群健康。

ID 地位 姓名 同行地址 客户地址
71e6a7dee81f2d25 开始 大师-2 https://192.168.5.12:2380 https://192.168.5.12:2379
c0f09c2e98e39311 开始 大师-1 https://192.168.5.11:2380 https://192.168.5.11:2379

节点

姓名 地位 角色 年龄 版本 内部IP
大师-1 准备好 掌握 10小时 v1.18.0 192.168.5.11
大师-2 准备好 掌握 10小时 v1.18.0 192.168.5.12
工人1 准备好 10小时 v1.18.0 192.168.5.21
工人 2 准备好 10小时 v1.18.0 192.168.5.22

问题

当我尝试使用“kubeadm upgrade plan”获取升级计划时,出现以下错误。

错误

**Command**
kubeadm upgrade plan
**I0405 08:35:19.395064    8137 etcd.go:512] Failed to get etcd status for https://192.168.5.12:2379: failed to dial endpoint https://192.168.5.12:2379 with maintenance client: context deadline exceeded**

检查连接 Master-1

Connection to 192.168.5.11 2379 port [tcp/*] succeeded!
Connection to 192.168.5.12 2379 port [tcp/*] succeeded!

大师-2

Connection to 192.168.5.11 2379 port [tcp/*] succeeded!
Connection to 192.168.5.12 2379 port [tcp/*] succeeded!

主节点上的 ETCD 成员 1 定义:192.168.5.11

apiVersion: v1
kind: Pod
metadata:
  annotations:
    kubeadm.kubernetes.io/etcd.advertise-client-urls: https://192.168.5.11:2379
  creationTimestamp: null
  labels:
    component: etcd
    tier: control-plane
  name: etcd
  namespace: kube-system
spec:
  containers:
  - command:
    - etcd
    - --advertise-client-urls=https://192.168.5.11:2379
    - --cert-file=/etc/kubernetes/pki/etcd/server.crt
    - --client-cert-auth=true
    - --data-dir=/var/lib/etcd
    - --initial-advertise-peer-urls=https://192.168.5.11:2380
    - --initial-cluster=master-1=https://192.168.5.11:2380,master-2=https://192.168.5.12:2380
    - --key-file=/etc/kubernetes/pki/etcd/server.key
    - --listen-client-urls=https://127.0.0.1:2379,https://192.168.5.11:2379
    - --listen-metrics-urls=http://127.0.0.1:2381
    - --listen-peer-urls=https://192.168.5.11:2380
    - --name=master-1
    - --peer-cert-file=/etc/kubernetes/pki/etcd/peer.crt
    - --peer-client-cert-auth=true
    - --peer-key-file=/etc/kubernetes/pki/etcd/peer.key
    - --peer-trusted-ca-file=/etc/kubernetes/pki/etcd/ca.crt
    - --snapshot-count=10000
    - --trusted-ca-file=/etc/kubernetes/pki/etcd/ca.crt
    image: k8s.gcr.io/etcd:3.4.3-0

主节点上的 ETCD 成员 2 定义:192.168.5.12

apiVersion: v1
kind: Pod
metadata:
  annotations:
    kubeadm.kubernetes.io/etcd.advertise-client-urls: https://192.168.5.12:2379
  creationTimestamp: null
  labels:
    component: etcd
    tier: control-plane
  name: etcd
  namespace: kube-system
spec:
  containers:
  - command:
    - etcd
    - --advertise-client-urls=https://192.168.5.12:2379
    - --cert-file=/etc/kubernetes/pki/etcd/server.crt
    - --client-cert-auth=true
    - --data-dir=/var/lib/etcd
    - --initial-advertise-peer-urls=https://192.168.5.12:2380
    - --initial-cluster=master-2=https://192.168.5.12:2380,master-1=https://192.168.5.11:2380
    - --initial-cluster-state=existing
    - --key-file=/etc/kubernetes/pki/etcd/server.key
    - --listen-client-urls=https://127.0.0.1:2379,https://192.168.5.12:2379
    - --listen-metrics-urls=http://127.0.0.1:2381
    - --listen-peer-urls=https://192.168.5.12:2380
    - --name=master-2
    - --peer-cert-file=/etc/kubernetes/pki/etcd/peer.crt
    - --peer-client-cert-auth=true
    - --peer-key-file=/etc/kubernetes/pki/etcd/peer.key
    - --peer-trusted-ca-file=/etc/kubernetes/pki/etcd/ca.crt
    - --snapshot-count=10000
    - --trusted-ca-file=/etc/kubernetes/pki/etcd/ca.crt
    image: k8s.gcr.io/etcd:3.4.3-0
4

0 回答 0