How azure/kubelogin works
kubelogin is a Kubernetes client-go exec credential plugin for Azure authentication. Its principal workflow is invoked by kubectl, runs the plugin command to obtain credentials, and returns an exec-plugin credential result; it also converts existing kubeconfigs and exposes token-provider and Proof-of-Possession (PoP) library functionality. The tree documents multiple Azure login modes, while sampled source confirms conversion, options, token-provider, and PoP/cache components. Links to unsampled credential implementations are omitted where call ownership is not shown.
Main entry points: options.go Authentication options · token Credential providers · cmd CLI commands · poptoken.go PoP token acquisition
Components 20
Command interface
- CLI entry point
main.go - CLI commands
pkg/cmd - Get-token command
pkg/cmd/token.go - Cache removal
pkg/cmd/removecachedir.go
Azure authentication
- Authentication options
pkg/internal/token/options.go - Environment settings
pkg/internal/env/variables.go - Credential providers
pkg/internal/token - Exec credential output
pkg/internal/token/execCredentialPlugin.go
Kubeconfig conversion
- Convert command
pkg/cmd/convert.go - Kubeconfig conversion
pkg/internal/converter/convert.go
PoP and cache
- PoP token acquisition
pkg/internal/pop/poptoken.go - PoP cache
pkg/internal/pop/cache/cache.go - Linux cache storage
pkg/internal/pop/cache/linux.go - JWE encryption
pkg/internal/pop/cache/internal/jwe/jwe.go - AES-CBC encryption
pkg/internal/pop/cache/internal/aescbc/aescbc.go
Public libraries
- Public token provider
pkg/token/provider.go - Public token options
pkg/token/options_ctor.go - Public PoP API
pkg/pop/poptoken.go
Other components
- kubectl client
- Azure identity service
Connections 18
- kubectl client → CLI entry point: invokes plugin
README.md - CLI entry point → CLI commands: executes root command
main.go - CLI commands → Get-token command: dispatches command
- CLI commands → Convert command: dispatches command
- Convert command → Kubeconfig conversion: calls conversion
pkg/cmd/convert.go - Kubeconfig conversion → Authentication options: uses token options
pkg/internal/converter/convert.go - Get-token command → Credential providers: uses token package
pkg/cmd/token.go - Credential providers → Exec credential output: produces exec credentials
- Authentication options → Environment settings: reads settings
pkg/internal/token/options.go - Authentication options → PoP cache: configures PoP cache
pkg/internal/token/options.go - Authentication options → PoP token acquisition: uses PoP support
pkg/internal/token/options.go - Credential providers → Azure identity service: requests Azure tokens
- Public token options → Authentication options: converts options
pkg/token/options_ctor.go - Public token provider → Credential providers: creates credential
pkg/token/provider.go - Public PoP API → PoP token acquisition: delegates acquisition
pkg/pop/poptoken.go - PoP token acquisition → PoP cache: uses cache
pkg/internal/pop/poptoken.go - Linux cache storage → JWE encryption: encrypts cache data
pkg/internal/pop/cache/linux.go - JWE encryption → AES-CBC encryption: uses encryption
pkg/internal/pop/cache/internal/jwe/jwe.go