A portable Zsh setup tailored for working with Kubernetes — kubectl, Helm,
Argo CD, kube-ps1, fzf — that gracefully skips any tool that isn't
installed on the current machine. Drop the same .zshrc onto any Linux
or macOS host and only the parts whose binaries exist will activate.
- Zsh + Oh My Zsh with the
agnostertheme - kube-ps1 — shows current context and namespace in
RPROMPT - HTTP_PROXY indicator — shows proxy port in the prompt when set
- fzf —
Ctrl-Rhistory,Ctrl-Tfile search
- kubectl, Helm v3
- Krew with
kubectl-ctxandkubectl-nsplugins - Argo CD CLI integration (see below)
- Argo Rollouts completion (when
kubectl-argo-rolloutsis installed)
- All tool completions are loaded only when the binary is present — no errors on minimal hosts.
k argocd ...andk argo rollouts ...autocomplete correctly via a custom dispatcher that bridges kubectl plugin completion gaps.- Argo CD app names and revision SHAs complete dynamically (the argocd CLI itself doesn't ship this) with a 30s cache.
This config adds a kargo shell function that runs argocd --core
against the argocd namespace without touching your current kubectl
context — useful when your day-to-day namespace is something else:
kargo app list
kargo app sync zentra-prod --revision <SHA>
kargo app history porta-prodYou can also use the kubectl-plugin form, which has identical completion:
k argocd app sync zentra-prod --revision <TAB> # → list of historical SHAs, newest first
k argocd app sync <TAB> # → list of app namesThe kargo command works by spinning up a throwaway kubeconfig that
points to namespace argocd, running argocd Core mode against it, then
deleting it on exit. Your real ~/.kube/config and current namespace are
never modified.
- Linux or macOS
curlsudo(only needed bysetup.shto install system packages)
git clone https://github.com/shirzady1934/zshrc ~/zshrc
~/zshrc/setup.sh
exec zshsetup.sh installs the tools and copies .zshrc into place (your
existing ~/.zshrc is backed up to ~/.zshrc.bak.<timestamp>).
git clone https://github.com/shirzady1934/zshrc ~/zshrc
ln -sf ~/zshrc/.zshrc ~/.zshrc
exec zshARGOCD_VERSION=v3.3.9 ~/zshrc/setup.sh # pin to cluster version
INSTALL_ARGOCD=no ~/zshrc/setup.sh # skip argocd
INSTALL_ARGO_ROLLOUTS=no ~/zshrc/setup.sh # skip rollouts plugin
INSTALL_ZSHRC=no ~/zshrc/setup.sh # don't touch ~/.zshrc- Detects OS — Linux or macOS.
- Installs base packages via
apt,dnf,yum,pacman, orbrew: git, curl, zsh, tar, unzip, ca-certificates, fzf. - Installs Oh My Zsh (skips if already present).
- Installs latest kubectl to
/usr/local/bin. - Installs latest Helm v3.
- Installs latest Argo CD CLI (
ARGOCD_VERSION=to pin,INSTALL_ARGOCD=noto skip). - Installs latest
kubectl-argo-rollouts+ generates~/.argo-rollouts-completion.zsh(ARGO_ROLLOUTS_VERSION=/INSTALL_ARGO_ROLLOUTS=no). - Installs kube-ps1 to
~/.kube-ps1. - Installs Krew + the
ctxandnsplugins. - Installs
.zshrcfrom the repo into$HOME(backs up any existing non-symlink). Skip withINSTALL_ZSHRC=no.
It is idempotent — re-running it skips anything already installed.
| OS | Package manager |
|---|---|
| Debian / Ubuntu | apt |
| RHEL / CentOS / Fedora | dnf / yum |
| Arch Linux | pacman |
| macOS | brew (installed if missing) |
The .zshrc is designed to be the same file across every machine.
Each tool-specific block is guarded with a command -v (or file existence)
check, so missing tools don't produce errors or block shell startup:
| Guarded section | Activation condition |
|---|---|
| Docker completion | docker on $PATH |
| kubectl completion + dispatcher | kubectl on $PATH |
| Helm completion | helm on $PATH |
Argo CD completion + kargo + smart completions |
both argocd and kubectl on $PATH |
| Argo Rollouts completion | kubectl-argo-rollouts on $PATH |
| kube-ps1 prompt | ~/.kube-ps1/kube-ps1.sh exists |
myenv (Python venv) alias |
~/Tensorflow/.env/ exists |
proton alias |
Proton binary exists |
CUDA LD_LIBRARY_PATH |
/usr/local/cuda/lib64 exists |
PATH is managed with typeset -U path so entries auto-dedupe — safe to
re-source the rc file repeatedly.
exec zshYou should see something like:
user@host ~ (⎈|my-cluster:default)
Try:
| Command | Result |
|---|---|
kctx |
Switch kubectl context (krew plugin) |
kns |
Switch namespace (krew plugin) |
Ctrl-R |
fzf history search |
Ctrl-T |
fzf file search |
kargo app list |
List Argo CD apps in core mode |
k argocd app sync <TAB> |
Tab-complete app names |
k argocd app sync <app> --revision <TAB> |
Tab-complete deploy SHAs |
You probably edited .zshrc and need to clear the completion cache:
rm -f ~/.zcompdump* && exec zshzsh prefers a compiled .zwc dump over the live config — stale dumps
cause "unknown command" or "file completion" surprises.
Argo CD Core mode reads its configmap from the current kubeconfig
context's namespace. Use the bundled kargo wrapper, which temporarily
points to namespace argocd, or switch namespace with kns argocd.
This was kubectl's completion intercepting k argocd <TAB>. The included
_k_dispatch function fixes it — make sure the .zshrc is loaded and
the dump is fresh (see above).
setup.sh will exit and print the package list to install manually.
setup.sh does not configure cloud CLIs or ~/.kube/config. Set those
up separately.