Open kourosh7 opened 2 months ago
I see the same with /upstream/aws/rke
based on: https://github.com/terraform-aws-modules/terraform-aws-eks/issues/1234 maybe the issue here is that the KUBECONFIG file is not set when it's trying to install cert-manager?
I think I found the issue. I added an output to check what the kubeconfig file points to:
kourosh@kourosh:~/tf-rancher-up/recipes/upstream/aws/k3s$ terraform output
instances_private_ip = [
[
"172.31.44.112",
],
[],
]
instances_public_ip = [
[
"34.212.45.9",
],
[],
]
kubeconfig_file = "~/.kube/rancher-terraform.yml"
rancher_bootstrap_password = "initial-admin-password"
rancher_hostname = "rancher.34.212.45.9.sslip.io"
rancher_url = "https://rancher.34.212.45.9.sslip.io"
kourosh@kourosh:~/tf-rancher-up/recipes/upstream/aws/k3s$ cat \~/.kube/rancher-terraform.yml
cat: '~/.kube/rancher-terraform.yml': Is a directory
kourosh@kourosh:~/tf-rancher-up/recipes/upstream/aws/k3s$ ls \~/.kube/rancher-terraform.yml
kourosh_kube_config.yml kourosh_kube_config.yml.backup
The script creates a directory in ~/.kube/
with the name rancher-terraform.yml
and then the kubeconfig file is generated beneath that directory. But the script is trying to use ~/.kube/rancher-terraform.yml
as the kubeconfig file which is invalid.
I think the issue might be related to the kubeconfig_file having a full path, looking at the code it should have a filename only, if you want the path you can add that too, eg
kube_config_path = "~/.kube/"
kube_config_filename = "rancher-terraform.yml"
https://github.com/rancher/tf-rancher-up/blob/main/recipes/upstream/aws/k3s/variables.tf#L106-L116
By default, without a path it will use the current working directory (cwd)
https://github.com/rancher/tf-rancher-up/blob/main/recipes/upstream/aws/k3s/main.tf#L2-L4
@dkeightley I think you are on the right track. The problem can be seen when:
terraform.tfvars.exmple
file:## -- Override the default (${prefix}_kube_config.yml) kubeconfig file/path
kube_config_path = "~/.kube/rancher-terraform.yml"
It works fine when:
kube_config_path
is set to just a filename with no pathterraform.tfvars
file at all
I have cloned the repo to my local laptop. I navigate to
../recipes/upstream/aws/k3s
and set theterraform.tfvars
file Then I run terraform init/plan/apply and get the following output with error at the end: