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

get kubeconfig is not found #6

Open
monotok opened this issue Aug 11, 2022 · 8 comments
Open

get kubeconfig is not found #6

monotok opened this issue Aug 11, 2022 · 8 comments

Comments

@monotok
Copy link

monotok commented Aug 11, 2022

Hello,

This project was exactly what I was looking for but I can't get it to work. Basically follow the first few steps and everything is fine.

kubectl apply -f https://raw.githubusercontent.com/ibuildthecloud/klum/master/deploy.yaml

Create the below file.

kind: User
apiVersion: klum.cattle.io/v1alpha1
metadata:
  name: chris

Apply with:
kubectl apply -f create_user_chris.yml

Then get the kubeconfig.

kubectl get kubeconfig chris -o json | jq .spec > kubeconfig

Error from server (NotFound): kubeconfigs.klum.cattle.io "chris" not found

@arw-thomasm
Copy link

Hi,

same issue here:

$ k version --short
Flag --short has been deprecated, and will be removed in the future. The --short output will become the default.
Client Version: v1.25.2
Kustomize Version: v4.5.7
Server Version: v1.25.2
$ cat users.yml 
kind: User
apiVersion: klum.cattle.io/v1alpha1
metadata:
  name: demo-user
spec:
  roles:
  - namespace: demo
    clusterRole: admin
$ k apply -f users.yml
user.klum.cattle.io/demo-user created
$ k get users
NAME        AGE
demo-user   6m30s
$ k get kubeconfigs.klum.cattle.io --all-namespaces
No resources found

Maybe this has something to do with a change in 1.24, since then service account tokens are not created automatically anymore.

See this for further information.

It would be great, if you can fix this.

Thanks!

@PhilipSchmid
Copy link

PhilipSchmid commented Dec 23, 2022

Any update on this?

Did someone of you find an easy workaround? Edit: I used this dirty workaround: Simply create K8s secrets of type kubernetes.io/service-account-token for the just created Klum User CRs and the Klum operator will shortly after be able to generate the Kubeconfig CRs:

for i in (seq 1 $MAX_USERS)
echo "
kind: User
apiVersion: klum.cattle.io/v1alpha1
metadata:
  name: user$i
spec:
  clusterRoles:
  - view
  roles:
  - namespace: user$i
    clusterRole: admin
" | kubectl apply -f-
echo "
apiVersion: v1
kind: Secret
metadata:
  name: user$i
  namespace: klum
  annotations:
    kubernetes.io/service-account.name: user$i
type: kubernetes.io/service-account-token
" | kubectl apply -f-
end

Inspired by https://stackoverflow.com/questions/72256006/service-account-secret-is-not-listed-how-to-fix-it

Thanks & regards,
Philip

@zlodes
Copy link

zlodes commented Jan 17, 2023

Hi! Same with k3s-based cluster.

Klum won't create (or cannot) secrets. Just created secret for ServiceAccount by @PhilipSchmid suggestion and kubeconfig created.

@k11h-de
Copy link

k11h-de commented May 25, 2023

First, thanks a lot for klum and your effort!

Is there any chance to add this secret creation to the klum logic in case k8s >= 1.24 is detected?

Cheers Karsten

@jadolg
Copy link
Contributor

jadolg commented Jun 20, 2023

This works for me.
@ibuildthecloud wdyt?

@k11h-de
Copy link

k11h-de commented Jul 6, 2023

@ibuildthecloud First, thanks a lot for your effort.
do you see any chance to comment on this issue?

@jadolg
Copy link
Contributor

jadolg commented Jul 6, 2023

@k11h-de I believe @ibuildthecloud does not intend to work on this project anymore.
I decided to go ahead and continue working on my fork (That's why I closed the PR).
Feel free to jump over https://github.com/jadolg/klum

@k11h-de
Copy link

k11h-de commented Jul 6, 2023

@jadolg Thanks a lot for your fixes and ongoing development on the code base.

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

6 participants