我正在使用 velero 在 kubernetes 上备份 couchbase。备份工作正常,甚至是命名空间和 PV、PVC 的存储。但是,couchbase 节点在恢复后无法启动,因为似乎是某种竞争条件,导致创建了两个 PV 并尝试安装到 couchbase pod,其中一个 PV 位于错误的 kubernetes 上节点。
恢复和恢复非 Statefulset 应用程序是成功的,但使用 Statefulset,只有备份、恢复而不是恢复成功,使用以下过程:
- 备份一个命名空间,其中包含仅运行 1 个副本的单个 statefulset (couchbase)。
- 完全删除命名空间。
- 从命名空间的备份中恢复
结果:
- 单个 pod 保留在 ContainerCreating
- 创建了两个与 pod 关联的 PV
- 在“丢失”状态下创建单个 PVC
- 在事件日志中看到以下错误:
23m Warning FailedAttachVolume pod/couchbase-0 Multi-Attach error for volume "pvc-1b9860c6-0208-11ea-b826-5a269cbf3473" Volume is already exclusively attached to one node and can't be attached to another
14m Warning FailedMount pod/couchbase-0 Unable to mount volumes for pod "couchbase-0_lolcorp-uat-az1-test-cbdeploy(f7092210-0231-11ea-b826-5a269cbf3473)": timeout expired waiting for volumes to attach or mount for pod "lolcorp-uat-az1-test-cbdeploy"/"couchbase-0". list of unmounted volumes=[datadir]. list of unattached volumes=[datadir default-token-xdl76]
我的问题是:
- 配置 statefulset(特别是 couchbase)恢复以避免这种情况的正确方法是什么?
理想情况下,这应该发生:
- PVC、PV 和 POD 将与命名空间一起恢复
- 单个 PV 将成功挂载
- 只有一个声明与 PV 和 pod 相关联
- statefuleset pod 将转换为“正在运行”
设置详情:
- Velero 版本(使用
velero version
):
0.1.1
- Velero 功能(使用
velero client config get features
):
features: <NOT SET>
- Kubernetes 版本(使用
kubectl version
):
Client Version: version.Info{Major:"1", Minor:"14", GitVersion:"v1.14.3", GitCommit:"5e53fd6bc17c0dec8434817e69b04a25d8ae0ff0", GitTreeState:"clean", BuildDate:"2019-06-06T01:44:30Z", GoVersion:"go1.12.5", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"14", GitVersion:"v1.14.8", GitCommit:"211047e9a1922595eaa3a1127ed365e9299a6c23", GitTreeState:"clean", BuildDate:"2019-10-15T12:02:12Z", GoVersion:"go1.12.10", Compiler:"gc", Platform:"linux/amd64"
- Kubernetes 安装程序和版本:
Azure Kubernetes:AKS
- 云提供商或硬件配置:
天蓝色
- 操作系统(例如来自
/etc/os-release
):
Ubuntu 18。