如何在使用kubeadm创建的Kubernetes集群上备份etcd-RPC错误:代码= 13 [英] How to backup etcd on a Kubernetes cluster created with kubeadm - rpc error: code = 13
问题描述
我有一个用kubeadm创建的K8s集群,它由一个主节点和两个工作器组成.
I have a K8s cluster created with kubeadm that consists of a master node and two workers.
我正在关注有关etcd备份的此文档文章: https://kubernetes.io/docs/tasks/administer-cluster/configure-upgrade-etcd/#backing-up-an-etcd-cluster
I am following this documentation article regarding the etcd backup: https://kubernetes.io/docs/tasks/administer-cluster/configure-upgrade-etcd/#backing-up-an-etcd-cluster
我必须使用etcdctl来备份etcd数据库,所以我进入运行在主节点上的etcd pod中,从那里进行操作:kubectl exec -it -n kube-system etcd-ip-x-x-x-x sh
I have to use etcdctl to backup the etcd db so I sh into the etcd pod running on the master node to do it from there: kubectl exec -it -n kube-system etcd-ip-x-x-x-x sh
注意:主节点在此路径/var/lib/etcd
中托管etcd数据库,该路径作为/var/lib/etcd
中的VolumeMount安装在Pod上.
NOTE: The master node hosts the etcd database in this path /var/lib/etcd
which is mounted on the pod as a VolumeMount in /var/lib/etcd
.
按照我运行的文档操作:ETCDCTL_API=3 etcdctl --endpoints 127.0.0.1:2379 snapshot save snapshotdb
,它返回以下错误:
Following the doc I run: ETCDCTL_API=3 etcdctl --endpoints 127.0.0.1:2379 snapshot save snapshotdb
and it returns the following error:
Error: rpc error: code = 13 desc = transport: write tcp 127.0.0.1:44464->127.0.0.1:2379: write: connection reset by peer
这是什么问题?
推荐答案
我设法使其能够将证书信息添加到命令中:
I managed to make it work adding the certificates info to the command:
ETCDCTL_API=3 etcdctl --endpoints https://127.0.0.1:2379 --cacert=/etc/kubernetes/pki/etcd/ca.crt --cert=/etc/kubernetes/pki/etcd/healthcheck-client.crt --key /etc/kubernetes/pki/etcd/healthcheck-client.key snapshot save ./snapshot.db
这篇关于如何在使用kubeadm创建的Kubernetes集群上备份etcd-RPC错误:代码= 13的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!