问题描述
我正在尝试检查我的节点以可能修复我的节点,但命令“get”失败。
错误是
Failed to create Calico API client... error parsing document: fields in document are not recognized or are in the wrong location: clusters,contexts,current-context,preferences,users
更多信息:
我可以使用 kubectl 来“获取”我的节点
apiVersion: v1
kind: Node
Metadata:
annotations:
kubeadm.alpha.kubernetes.io/cri-socket: /var/run/dockershim.sock
node.alpha.kubernetes.io/ttl: "0"
projectcalico.org/IPv4Address: 192.241.129.100/24
volumes.kubernetes.io/controller-managed-attach-detach: "true"
creationTimestamp: "2021-03-10T19:33:06Z"
labels:
beta.kubernetes.io/arch: amd64
beta.kubernetes.io/os: linux
kubernetes.io/arch: amd64
kubernetes.io/hostname: artemis
kubernetes.io/os: linux
node-role.kubernetes.io/control-plane: ""
node-role.kubernetes.io/master: ""
managedFields:
- apiVersion: v1
fieldsType: FieldsV1
fieldsV1:
f:Metadata:
f:annotations:
.: {}
f:volumes.kubernetes.io/controller-managed-attach-detach: {}
f:labels:
.: {}
f:beta.kubernetes.io/arch: {}
f:beta.kubernetes.io/os: {}
f:kubernetes.io/arch: {}
f:kubernetes.io/hostname: {}
f:kubernetes.io/os: {}
f:status:
f:addresses:
.: {}
k:{"type":"Hostname"}:
.: {}
f:address: {}
f:type: {}
k:{"type":"InternalIP"}:
.: {}
f:address: {}
f:type: {}
f:allocatable:
.: {}
f:cpu: {}
...
我有一个主节点和两个工作节点。所有 pod 和节点似乎都很健康。每个配对都可以 ping 其他两个节点,但每个都在网络测试中失败。
calicoctl 显示所有节点在从其他节点查看时都显示为“up”,但命令“get”失败。
Calico process is running.
IPv4 BGP status
+-----------------+-------------------+-------+------------+-------------+
| PEER ADDRESS | PEER TYPE | STATE | SINCE | INFO |
+-----------------+-------------------+-------+------------+-------------+
| 143.198.57.235 | node-to-node mesh | up | 2021-03-10 | Established |
| 143.110.149.114 | node-to-node mesh | up | 2021-03-10 | Established |
+-----------------+-------------------+-------+------------+-------------+
IPv6 BGP status
No IPv6 peers found.
解决方法
我一直在玩多个配置文件。 kubectl 会识别多个配置文件以进行测试,而 calicoctl 不会。我使用此处找到的说明合并了我的配置文件:
How to merge kubectl config file with ~/.kube/config?
已修复!