jenkins-x/terraform-aws-eks-jx

Error launching "jx admin log"

grossiello-netspinlab opened this issue · 5 comments

Summary

JX setup succeeds up to the jx admin log command, which returns an error.

Steps to reproduce the behavior

  1. generate repo from https://github.com/jx3-gitops-repositories/jx3-terraform-eks/generate
  2. generate repo from https://github.com/jx3-gitops-repositories/jx3-eks-vault/generate
  3. configure terraform variables
  4. execute: terraform init, terraform plan and terraform apply
  5. execute: jx admin log

Expected behavior

Jenkins X installation logs tailed

Actual behavior

The following error is returned:
error: failed to find the git operator namespace: failed to find Deployment jx-git-operator in namespace jx: Unauthorized

Terraform version

The output of terraform version is:

Terraform v1.0.3
on linux_amd64

  • provider registry.terraform.io/hashicorp/aws v3.51.0
  • provider registry.terraform.io/hashicorp/cloudinit v2.2.0
  • provider registry.terraform.io/hashicorp/helm v2.2.0
  • provider registry.terraform.io/hashicorp/kubernetes v2.3.2
  • provider registry.terraform.io/hashicorp/local v2.1.0
  • provider registry.terraform.io/hashicorp/null v3.1.0
  • provider registry.terraform.io/hashicorp/random v3.1.0
  • provider registry.terraform.io/hashicorp/template v2.2.0
  • provider registry.terraform.io/terraform-aws-modules/http v2.4.1

Module version

1.15.38

Operating system

Ubuntu

failed to find the git operator namespace

Can you paste the output of kubectl get ns?

Also do u have kubeconfig env variable pointing to ur local kubeconfig file?
Also can u try AWS_PROFILE=<profile> terraform apply, where profile is ur AWS profile set in credentials or config file (in the .aws folder)

I also came up against this issue.

To follow on from the above, this is the result that running kubectl get ns returned error: You must be logged in to the server (Unauthorized)

The full user section of the config at this point showed:

users:
- name: <arn>
  user:
    exec:
      apiVersion: client.authentication.k8s.io/v1alpha1
      args:
      - --region
      - eu-west-2
      - eks
      - get-token
      - --cluster-name
      - <cluster-name>
      command: aws

After setting the AWS_PROFILE in my env and re-running terraform apply the generated kube config had an ENV section with the aws profile I had set. As a result the jx admin log did work.

For completeness: was trying to run a '1.21' cluster version and was also running on Ubuntu - though WSL. Can specify more of the steps I took to get this issue if needs be as the issue seems fairly repeatable for me.

I think the issue is related to #288

I can confirm I had changed the AWS profile to be a named profile, not my default one, same as in #288.

This should be fixed now, closing.