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

kubectl-moco cannot authenticate to a GKE cluster #320

Closed
pbuszka opened this issue Oct 15, 2021 · 5 comments
Closed

kubectl-moco cannot authenticate to a GKE cluster #320

pbuszka opened this issue Oct 15, 2021 · 5 comments
Assignees
Labels
bug Something isn't working

Comments

@pbuszka
Copy link

pbuszka commented Oct 15, 2021

Describe the bug
A clear and concise description of what the bug is.
When trying to access moco mysql cluster deployed ona GKE kubectl moco fails with

kubectl moco -n foo mysql -it test
Error: no Auth Provider found for name "gcp"
no Auth Provider found for name "gcp"

Environments

kubectl-moco version 0.10.6

kubectl version
Client Version: version.Info{Major:"1", Minor:"20+", GitVersion:"v1.20.8-dispatcher", GitCommit:"283881f025da4f5b3cefb6cd4c35f2ee4c2a79b8", GitTreeState:"clean", BuildDate:"2021-09-14T05:12:27Z", GoVersion:"go1.15.13", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"20+", GitVersion:"v1.20.10-gke.301", GitCommit:"17ad7bd6afa01033d7bd3f02ce5de56f940a915d", GitTreeState:"clean", BuildDate:"2021-08-24T05:18:54Z", GoVersion:"go1.15.15b5", Compiler:"gc", Platform:"linux/amd64"}

  • OS: Ubuntu 20.04

To Reproduce
Steps to reproduce the behavior:

  1. Create a cluster on GKE (Google Kubernets Engine)
  2. Install a moco example mysql cluster as per installation instruction
  3. run any kubectl moco which access cluster i.e
    kubectl moco -n foo mysql -it test

Expected behavior
Ability to use kubectl-moco with a GKE cluster

Additional context
The issue probably comes down to the problem mentioned in this issue
kubernetes/client-go#839
and proposed solution to inlude appropriate auth libs
https://github.com/kubernetes/client-go/blob/master/examples/out-of-cluster-client-configuration/main.go#L33-L40

Unfortunatly, I don't know go good enough to propose a meaningful PR

@pbuszka pbuszka added the bug Something isn't working label Oct 15, 2021
@ymmt2005
Copy link
Member

Thank you for the report. I'll take a look.

@ymmt2005 ymmt2005 self-assigned this Oct 15, 2021
@zoetrope
Copy link
Member

zoetrope commented Oct 18, 2021

We need import _ "k8s.io/client-go/plugin/pkg/client/auth" ?

@ymmt2005
Copy link
Member

Sure. Those lines are included in the scaffold generated by kubebuilder.

import (
        // Import all Kubernetes client auth plugins (e.g. Azure, GCP, OIDC, etc.)
        // to ensure that exec-entrypoint and run can make use of them.
        _ "k8s.io/client-go/plugin/pkg/client/auth"

@masa213f masa213f assigned masa213f and unassigned ymmt2005 Oct 22, 2021
@masa213f
Copy link
Contributor

masa213f commented Nov 2, 2021

@pbuszka
Thanks for the report!
I have released the fixed version as MOCO v0.10.7. If you like, please try it.

@pbuszka
Copy link
Author

pbuszka commented Nov 2, 2021

@masa213f
Tested on GKE and local minikube and works well in both cases.
Thanks a lot

@pbuszka pbuszka closed this as completed Nov 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants