macoskubectlpersonal-access-token

Kubelogin doesn't store access token locally


I have to use kubelogin to connect to a remote Kubernetes cluster. Mac OS with version 15.4.1.

Installed kubelogin with Homebrew (only this is available way for Mac):

brew install Azure/kubelogin/kubelogin

It pulls the latest version:

kubelogin version 
git hash: v0.2.8/d7f1c16c95cc0a1a3beb056374def7b744a38b3a
Go version: go1.23.7
Build time: 2025-04-25T17:17:57Z
Platform: darwin/arm64

Also, I created .kube with the config file and certs folder.

When I want to run any command for kubectl shows sign in message:

>kubectl version
To sign in, use a web browser to open the page https://microsoft.com/devicelogin and enter the code CD4RQB3KS to authenticate.
Client Version: v1.30.12
Kustomize Version: v5.0.4-0.20230601165947-6ce0bf390ce3
Server Version: v1.27.2
WARNING: version difference between client (1.30) and server (1.27) exceeds the supported minor version skew of +/-1

Unfortunately, after login, it doesn't store any kubelogin information:

enter image description here

How to solve this issue?


Solution

  • I have found that they updated caching, and from version 0.2.8 it doesn't work with my kubeconfig.

    Downgrading solved this issue.
    Sadly, Brew doesn't have an option to downgrade.

    Solution was:
    - uninstall kubelogin with Homebrew
    - Download a lower version from Github. In my case, it was darwin-arm64
    - unzip it and move to /usr/local/bin
    - open Private and Security settings -> click open anyway, where it is blocked.

    >kubelogin --version
    kubelogin version 
    git hash: v0.1.9/9b6ecad1a09cb72d5cd1ad266ac6977553a67811
    Go version: go1.23.7
    Build time: 2025-03-11T05:40:01Z
    Platform: darwin/arm64
    

    The issue is resolved now:

    enter image description here