1. Update credentials file
First, update your credentials file (for most providers, this is credentials-velero
and the contents are described in the plugin installation instructions: AWS, Azure, GCP)
2. Update secret
Now update the velero secret. On linux:
kubectl patch -n velero secret cloud-credentials -p '{"data": {"cloud": "'$(base64 -w 0 credentials-velero)'"}}'
patch
tells kubectl
to update a resource by merging the provided data
-n velero
tells kubectl
to use the velero
namespace
secret
is the resource type
cloud-credentials
is the name of the secret used by Velero to store credentials
-p
specifies that the next word is the patch data. It's more common to patch using JSON rather than YAML
'{"data": {"cloud": "<your-base64-encoded-secret-will-go-here>"}}'
this is the JSON data that matches the existing structure of the Velero secret in Kubernetes. <your-base64-encoded-secret-will-go-here>
is a placeholder for the command we'll insert.
$(base64 -w 0 credentials-velero)
reads the file credentials-velero
in the current directory, turns off word wrapping of the output (-w 0
), BASE64-encodes the contents of the file, and inserts the result in the data.