What steps did you take and what happened:
I'm still getting the following error:
time="2019-10-30T12:30:59Z" level=info msg="Checking that all backup storage locations are valid" logSource="pkg/cmd/server/server.go:412"
An error occurred: some backup storage locations are invalid: error getting backup store for location "default": rpc error: code = Unknown desc = unable to get all required environment variables: the following keys do not have values: AZURE_TENANT_ID, AZURE_CLIENT_ID, AZURE_CLIENT_SECRET, AZURE_SUBSCRIPTION_ID
I'm using helm command to install velero on azure cluster:
helm install --name velero --namespace velero --set-file credentials.secretContents.cloud=./credentials-velero -f ${VALUES_YAML_FILE} ${VELERO_HELM_CHART};
The values yaml secret section looks like:
secretContents:
cloud: |
[default]
AZURE_SUBSCRIPTION_ID={{ subscriptionID }}
AZURE_TENANT_ID={{ tenantID }}
AZURE_CLIENT_ID={{ clientID }}
AZURE_CLIENT_SECRET={{ clientSecret }}
velero version is 1.1.0
the velero secret value is equal to:
cloud:
[default]
AZURE_SUBSCRIPTION_ID={{ subscriptionID }}
AZURE_TENANT_ID={{ tenantID }}
AZURE_CLIENT_ID={{ clientID }}
AZURE_CLIENT_SECRET={{ clientSecret }}
No AZURE_CREDENTIALS_FILE env found like AWS.
What did you expect to happen:
I'm expecting to install velero on azure cluster and it should be up & running
Environment:*
velero version): 1.1.0kubectl version): 1.15.4@ahmadhajali couple things:
[default] entry on the first line - that's an AWS-specific thing. Please remove it.but with no success.
Any idea?
Best regards,
Ahmad
I see this:
"envFrom": [
{
"secretRef": {
"name": "velero"
}
}
],
which doesn't look right - the name of the secret should be cloud-credentials. I would try updating that and see if it fixes the issue.
If so - please file an issue in the Helm repo around this.
same issue even after replacing velero to cloud-credentials in secretRef. Since velero is exist as well in secerts (both velero and cloud-credentials are exist in secret section).
Here is the velero secret:
Details
Name:
velero
Namespace:
velero
Labels:
app.kubernetes.io/instance: velero
app.kubernetes.io/managed-by: Tiller
app.kubernetes.io/name: velero
helm.sh/chart: velero-2.3.0
Creation Time:
2019-10-30T14:52 UTC
Type:
Opaque
Data
cloud:
AZURE_SUBSCRIPTION_ID=*
AZURE_TENANT_ID=
AZURE_CLIENT_ID=
AZURE_CLIENT_SECRET=
AZURE_RESOURCE_GROUP=**
Here is cloud-credentials secret values:
Details
Name:
cloud-credentials
Namespace:
velero
Creation Time:
2019-10-30T15:46 UTC
Type:
Opaque
Data
cloud:
AZURE_SUBSCRIPTION_ID=*
AZURE_TENANT_ID=
AZURE_CLIENT_ID=
AZURE_CLIENT_SECRET=
AZURE_RESOURCE_GROUP=**
even both of them are exist, the pod failed to initialize due to missing env values for azure as mentioned above.
The pod env looks like:
Containers
velero
Image:
gcr.io/heptio-images/velero:v1.1.0
Environment variables:
VELERO_SCRATCH_DIR: /scratch
VELERO_NAMESPACE: (v1:metadata.namespace)
cloud (cloud-credentials): AZURE_SUBSCRIPTION_ID=*
AZURE_TENANT_ID=
AZURE_CLIENT_ID=
AZURE_CLIENT_SECRET=
AZURE_RESOURCE_GROUP=**
Commands:
/velero
Args:
server
ah, I think I see. There are two ways of specifying Azure credentials:
cloud-credentials secret contains multiple key-value pairs, each one being the name & value of an environment variable, and the secret is used in the velero deployment to set the envFrom fieldcloud-credentials secret contains a single key, cloud, whose value is a multi-line list of environment variables, and the secret is mounted into the velero deployment as a volume at /credentials, and the velero deployment has the AZURE_CREDENTIALS_FILE environment variable set to /credentials/cloud. It looks like you're somewhere in between the two approaches right now, so I'd pick one (preference for #2 since it's the "new" way) and go with it. To get to #2, mount the secret into the velero deployment as a volume at /credentials, and add the AZURE_CREDENTIALS_FILE to the deployment spec as well, with a value of /credentials/cloud. It looks like the secret is already formatted correctly to support this approach.
As per your #2 explanation, it is supposed to be deployed correctly running helm install command?
our AWS installation goes throw the same process (using helm install) and the results are as per #2.
it looks like the Helm chart is still set up to use the "old" way which requires creating the secret differently. We should update the Helm chart -- please file an issue in that repo! Also, if you're interested in contributing, we'd love to have a patch for this
A great opportunity to contribute to helm repo. will give it a try.
@ahmadhajali I'm closing this out here since you have a PR open in the Helm repo -- thanks for submitting that change!
As documentation for 1.2.0 doesn't help, here is working example of secret yaml:
$ cat << EOF > ./credentials-velero
AZURE_SUBSCRIPTION_ID=${AZURE_SUBSCRIPTION_ID}
AZURE_TENANT_ID=${AZURE_TENANT_ID}
AZURE_CLIENT_ID=${AZURE_CLIENT_ID}
AZURE_CLIENT_SECRET=${AZURE_CLIENT_SECRET}
AZURE_RESOURCE_GROUP=${AZURE_RESOURCE_GROUP}
AZURE_CLOUD_NAME=AzurePublicCloud
EOF
Note here:
Values of the AZURE_* should be plain text but not base64 encoded
$ echo ./credentials-velero | base64 | tr -d '\n'
apiVersion: v1
kind: Secret
data:
cloud: <base64 string from the above>
I hope that this will help someone as I spent some time to figure out this.
Most helpful comment
As documentation for 1.2.0 doesn't help, here is working example of secret yaml:
> https://github.com/vmware-tanzu/velero-plugin-for-microsoft-azure#create-service-principal
Note here:
I hope that this will help someone as I spent some time to figure out this.