Install Homebrew first if needed, including its PATH setup instructions. Then install kubectl:
brew install kubectl kubectl version --client
Keep kubectl within the Kubernetes-supported version skew of your API server. Installing the tool alone does not give it access to a cluster.
Enable zsh completion and an alias
Check your shell:
echo "$SHELL"
For zsh, add these lines once to ~/.zshrc:
source <(kubectl completion zsh) alias k=kubectl
Open a new terminal. If completion is not initialized by your shell setup, place these lines before the kubectl completion line:
autoload -Uz compinit compinit
Avoid initializing completion twice if your shell framework already does it.
Connect to a cluster
Follow Configure Kubernetes Access on macOS for a kubeadm cluster. For Omni, download the kubeconfig from Omni and install its login plugin:
brew install kubelogin
See Talos on Proxmox with Omni for that complete workflow and the official kubectl installation guide for alternatives.