jenkins-x / terraform-aws-eks-jx

A Terraform module for creating Jenkins X infrastructure on AWS
Apache License 2.0
63 stars 42 forks source link

Error launching "jx admin log" #290

Closed grossiello-netspinlab closed 2 years ago

grossiello-netspinlab commented 3 years ago

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

Module version

1.15.38

Operating system

Ubuntu

ankitm123 commented 3 years ago

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)

ryankav commented 3 years ago

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.

ankitm123 commented 3 years ago

I think the issue is related to #288

ryankav commented 3 years ago

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

ankitm123 commented 2 years ago

This should be fixed now, closing.