Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ASM Module fails #609

Closed
chanuka-techo opened this issue Jul 23, 2020 · 10 comments
Closed

ASM Module fails #609

chanuka-techo opened this issue Jul 23, 2020 · 10 comments
Assignees

Comments

@chanuka-techo
Copy link

I have tried with both master and v10.0.0.

Since my attempt was failing, I just tried the code from the example but still the result is the same.

Error: Error running command 'printf "%s" "$GOOGLE_CREDENTIALS" > .terraform/modules/asm.asm_install/terraform-google-gcloud-1.3.0/terraform-google-credentials.json &&
gcloud auth activate-service-account --key-file .terraform/modules/asm.asm_install/terraform-google-gcloud-1.3.0/terraform-google-credentials.json
': exit status 1. Output: ERROR: (gcloud.auth.activate-service-account) Could not read json file .terraform/modules/asm.asm_install/terraform-google-gcloud-1.3.0/terraform-google-credentials.json: Expecting value: line 1 column 1 (char 0)

Please find the full apply output (personal info redacted) on this gist

@morgante
Copy link
Contributor

@bharathkkb Any ideas?

@bharathkkb
Copy link
Member

@chanuka-techo the example has use_tf_google_credentials_env_var enabled which expects $GOOGLE_CREDENTIALS . Could you try setting to false instead?

use_tf_google_credentials_env_var = true

@bharathkkb bharathkkb self-assigned this Jul 23, 2020
@chanuka-techo
Copy link
Author

Thanks, tried that and got the following error.

Error: Error running command 'PATH=/google-cloud-sdk/bin:$PATH
.terraform/modules/asm/terraform-google-kubernetes-engine-10.0.0/modules/asm/scripts/install_asm.sh *<Project ID>* *<Cluster Name>* *<Zone>*
': exit status 1. Output: kustomize is unavailable. Skipping ASM installation. Please install kustomize, add to PATH and rerun terraform apply.

I will install kustomize and continue.

Error: Error running command 'PATH=/google-cloud-sdk/bin:$PATH
.terraform/modules/asm/terraform-google-kubernetes-engine-10.0.0/modules/asm/scripts/install_asm.sh <Project ID> <Cluster Name> <Zone>
': exit status 127. Output: ~/work/mb/asm-dir ~/work/mb
Updated property [core/project].
WARNING: You do not appear to have access to project [*<Project ID>*] or it does not exist.
Downloading ASM patch
.terraform/modules/asm/terraform-google-kubernetes-engine-10.0.0/modules/asm/scripts/install_asm.sh: line 48: kpt: command not found
  1. I had a different gcloud profile activated.
  2. kpt was not installed
Error: Error running command 'PATH=/google-cloud-sdk/bin:$PATH
.terraform/modules/asm/terraform-google-kubernetes-engine-10.0.0/modules/asm/scripts/install_asm.sh <Project ID> <Cluster Name> <Zone>
': exit status 1. Output: ~/work/mb/asm-dir ~/work/mb
Updated property [core/project].
Downloading ASM patch
fetching package /asm-patch from https://github.com/GoogleCloudPlatform/anthos-service-mesh-packages to asm-patch
ERROR: (gcloud.beta.anthos.export) Could not locate anthos executable [anthoscli] on the system PATH. Please ensure gcloud anthos component is properly installed. See https://cloud.google.com/sdk/docs/components for more details.

anthoscli needs to be installed.

Apparently anthoscli installation also installs kpt and warns about system kpt (Mac, installed with brew).

Error: Error running command 'PATH=/google-cloud-sdk/bin:$PATH
.terraform/modules/asm/terraform-google-kubernetes-engine-10.0.0/modules/asm/scripts/install_asm.sh <Project ID> <Cluster Name> <Zone>
': exit status 1. Output: ~/work/mb/asm-dir ~/work/mb
Updated property [core/project].
ASM patch directory exists. Skipping download...
ERROR: (gcloud.beta.anthos.export) Could not locate anthos executable [anthoscli] on the system PATH. Please ensure gcloud anthos component is properly installed. See https://cloud.google.com/sdk/docs/components for more details.

anthoscli is not on path. Neither is kpt. Will see what's up with that.

At this point the problem is probably not with the ASM module. But I just documented the errors hoping it'll help some unfortunate soul who takes the same route.

@bharathkkb
Copy link
Member

@chanuka-techo thanks for the update. I am fixing the kustomize and beta (anthoscli) dependency in #602. However kpt should have been automatically installed. If you get a chance, could you give it a shot with #602?

module "acm-example" {
  source = "github.com/terraform-google-modules/terraform-google-kubernetes-engine//modules/acm?ref=fix-gcloud-install"
.
.
.
}

Ideally, all of these should be automatically installed by the ASM module :)

@chanuka-techo
Copy link
Author

I have shot myself in the foot somewhere back in time and kpt and anthoscli weren't being linked to $PATH properly. Sorted that and it went through fine.

So the trick was use_tf_google_credentials_env_var =false (false is the default, BTW).

@chanuka-techo
Copy link
Author

@bharathkkb I see your change refers to a module named 'gcloud_wait_for_cluster'. This is an aside but reminded me how cluster creation always failed for me citing the subnet being not valid. I had to plan/apply again to start going. Should we need changes for kubernetes-engine modules as well?

@bharathkkb
Copy link
Member

@chanuka-techo

Should we need changes for kubernetes-engine modules as well?

I am not sure if I understood this correctly, but if you were asking whether to change the source for GKE module, it is not necessary but you can. The main change in the PR is a bump up for the gcloud module version across all modules and fixing ASM dependencies.

@chanuka-techo
Copy link
Author

Sorry, I misinterpreted the situation. This is a completely different problem. Maybe I'll report in appropriate place if needed.

Terraform reports that the subnet creation succeeds.

module.vpc.module.subnets.google_compute_subnetwork.subnetwork["asia-southeast1/mb-poc-subnet-gke"]: Creation complete after 34s [id=projects/<project-id>/regions/asia-southeast1/subnetworks/mb-poc-subnet-gke]

Still, I get below error every time I start from scratch. Gotta plan/apply again to continue.

Error: googleapi: Error 400: Subnetwork "projects/<project-id>/regions/asia-southeast1/subnetworks/mb-poc-subnet-gke" is not valid for Network "mb-poc-vpc"., badRequest

  on .terraform/modules/gke/terraform-google-kubernetes-engine-10.0.0/modules/beta-public-cluster/cluster.tf line 22, in resource "google_container_cluster" "primary":
  22: resource "google_container_cluster" "primary" {

Thanks for the prompt support!

@chanuka-techo
Copy link
Author

@bharathkkb As you requested, I'm trying out #602

Just noticed you mentioned acm in your reply, not asm. Either it's a mistake or I really don't follow what's going on. Anyhow, trying out #602 for ASM.

@bharathkkb
Copy link
Member

@chanuka-techo my apologies, I meant asm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants