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

Allow per user based kubelogin lock file #909

Closed
wants to merge 2 commits into from

Conversation

tommylogik
Copy link

Purpose of this feature


In a multi-user environment we need to be able to simultaneously have users login to a kubernetes cluster.

Updating this method to go from using the os temp directory to using the user home directory to create the generated lock filename allows for multi-user capable login. If the user doesn't have the proper environment variable set (HOME,USERPROFILE,home), it falls back to the default temp directory.

Current workaround


The current workaround for this functionality is to temporarily set TMPDIR env variable to the users home directory and then reset it to the temp directory

For example:

$ export OLD_TMPDIR=$(echo $TMPDIR)
$ kubectl oidc-login
$ export TMPDIR=$(echo $OLD_TMPDIR)

This will work for the time being but I would love to not have to implement this workaround and have it part of the core functionality of kubelogin's master branch.

@MioOgbeni
Copy link

I would also appreciate this PR. Can you review it @int128?

@reinka
Copy link

reinka commented Jun 28, 2023

Same here :) Ping @int128

@R-Studio
Copy link

R-Studio commented Aug 15, 2024

Same issue here. 😒

Workaround

  • Add the TMPDIR variable in kubeconfig in the users section. (Please replace <USERNAME> with your username!):
...
users:
- name: oidc
  user:
    exec:
      apiVersion: client.authentication.k8s.io/v1beta1
      args:
      - oidc-login
      - get-token
      - --oidc-issuer-url=https://<YOUR_KEYCLOAK>/realms/<REALM_NAME>
      - --oidc-client-id=kubernetes
      - --oidc-client-secret=<REDACTED>
      - --oidc-extra-scope=email
      - --oidc-extra-scope=groups
      command: kubectl
      env:
      - name: TMPDIR
        value: /home/<USERNAME>
      interactiveMode: IfAvailable
      provideClusterInfo: false

@int128
Copy link
Owner

int128 commented Oct 26, 2024

This issue has been resolved by #1126

@int128 int128 closed this Oct 26, 2024
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

Successfully merging this pull request may close these issues.

5 participants