kos31de.txt

140文字に収まらないテクノロジーとか日常とかのこと

kubectlのエイリアスの設定(zshの場合)

これを.zshrcに書きましょう。

source <(kubectl completion zsh)
alias k=kubectl
compdef __start_kubectl k

以下のように補完されます。 kに続けてaと打った例。 コマンドの簡単な説明もついてて良いです。 エイリアスはkにしてますが、kcとかお好きな短いものを設定して下さい。

$ k a
alpha          -- Commands for features in alpha
annotate       -- Update the annotations on a resource
api-resources  -- Print the supported API resources on the server
api-versions   -- Print the supported API versions on the server, in the form of "group/version"
apply          -- Apply a configuration to a resource by file name or stdin
attach         -- Attach to a running container
auth           -- Inspect authorization
autoscale      -- Auto-scale a deployment, replica set, stateful set, or replication controller

公式ドキュメントのここに載っていました。