Code Monkey home page Code Monkey logo

Comments (13)

matthisholleville avatar matthisholleville commented on May 16, 2024 2

I have set up a clean environment on Debian, and I had no issues.

gcloud container clusters get-credentials xxx --region xxx --project xxx

Here's my configuration:

apiVersion: v1
clusters:
- cluster:
    certificate-authority-data: DATA+OMITTED
    server: https://xxxxx
  name: gcp
contexts:
- context:
    cluster: gcp
    user: gcp
  name: gcp
current-context: gcp
kind: Config
preferences: {}
users:
- name: gcp
  user:
    exec:
      apiVersion: client.authentication.k8s.io/v1beta1
      args: null
      command: gke-gcloud-auth-plugin
      env: null
      installHint: Install gke-gcloud-auth-plugin for use with kubectl by following
        https://cloud.google.com/blog/products/containers-kubernetes/kubectl-auth-changes-in-gke
      interactiveMode: IfAvailable
      provideClusterInfo: true

Here's my version of gcloud:

root@xxxx:~/.kube# gcloud version
Google Cloud SDK 424.0.0
alpha 2023.03.24
beta 2023.03.24
bq 2.0.89
bundled-python3-unix 3.9.16
core 2023.03.24
gcloud-crc32c 1.0.0
gke-gcloud-auth-plugin 0.5.2
gsutil 5.21

I think you need to use gke-gcloud-auth-plugin as authentication method.

from k8sgpt.

thschue avatar thschue commented on May 16, 2024

Hello @hapham1701!

Unfortunately, I could not reproduce your issue. Authenticated on a cluster using

gcloud container clusters get-credentials ******** --zone ********** --project ******** 

and could analyze without problems. Please provide a bit more information on your configuration, e.g., some obfuscated information about your kube context. Thank you!

from k8sgpt.

hapham1701 avatar hapham1701 commented on May 16, 2024

this is full error:
Error initialising kubernetes client: no Auth Provider found for name "gcp"
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x0 pc=0x103d0c600]

goroutine 1 [running]:
github.com/k8sgpt-ai/k8sgpt/pkg/analyzer.AnalyzePod({0x104311018, 0x14000134010}, 0x14000257bb8, 0x0, {0x10?, 0x103d31816?}, 0x14000257ba0)
/home/runner/work/k8sgpt/k8sgpt/pkg/analyzer/podAnalyzer.go:17 +0x40
github.com/k8sgpt-ai/k8sgpt/pkg/analyzer.RunAnalysis({0x104311018, 0x14000134010}, 0x33?, 0x103d1d9f0?, {0x1043001a8, 0x1400042cb28}, 0x1040e0020?)
/home/runner/work/k8sgpt/k8sgpt/pkg/analyzer/analyzer.go:18 +0x38
github.com/k8sgpt-ai/k8sgpt/cmd/analyze.glob..func1(0x104ead1a0?, {0x103d1bc51?, 0x0?, 0x0?})
/home/runner/work/k8sgpt/k8sgpt/cmd/analyze/analyze.go:80 +0x30c
github.com/spf13/cobra.(*Command).execute(0x104ead1a0, {0x104ef9f68, 0x0, 0x0})
/home/runner/go/pkg/mod/github.com/spf13/[email protected]/command.go:920 +0x5ac
github.com/spf13/cobra.(*Command).ExecuteC(0x104eacbe0)
/home/runner/go/pkg/mod/github.com/spf13/[email protected]/command.go:1044 +0x340
github.com/spf13/cobra.(*Command).Execute(...)
/home/runner/go/pkg/mod/github.com/spf13/[email protected]/command.go:968
github.com/k8sgpt-ai/k8sgpt/cmd.Execute({0x103f40730?, 0x140000021a0?})
/home/runner/work/k8sgpt/k8sgpt/cmd/root.go:36 +0x58
main.main()
/home/runner/work/k8sgpt/k8sgpt/main.go:11 +0x2c

from k8sgpt.

thschue avatar thschue commented on May 16, 2024

As written before, please add some more information about your configuration.

e.g. kubectl config view (for your current context).

