Cluster-api-provider-azure: clusterctl init doesnt work gives error failed to perform variable substitution

Created on 18 Jul 2020  Â·  10Comments  Â·  Source: kubernetes-sigs/cluster-api-provider-azure

/kind bug

What steps did you take and what happened:
[A clear and concise description of what the bug is.]

270 export AZURE_SUBSCRIPTION_ID: "xx"
271 export AZURE_TENANT_ID: "xx"
272 export AZURE_CLIENT_ID: "xx"
273 export AZURE_CLIENT_SECRET: "x"
274 export AZURE_ENVIRONMENT: "AzurePublicCloud"
275 export AZURE_SUBSCRIPTION_ID_B64: "xx"
276 export AZURE_TENANT_ID_B64: "xx"
277 export AZURE_CLIENT_ID_B64: "xx"
287 sudo clusterctl init --core cluster-api:v0.3.0 --bootstrap kubeadm:v0.3.0 --control-plane kubeadm:v0.3.0 --infrastructure azure:v0.4.0

sudo clusterctl init --core cluster-api:v0.3.0 --bootstrap kubeadm:v0.3.0 --control-plane kubeadm:v0.3.0 --infrastructure azure:v0.4.0
Fetching providers
Using Override="core-components.yaml" Provider="cluster-api" Version="v0.3.0"
Using Override="bootstrap-components.yaml" Provider="bootstrap-kubeadm" Version="v0.3.0"
Using Override="control-plane-components.yaml" Provider="control-plane-kubeadm" Version="v0.3.0"
Using Override="infrastructure-components.yaml" Provider="infrastructure-azure" Version="v0.4.0"
Error: failed to get provider components for the "azure:v0.4.0" provider: failed to perform variable substitution: value for variables [AZURE_CLIENT_ID_B64, AZURE_CLIENT_SECRET_B64, AZURE_SUBSCRIPTION_ID_B64, AZURE_TENANT_ID_B64] is not set. Please set the value using os environment variables or the clusterctl config file

What did you expect to happen:

Anything else you would like to add:
[Miscellaneous information that will assist in solving the issue.]

Environment:

  • cluster-api-provider-azure version:
  • Kubernetes version: (use kubectl version):
  • OS (e.g. from /etc/os-release):
    so This one doesnt seem to be working still..
kinbug

All 10 comments

@sb1975 can you please try to install the latest clusterctl version (v0.3.7) and see if you can still repro this? it looks like you have v0.3.0

@sb1975 You'll need at least https://github.com/kubernetes-sigs/cluster-api/releases/tag/v0.3.5. This is a known bug that was introduced in v0.3.4 and has been fixed in v0.3.5.

But why its not working with the latest also please ?
$ clusterctl version
clusterctl version: &version.Info{Major:"0", Minor:"3", GitVersion:"v0.3.7-31-b9bcc8c55bea0c", GitCommit:"b9bcc8c55bea0cad1b22cd872162d06c8687befe", GitTreeState:"clean", BuildDate:"2020-07-20T20:57:06Z", GoVersion:"go1.14.6", Compiler:"gc", Platform:"linux/amd64"}
azureuser@capi:~/cluster-api$
azureuser@capi:~/cluster-api$ git log | head -n 10
commit b9bcc8c55bea0cad1b22cd872162d06c8687befe
Merge: 2408cb0c2 5a9c62e1f
Author: Kubernetes Prow Robot k8s-ci-robot@users.noreply.github.com
Date: Mon Jul 20 10:18:51 2020 -0700

Merge pull request #3267 from superbrothers/crd-relationship-diagrams

📖 Add CRD relationships diagrams

commit 2408cb0c21de302ede880a8e6b9a1cd025ac9f60

In the issue you wrote sudo clusterctl init --core cluster-api:v0.3.0 --bootstrap kubeadm:v0.3.0 --control-plane kubeadm:v0.3.0 --infrastructure azure:v0.4.0, why v0.3.0 and v0.4.0?

Can you try just clusterctl init --infrastructure azure? It should automatically install the latest versions (v0.3.7 for capi and v0.4.6 for capz).

Just confirmed I cannot repro with the latest versions of clusterctl, capi + capz:

clusterctl init --infrastructure azure                                                                                            ✔  11149  14:11:48
Fetching providers
Installing cert-manager
Waiting for cert-manager to be available...
Installing Provider="cluster-api" Version="v0.3.7" TargetNamespace="capi-system"
Installing Provider="bootstrap-kubeadm" Version="v0.3.7" TargetNamespace="capi-kubeadm-bootstrap-system"
Installing Provider="control-plane-kubeadm" Version="v0.3.7" TargetNamespace="capi-kubeadm-control-plane-system"
Installing Provider="infrastructure-azure" Version="v0.4.6" TargetNamespace="capz-system"

Your management cluster has been initialized successfully!

You can now create your first workload cluster by running the following:

  clusterctl config cluster [name] --kubernetes-version [version] | kubectl apply -f -

It is still same error for me
$ sudo clusterctl init --infrastructure azure
Fetching providers
Using Override="infrastructure-components.yaml" Provider="infrastructure-azure" Version="v0.4.0"
Error: failed to get provider components for the "azure" provider: failed to perform variable substitution: value for variables [AZURE_CLIENT_ID_B64, AZURE_CLIENT_SECRET_B64, AZURE_SUBSCRIPTION_ID_B64, AZURE_TENANT_ID_B64] is not set. Please set the value using os environment variables or the clusterctl config file

Using Override="infrastructure-components.yaml" Provider="infrastructure-azure" Version="v0.4.0"

Looks like you have overrides in ~/.cluster-api/overrides, try removing those.

I think this is because of using "sudo" but the export of the variables was not in "sudo" context. Try without "sudo".

Discussed further on Slack.

This is failing because the variables are being exported outside the sudo context.

/close

@CecileRobertMichon: Closing this issue.

In response to this:

Discussed further on Slack.

This is failing because the variables are being exported outside the sudo context.

/close

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

shysank picture shysank  Â·  8Comments

CecileRobertMichon picture CecileRobertMichon  Â·  7Comments

CecileRobertMichon picture CecileRobertMichon  Â·  5Comments

eedorenko picture eedorenko  Â·  8Comments

alexeldeib picture alexeldeib  Â·  9Comments