重置后如何更改我的 Velero 凭据

How can I change my Velero credentials after they were reset

我有一个安装了 Velero 的 Azure Kubernetes 集群。根据 option 1 of the instructions.

为 Velero 创建了一个服务主体

在重置服务主体的凭据之前,Velero 工作正常。现在计划的备份失败了。

NAME                                    STATUS      ERRORS   WARNINGS   CREATED                         EXPIRES   STORAGE LOCATION   SELECTOR
daily-entire-cluster-20210727030055     Failed      0        0          2021-07-26 23:00:55 -0000       13d       default            <none>

如何更新 Velero 的密文?

1。更新凭据文件

首先,更新您的凭据文件(对于大多数提供商,这是 credentials-velero 并且内容在插件安装说明中有描述:AWS, Azure, GCP

2。更新秘密

现在更新 velero 秘密。在 linux:

kubectl patch -n velero secret cloud-credentials -p '{"data": {"cloud": "'$(base64 -w 0 credentials-velero)'"}}'
  • patch 告诉 kubectl 通过合并提供的数据来更新资源
  • -n velero 告诉 kubectl 使用 velero 命名空间
  • secret是资源类型
  • cloud-credentials 是 Velero 用来存储凭据的秘密名称
  • -p 指定下一个单词为补丁数据。使用 JSON 而不是 YAML
  • 打补丁更常见
  • '{"data": {"cloud": "<your-base64-encoded-secret-will-go-here>"}}' 这是与 Kubernetes 中 Velero 秘密的现有结构相匹配的 JSON 数据。 <your-base64-encoded-secret-will-go-here> 是我们要插入的命令的占位符。
  • $(base64 -w 0 credentials-velero)读取当前目录下的文件credentials-velero,关闭输出的自动换行(-w 0),对文件内容进行BASE64编码,插入结果数据。