from k8sgpt.

AlexsJones avatar AlexsJones commented on May 16, 2024

If you could print your ~/.k8sgpt.yaml ( omitting your key for openAI) we could see what's going on.. the auth backend shouldn't be giving that error at all.

from k8sgpt.

hapham1701 avatar hapham1701 commented on May 16, 2024

result : cat ~/.k8sgpt.yaml

backend_type: openai
kubernetesclient: null
openai_key:xxxxxxxxxx

from k8sgpt.

matthisholleville avatar matthisholleville commented on May 16, 2024

@hapham1701 Do you have gcloud properly installed/configured on your environment ?

from k8sgpt.

hapham1701 avatar hapham1701 commented on May 16, 2024

This is information about gcloud and kubectl, which i have already installed on my laptop. Please feel free to ask me if you need any further information:

gcloud version

Google Cloud SDK 423.0.0
alpha 2023.03.17
beta 2023.03.17
bq 2.0.88
config-connector 1.93.0
core 2023.03.17
gsutil 5.21
Updates are available for some Google Cloud CLI components. To install them,
please run:
$ gcloud components update

To take a quick anonymous survey, run:
$ gcloud survey


~ kubectl version
Client Version: version.Info{Major:"1", Minor:"23", GitVersion:"v1.23.0", GoVersion:"go1.17.3", Compiler:"gc", Platform:"darwin/arm64"}

Server Version: version.Info{Major:"1", Minor:"24", GitVersion:"v1.24.9-gke.3200", GoVersion:"go1.18.9b7", Compiler:"gc", Platform:"linux/amd64"}

from k8sgpt.

hapham1701 avatar hapham1701 commented on May 16, 2024

Hi @thschue This is the result of the command: kubectl config view

  • name: xxxxxxx
    user:
    auth-provider:
    config:
    access-token: xxxxx
    cmd-args: config config-helper --format=json
    cmd-path: /opt/homebrew/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/bin/gcloud
    expiry: "xxxxxx"
    expiry-key: '{.credential.token_expiry}'
    token-key: '{.credential.access_token}'
    name: gcp

from k8sgpt.

matthisholleville avatar matthisholleville commented on May 16, 2024

@hapham1701 can you try to run : gcloud components install gke-gcloud-auth-plugin please ?

from k8sgpt.

hapham1701 avatar hapham1701 commented on May 16, 2024

Here's my version of gcloud:

~ gcloud version
Google Cloud SDK 423.0.0
alpha 2023.03.17
beta 2023.03.17
bq 2.0.88
config-connector 1.93.0
core 2023.03.17
gke-gcloud-auth-plugin 0.5.2
gsutil 5.21


After install gke-gcloud-auth-plugin, The error still exists.

from k8sgpt.

hapham1701 avatar hapham1701 commented on May 16, 2024

It worked after I upgraded ver chatgpt to 0.1.6 and ran the command 'gcloud container clusters get-credentials xxx --region xxx --project xxx'. I don't know why I needed to get credentials even though they already existed.
Thank you for your support.

from k8sgpt.

umiyosh avatar umiyosh commented on May 16, 2024

I experienced the same problem, but I can confirm that it is recovered by installing and activating the gke-gcloud-auth-plugin described in the discussion here. It is important to note that the problem will not be solved without installing, activating and getting credentials for the gke-gcloud-auth-plugin, as I found out when I checked the operation. Therefore, to solve the problem, you need to execute all of the following commands.

% gcloud components install gke-gcloud-auth-plugin
-> gke-gcloud-auth-plugin will be installed
% export USE_GKE_GCLOUD_AUTH_PLUGIN=True
-> gke-gcloud-auth-plugin will be activated
% gcloud container clusters get-credentials xxx --region xxx --project xxx
-> Credentials will be obtained by authentication with gke-gcloud-auth-plugin
% k8sgpt analyse
-> You will be able to see that the problem has been resolved.

A change in the kubectl authentication method causes this problem. You can read the details in the following document.
https://cloud.google.com/blog/products/containers-kubernetes/kubectl-auth-changes-in-gke?hl=en

from k8sgpt.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.