From 9430d936c10b7339130b82e7dcf6e8d60af827cc Mon Sep 17 00:00:00 2001 From: Kyle Schultz <82205484+kylejschultz@users.noreply.github.com> Date: Thu, 16 Nov 2023 13:24:48 -0800 Subject: [PATCH 01/16] Update README.md --- README.md | 38 +++++++++----------------------------- 1 file changed, 9 insertions(+), 29 deletions(-) diff --git a/README.md b/README.md index 3ce9325..03c2d37 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,12 @@ -402 kubectl Conflict-Free Lexical Aliases (Kubernetes resources, APIs, CRDs, Istio, Flagger, Canaries) +# Conflict-Free Kubectl aliases - forked from alaa/kubectl-aliases + +## How To Install +- Place the kubectl.plugin.zsh in `$ZSH_CUSTOM/plugins/kubectl` +- Add `kubectl` to the list of ZSH Plugins in `~/.zshrc` file. +- Reload ZSH using with `source $ZSH/oh-my-zsh.sh` or start a new terminal session. +- Alternatively, you can store the file in another working directory and use `mkdir -p $ZSH_CUSTOM/plugins/kubectl && ln -s /path/to/kubectl.plugin.zsh $ZSH_CUSTOM/plugins/kubectl` to keep the file more easily available for updating as not all references are included here. + +## Command Reference _(May be out of date - check plugin file for most up to date)_ ``` alias kgcr='kubectl get clusterrole' @@ -411,31 +419,3 @@ alias ktp='kubectl top pod' alias ktn='kubectl top node' ``` - -# How to install the as ZSH plugin - -## Download the file from master and put on the custom folder. -``` -cd $ZSH_CUSTOM; mkdir kubectl; cd kubectl; wget https://raw.githubusercontent.com/alaa/kubectl-aliases/master/kubectl.plugin.zsh -``` - -## Update the ~/.zsh -``` -vi ~/.zshrc -``` - -### Add the `kubectl` plugin to the enable ones -``` -# Which plugins would you like to load? -# Standard plugins can be found in ~/.oh-my-zsh/plugins/* -# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/ -# Example format: plugins=(rails git textmate ruby lighthouse) -# Add wisely, as too many plugins slow down shell startup. -plugins=( - ... - kubectl - ... - ) - -source $ZSH/oh-my-zsh.sh - ``` From bdef4155d454ff5b3b0bd733e3bca30b0875697e Mon Sep 17 00:00:00 2001 From: Kyle Schultz <82205484+kylejschultz@users.noreply.github.com> Date: Thu, 16 Nov 2023 13:25:35 -0800 Subject: [PATCH 02/16] Update kubectl.plugin.zsh Add kubectl describe virtualservices alias. --- kubectl.plugin.zsh | 1 + 1 file changed, 1 insertion(+) diff --git a/kubectl.plugin.zsh b/kubectl.plugin.zsh index ad57682..2f8c66a 100644 --- a/kubectl.plugin.zsh +++ b/kubectl.plugin.zsh @@ -392,6 +392,7 @@ alias kgvsn='kubectl get virtualservices.networking.istio.io --namespace' alias kgvsnw='kubectl get virtualservices.networking.istio.io --watch --namespace' alias kgvsa='kubectl get virtualservices.networking.istio.io --all-namespaces' alias kgvsaw='kubectl get virtualservices.networking.istio.io --all-namespaces --watch' +alias kdvs='kubectl describe virtualservices.networking.istio.io' alias kgg='kubectl get gateways.networking.istio.io' alias kggw='kubectl get gateways.networking.istio.io --watch' alias kggn='kubectl get gateways.networking.istio.io --namespace' From 74b1a58e57c73311441d48d404f8705e3f34b7c7 Mon Sep 17 00:00:00 2001 From: Kyle Schultz <82205484+kylejschultz@users.noreply.github.com> Date: Thu, 16 Nov 2023 13:33:09 -0800 Subject: [PATCH 03/16] Update README.md Collapse command references for visibility --- README.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 03c2d37..a74702f 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,9 @@ - Alternatively, you can store the file in another working directory and use `mkdir -p $ZSH_CUSTOM/plugins/kubectl && ln -s /path/to/kubectl.plugin.zsh $ZSH_CUSTOM/plugins/kubectl` to keep the file more easily available for updating as not all references are included here. ## Command Reference _(May be out of date - check plugin file for most up to date)_ - +
+ Expand + ``` alias kgcr='kubectl get clusterrole' alias kgcrw='kubectl get clusterrole --watch' @@ -419,3 +421,4 @@ alias ktp='kubectl top pod' alias ktn='kubectl top node' ``` +
From e9379ed10f88257c2217b70c0cdbe0f448a2d846 Mon Sep 17 00:00:00 2001 From: Kyle Schultz <82205484+kylejschultz@users.noreply.github.com> Date: Thu, 16 Nov 2023 13:46:59 -0800 Subject: [PATCH 04/16] Update README.md --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index a74702f..4fceed4 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,10 @@ # Conflict-Free Kubectl aliases - forked from alaa/kubectl-aliases ## How To Install -- Place the kubectl.plugin.zsh in `$ZSH_CUSTOM/plugins/kubectl` -- Add `kubectl` to the list of ZSH Plugins in `~/.zshrc` file. +- Clone repo to whatever local directory you prefer. +- Create a symlink from the local dir to the ZSH_CUSTOM path by using `ln -s "$(pwd)/kubectl-aliases" $ZSH_CUSTOM/plugins` +- Modify the plugins list in the `~/.zshrc` file and add `kubectl-aliases`. This list is space separated. - Reload ZSH using with `source $ZSH/oh-my-zsh.sh` or start a new terminal session. -- Alternatively, you can store the file in another working directory and use `mkdir -p $ZSH_CUSTOM/plugins/kubectl && ln -s /path/to/kubectl.plugin.zsh $ZSH_CUSTOM/plugins/kubectl` to keep the file more easily available for updating as not all references are included here. ## Command Reference _(May be out of date - check plugin file for most up to date)_
From 107f5a69343bb6ae7e19c7e4f5d923f5d0916585 Mon Sep 17 00:00:00 2001 From: Kyle Schultz <82205484+kylejschultz@users.noreply.github.com> Date: Thu, 16 Nov 2023 13:47:17 -0800 Subject: [PATCH 05/16] Rename kubectl.plugin.zsh to kubectl-aliases.plugin.zsh --- kubectl.plugin.zsh => kubectl-aliases.plugin.zsh | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename kubectl.plugin.zsh => kubectl-aliases.plugin.zsh (100%) diff --git a/kubectl.plugin.zsh b/kubectl-aliases.plugin.zsh similarity index 100% rename from kubectl.plugin.zsh rename to kubectl-aliases.plugin.zsh From f3b9cb726e0d0b11fdbb1bc0b320dc252c57e629 Mon Sep 17 00:00:00 2001 From: Kyle Schultz <82205484+kylejschultz@users.noreply.github.com> Date: Thu, 16 Nov 2023 15:00:30 -0800 Subject: [PATCH 06/16] Update kubectl-aliases.plugin.zsh Add notes and reorganize commands --- kubectl-aliases.plugin.zsh | 279 ++++++++++++++++++++++--------------- 1 file changed, 163 insertions(+), 116 deletions(-) diff --git a/kubectl-aliases.plugin.zsh b/kubectl-aliases.plugin.zsh index 2f8c66a..06177d2 100644 --- a/kubectl-aliases.plugin.zsh +++ b/kubectl-aliases.plugin.zsh @@ -11,6 +11,7 @@ confirm() { fi } +# Force confirmation before using kaf (kubectl apply -f $1) safe_kubectlapply() { context=$(kubectl config current-context) echo "\n" @@ -30,8 +31,10 @@ if (( $+commands[kubectl] )); then unset __KUBECTL_COMPLETION_FILE fi -# This command is used a LOT both below and in daily life alias k=kubectl +# +# Cluster Roles and Cluster Role Bindings +# alias kgcr='kubectl get clusterrole' alias kgcrw='kubectl get clusterrole --watch' alias kecr='kubectl edit clusterrole' @@ -42,6 +45,9 @@ alias kgcrbw='kubectl get clusterrolebinding --watch' alias kecrb='kubectl edit clusterrolebinding' alias kdcrb='kubectl describe clusterrolebinding' alias kdelcrb='kubectl delete clusterrolebinding' +# +# Jobs and Cronjobs +# alias kgcj='kubectl get cronjob' alias kgcjw='kubectl get cronjob --watch' alias kgcjn='kubectl get cronjob --namespace' @@ -66,6 +72,9 @@ alias kdj='kubectl describe job' alias kdjn='kubectl describe job --namespace' alias kdelj='kubectl delete job' alias kdeljn='kubectl delete job --namespace' +# +# Daemon Sets +# alias kgds='kubectl get daemonset' alias kgdsw='kubectl get daemonset --watch' alias kgdsn='kubectl get daemonset --namespace' @@ -78,23 +87,9 @@ alias kdds='kubectl describe daemonset' alias kddsn='kubectl describe daemonset --namespace' alias kdelds='kubectl delete daemonset' alias kdeldsn='kubectl delete daemonset --namespace' -alias kgpdb='kubectl get poddisruptionbudget' -alias kgpdbw='kubectl get poddisruptionbudget --watch' -alias kgpdbn='kubectl get poddisruptionbudget --namespace' -alias kgpdbnw='kubectl get poddisruptionbudget --watch --namespace' -alias kgpdba='kubectl get poddisruptionbudget --all-namespaces' -alias kgpdbaw='kubectl get poddisruptionbudget --all-namespaces --watch' -alias kepdb='kubectl edit poddisruptionbudget' -alias kepdbn='kubectl edit poddisruptionbudget --namespace' -alias kdpdb='kubectl describe poddisruptionbudget' -alias kdpdbn='kubectl describe poddisruptionbudget --namespace' -alias kdelpdb='kubectl delete poddisruptionbudget' -alias kdelpdbn='kubectl delete poddisruptionbudget --namespace' -alias kgpc='kubectl get priorityclass' -alias kgpcw='kubectl get priorityclass --watch' -alias kepc='kubectl edit priorityclass' -alias kdpc='kubectl describe priorityclass' -alias kdelpc='kubectl delete priorityclass' +# +# Roles and Rolebindings +# alias kgr='kubectl get role' alias kgrw='kubectl get role --watch' alias kgrn='kubectl get role --namespace' @@ -119,6 +114,9 @@ alias kdrb='kubectl describe rolebinding' alias kdrbn='kubectl describe rolebinding --namespace' alias kdelrb='kubectl delete rolebinding' alias kdelrbn='kubectl delete rolebinding --namespace' +# +# Pods, Pod Templates, Pod Disruption Budgets, Pod Security Policy +# alias kgp='kubectl get pod' alias kgpw='kubectl get pod --watch' alias kgpn='kubectl get pod --namespace' @@ -131,6 +129,38 @@ alias kdp='kubectl describe pod' alias kdpn='kubectl describe pod --namespace' alias kdelp='kubectl delete pod' alias kdelpn='kubectl delete pod --namespace' +alias kgpt='kubectl get podtemplate' +alias kgptw='kubectl get podtemplate --watch' +alias kgptn='kubectl get podtemplate --namespace' +alias kgptnw='kubectl get podtemplate --watch --namespace' +alias kgpta='kubectl get podtemplate --all-namespaces' +alias kgptaw='kubectl get podtemplate --all-namespaces --watch' +alias kept='kubectl edit podtemplate' +alias keptn='kubectl edit podtemplate --namespace' +alias kdpt='kubectl describe podtemplate' +alias kdptn='kubectl describe podtemplate --namespace' +alias kdelpt='kubectl delete podtemplate' +alias kdelptn='kubectl delete podtemplate --namespace' +alias kgpdb='kubectl get poddisruptionbudget' +alias kgpdbw='kubectl get poddisruptionbudget --watch' +alias kgpdbn='kubectl get poddisruptionbudget --namespace' +alias kgpdbnw='kubectl get poddisruptionbudget --watch --namespace' +alias kgpdba='kubectl get poddisruptionbudget --all-namespaces' +alias kgpdbaw='kubectl get poddisruptionbudget --all-namespaces --watch' +alias kepdb='kubectl edit poddisruptionbudget' +alias kepdbn='kubectl edit poddisruptionbudget --namespace' +alias kdpdb='kubectl describe poddisruptionbudget' +alias kdpdbn='kubectl describe poddisruptionbudget --namespace' +alias kdelpdb='kubectl delete poddisruptionbudget' +alias kdelpdbn='kubectl delete poddisruptionbudget --namespace' +alias kgpsp='kubectl get podsecuritypolicy' +alias kgpspw='kubectl get podsecuritypolicy --watch' +alias kepsp='kubectl edit podsecuritypolicy' +alias kdpsp='kubectl describe podsecuritypolicy' +alias kdelpsp='kubectl delete podsecuritypolicy' +# +# Deployments, Stateful Sets, Replica Sets, HPA +# alias kgd='kubectl get deployment' alias kgdw='kubectl get deployment --watch' alias kgdn='kubectl get deployment --namespace' @@ -155,6 +185,33 @@ alias kdss='kubectl describe statefulset' alias kdssn='kubectl describe statefulset --namespace' alias kdelss='kubectl delete statefulset' alias kdelssn='kubectl delete statefulset --namespace' +alias kgrs='kubectl get replicaset' +alias kgrsw='kubectl get replicaset --watch' +alias kgrsn='kubectl get replicaset --namespace' +alias kgrsnw='kubectl get replicaset --watch --namespace' +alias kgrsa='kubectl get replicaset --all-namespaces' +alias kgrsaw='kubectl get replicaset --all-namespaces --watch' +alias kers='kubectl edit replicaset' +alias kersn='kubectl edit replicaset --namespace' +alias kdrs='kubectl describe replicaset' +alias kdrsn='kubectl describe replicaset --namespace' +alias kdelrs='kubectl delete replicaset' +alias kdelrsn='kubectl delete replicaset --namespace' +alias kghpa='kubectl get horizontalpodautoscaler' +alias kghpaw='kubectl get horizontalpodautoscaler --watch' +alias kghpan='kubectl get horizontalpodautoscaler --namespace' +alias kghpanw='kubectl get horizontalpodautoscaler --watch --namespace' +alias kghpaa='kubectl get horizontalpodautoscaler --all-namespaces' +alias kghpaaw='kubectl get horizontalpodautoscaler --all-namespaces --watch' +alias kehpa='kubectl edit horizontalpodautoscaler' +alias kehpan='kubectl edit horizontalpodautoscaler --namespace' +alias kdhpa='kubectl describe horizontalpodautoscaler' +alias kdhpan='kubectl describe horizontalpodautoscaler --namespace' +alias kdelhpa='kubectl delete horizontalpodautoscaler' +alias kdelhpan='kubectl delete horizontalpodautoscaler --namespace' +# +# Storage +# alias kgpvc='kubectl get persistentvolumeclaim' alias kgpvcw='kubectl get persistentvolumeclaim --watch' alias kgpvcn='kubectl get persistentvolumeclaim --namespace' @@ -172,6 +229,14 @@ alias kgpvw='kubectl get persistentvolume --watch' alias kepv='kubectl edit persistentvolume' alias kdpv='kubectl describe persistentvolume' alias kdelpv='kubectl delete persistentvolume' +alias kgsc='kubectl get storageclass' +alias kgscw='kubectl get storageclass --watch' +alias kesc='kubectl edit storageclass' +alias kdsc='kubectl describe storageclass' +alias kdelsc='kubectl delete storageclass' +# +# Ingress and Services +# alias kgi='kubectl get ingress' alias kgiw='kubectl get ingress --watch' alias kgin='kubectl get ingress --namespace' @@ -196,11 +261,9 @@ alias kdsvc='kubectl describe service' alias kdsvcn='kubectl describe service --namespace' alias kdelsvc='kubectl delete service' alias kdelsvcn='kubectl delete service --namespace' -alias kgsc='kubectl get storageclass' -alias kgscw='kubectl get storageclass --watch' -alias kesc='kubectl edit storageclass' -alias kdsc='kubectl describe storageclass' -alias kdelsc='kubectl delete storageclass' +# +# Secrets and Config Maps +# alias kgsec='kubectl get secret' alias kgsecw='kubectl get secret --watch' alias kgsecn='kubectl get secret --namespace' @@ -225,6 +288,9 @@ alias kdcm='kubectl describe configmap' alias kdcmn='kubectl describe configmap --namespace' alias kdelcm='kubectl delete configmap' alias kdelcmn='kubectl delete configmap --namespace' +# +# Service Accounts +# alias kgsa='kubectl get serviceaccount' alias kgsaw='kubectl get serviceaccount --watch' alias kgsan='kubectl get serviceaccount --namespace' @@ -237,6 +303,9 @@ alias kdsa='kubectl describe serviceaccount' alias kdsan='kubectl describe serviceaccount --namespace' alias kdelsa='kubectl delete serviceaccount' alias kdelsan='kubectl delete serviceaccount --namespace' +# +# Nodes, Events, Namespaces +# alias kgno='kubectl get node' alias kgnow='kubectl get node --watch' alias keno='kubectl edit node' @@ -244,57 +313,38 @@ alias kdno='kubectl describe node' alias kdelno='kubectl delete node' alias kgev='kubectl get event' alias kgevw='kubectl get event --watch' +alias kgns='kubectl get namespace' +alias kgnsw='kubectl get namespace --watch' +alias kens='kubectl edit namespace' +alias kdns='kubectl describe namespace' +alias kdelns='kubectl delete namespace' +# +# Certificates and Security +# alias kgcsr='kubectl get certificatesigningrequest' alias kgcsrw='kubectl get certificatesigningrequest --watch' alias kecsr='kubectl edit certificatesigningrequest' alias kdcsr='kubectl describe certificatesigningrequest' alias kdelcsr='kubectl delete certificatesigningrequest' -alias kghpa='kubectl get horizontalpodautoscaler' -alias kghpaw='kubectl get horizontalpodautoscaler --watch' -alias kghpan='kubectl get horizontalpodautoscaler --namespace' -alias kghpanw='kubectl get horizontalpodautoscaler --watch --namespace' -alias kghpaa='kubectl get horizontalpodautoscaler --all-namespaces' -alias kghpaaw='kubectl get horizontalpodautoscaler --all-namespaces --watch' -alias kehpa='kubectl edit horizontalpodautoscaler' -alias kehpan='kubectl edit horizontalpodautoscaler --namespace' -alias kdhpa='kubectl describe horizontalpodautoscaler' -alias kdhpan='kubectl describe horizontalpodautoscaler --namespace' -alias kdelhpa='kubectl delete horizontalpodautoscaler' -alias kdelhpan='kubectl delete horizontalpodautoscaler --namespace' -alias kgpsp='kubectl get podsecuritypolicy' -alias kgpspw='kubectl get podsecuritypolicy --watch' -alias kepsp='kubectl edit podsecuritypolicy' -alias kdpsp='kubectl describe podsecuritypolicy' -alias kdelpsp='kubectl delete podsecuritypolicy' -alias kgpt='kubectl get podtemplate' -alias kgptw='kubectl get podtemplate --watch' -alias kgptn='kubectl get podtemplate --namespace' -alias kgptnw='kubectl get podtemplate --watch --namespace' -alias kgpta='kubectl get podtemplate --all-namespaces' -alias kgptaw='kubectl get podtemplate --all-namespaces --watch' -alias kept='kubectl edit podtemplate' -alias keptn='kubectl edit podtemplate --namespace' -alias kdpt='kubectl describe podtemplate' -alias kdptn='kubectl describe podtemplate --namespace' -alias kdelpt='kubectl delete podtemplate' -alias kdelptn='kubectl delete podtemplate --namespace' -alias kgcs='kubectl get componentstatus' -alias kgcsw='kubectl get componentstatus --watch' -alias kecs='kubectl edit componentstatus' -alias kdcs='kubectl describe componentstatus' -alias kdelcs='kubectl delete componentstatus' -alias kgrs='kubectl get replicaset' -alias kgrsw='kubectl get replicaset --watch' -alias kgrsn='kubectl get replicaset --namespace' -alias kgrsnw='kubectl get replicaset --watch --namespace' -alias kgrsa='kubectl get replicaset --all-namespaces' -alias kgrsaw='kubectl get replicaset --all-namespaces --watch' -alias kers='kubectl edit replicaset' -alias kersn='kubectl edit replicaset --namespace' -alias kdrs='kubectl describe replicaset' -alias kdrsn='kubectl describe replicaset --namespace' -alias kdelrs='kubectl delete replicaset' -alias kdelrsn='kubectl delete replicaset --namespace' +# +# Istio Virtual Servicxes, Gateways, and Destination Rules +# +alias kgvs='kubectl get virtualservices.networking.istio.io' +alias kgvsw='kubectl get virtualservices.networking.istio.io --watch' +alias kgvsn='kubectl get virtualservices.networking.istio.io --namespace' +alias kgvsnw='kubectl get virtualservices.networking.istio.io --watch --namespace' +alias kgvsa='kubectl get virtualservices.networking.istio.io --all-namespaces' +alias kgvsaw='kubectl get virtualservices.networking.istio.io --all-namespaces --watch' +alias kdvs='kubectl describe virtualservices.networking.istio.io' +alias kgg='kubectl get gateways.networking.istio.io' +alias kggw='kubectl get gateways.networking.istio.io --watch' +alias kggn='kubectl get gateways.networking.istio.io --namespace' +alias kggnw='kubectl get gateways.networking.istio.io --watch --namespace' +alias kgga='kubectl get gateways.networking.istio.io --all-namespaces' +alias kggaw='kubectl get gateways.networking.istio.io --all-namespaces --watch' +# +# Network Policies, Endpoints, +# alias kgep='kubectl get endpoints' alias kgepw='kubectl get endpoints --watch' alias kgepn='kubectl get endpoints --namespace' @@ -307,11 +357,25 @@ alias kdep='kubectl describe endpoints' alias kdepn='kubectl describe endpoints --namespace' alias kdelep='kubectl delete endpoints' alias kdelepn='kubectl delete endpoints --namespace' -alias kgns='kubectl get namespace' -alias kgnsw='kubectl get namespace --watch' -alias kens='kubectl edit namespace' -alias kdns='kubectl describe namespace' -alias kdelns='kubectl delete namespace' +alias kgnp='kubectl get networkpolicy' +alias kgnpw='kubectl get networkpolicy --watch' +alias kgnpn='kubectl get networkpolicy --namespace' +alias kgnpnw='kubectl get networkpolicy --watch --namespace' +alias kgnpa='kubectl get networkpolicy --all-namespaces' +alias kgnpaw='kubectl get networkpolicy --all-namespaces --watch' +alias kenp='kubectl edit networkpolicy' +alias kenpn='kubectl edit networkpolicy --namespace' +alias kdnp='kubectl describe networkpolicy' +alias kdnpn='kubectl describe networkpolicy --namespace' +alias kdelnp='kubectl delete networkpolicy' +alias kdelnpn='kubectl delete networkpolicy --namespace' + + +alias kgcs='kubectl get componentstatus' +alias kgcsw='kubectl get componentstatus --watch' +alias kecs='kubectl edit componentstatus' +alias kdcs='kubectl describe componentstatus' +alias kdelcs='kubectl delete componentstatus' alias kgrc='kubectl get replicationcontroller' alias kgrcw='kubectl get replicationcontroller --watch' alias kgrcn='kubectl get replicationcontroller --namespace' @@ -336,18 +400,9 @@ alias kdcrev='kubectl describe controllerrevision' alias kdcrevn='kubectl describe controllerrevision --namespace' alias kdelcrev='kubectl delete controllerrevision' alias kdelcrevn='kubectl delete controllerrevision --namespace' -alias kgnp='kubectl get networkpolicy' -alias kgnpw='kubectl get networkpolicy --watch' -alias kgnpn='kubectl get networkpolicy --namespace' -alias kgnpnw='kubectl get networkpolicy --watch --namespace' -alias kgnpa='kubectl get networkpolicy --all-namespaces' -alias kgnpaw='kubectl get networkpolicy --all-namespaces --watch' -alias kenp='kubectl edit networkpolicy' -alias kenpn='kubectl edit networkpolicy --namespace' -alias kdnp='kubectl describe networkpolicy' -alias kdnpn='kubectl describe networkpolicy --namespace' -alias kdelnp='kubectl delete networkpolicy' -alias kdelnpn='kubectl delete networkpolicy --namespace' +# +# Resource Management +# alias kgli='kubectl get limitrange' alias kgliw='kubectl get limitrange --watch' alias kglin='kubectl get limitrange --namespace' @@ -372,40 +427,27 @@ alias kdqu='kubectl describe resourcequota' alias kdqun='kubectl describe resourcequota --namespace' alias kdelqu='kubectl delete resourcequota' alias kdelqun='kubectl delete resourcequota --namespace' -alias kgmwh='kubectl get mutatingwebhookconfigurations' -alias kgmwhw='kubectl get mutatingwebhookconfigurations --watch' -alias kemwh='kubectl edit mutatingwebhookconfigurations' -alias kdmwh='kubectl describe mutatingwebhookconfigurations' -alias kdelmwh='kubectl delete mutatingwebhookconfigurations' -alias kgvwh='kubectl get validatingwebhookconfigurations' -alias kgvwhw='kubectl get validatingwebhookconfigurations --watch' -alias kevwh='kubectl edit validatingwebhookconfigurations' -alias kdvwh='kubectl describe validatingwebhookconfigurations' -alias kdelvwh='kubectl delete validatingwebhookconfigurations' +alias ktp='kubectl top pod' +alias ktn='kubectl top node' +# +# APIs and CRDs +# alias kgapi='kubectl get apiservices.apiregistration.k8s.io' alias kgapiw='kubectl get apiservices.apiregistration.k8s.io --watch' alias kgcrd='kubectl get customresourcedefinitions.apiextensions.k8s.io' alias kgcrdw='kubectl get customresourcedefinitions.apiextensions.k8s.io --watch' -alias kgvs='kubectl get virtualservices.networking.istio.io' -alias kgvsw='kubectl get virtualservices.networking.istio.io --watch' -alias kgvsn='kubectl get virtualservices.networking.istio.io --namespace' -alias kgvsnw='kubectl get virtualservices.networking.istio.io --watch --namespace' -alias kgvsa='kubectl get virtualservices.networking.istio.io --all-namespaces' -alias kgvsaw='kubectl get virtualservices.networking.istio.io --all-namespaces --watch' -alias kdvs='kubectl describe virtualservices.networking.istio.io' -alias kgg='kubectl get gateways.networking.istio.io' -alias kggw='kubectl get gateways.networking.istio.io --watch' -alias kggn='kubectl get gateways.networking.istio.io --namespace' -alias kggnw='kubectl get gateways.networking.istio.io --watch --namespace' -alias kgga='kubectl get gateways.networking.istio.io --all-namespaces' -alias kggaw='kubectl get gateways.networking.istio.io --all-namespaces --watch' +# +# Canaries +# alias kgcan='kubectl get canaries.flagger.app' alias kgcanw='kubectl get canaries.flagger.app --watch' alias kgcann='kubectl get canaries.flagger.app --namespace' alias kgcannw='kubectl get canaries.flagger.app --watch --namespace' alias kgcana='kubectl get canaries.flagger.app --all-namespaces' alias kgcanaw='kubectl get canaries.flagger.app --all-namespaces --watch' - +# +# Contexts and open-ended commands (used for items not included above) +# alias kcuc='kubectl config use-context' alias kcsc='kubectl config set-context' alias kcdc='kubectl config delete-context' @@ -417,19 +459,25 @@ alias kdel='kubectl delete' alias kdelf='kubectl delete -f' alias kgpl='kgp -l' alias kcn='kubectl config set-context $(kubectl config current-context) --namespace' - +# +# Misc kubectl commands +# alias kpf="kubectl port-forward" alias kcp='kubectl cp' alias kaf='safe_kubectlapply' alias keit='kubectl exec -it' - +# +# Rollout Restarts +# alias krh='kubectl rollout history' alias kru='kubectl rollout undo' alias krsss='kubectl rollout status statefulset' - +alias krrsts='kubectl rollout restart sts' alias kga='kubectl get all' alias kgaa='kubectl get all --all-namespaces' - +# +# Logs +# alias kl='kubectl logs' alias kl1h='kubectl logs --since 1h' alias kl1m='kubectl logs --since 1m' @@ -439,5 +487,4 @@ alias klf1h='kubectl logs --since 1h -f' alias klf1m='kubectl logs --since 1m -f' alias klf1s='kubectl logs --since 1s -f' -alias ktp='kubectl top pod' -alias ktn='kubectl top node' + From ae7c2832ad8c3492be957fa9ed9cf8fb3c4cc640 Mon Sep 17 00:00:00 2001 From: Kyle Schultz <82205484+kylejschultz@users.noreply.github.com> Date: Fri, 17 Nov 2023 09:03:21 -0800 Subject: [PATCH 07/16] Update kubectl-aliases.plugin.zsh Add Destination Rules aliases for get and describe. --- kubectl-aliases.plugin.zsh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/kubectl-aliases.plugin.zsh b/kubectl-aliases.plugin.zsh index 06177d2..a71678a 100644 --- a/kubectl-aliases.plugin.zsh +++ b/kubectl-aliases.plugin.zsh @@ -342,6 +342,9 @@ alias kggn='kubectl get gateways.networking.istio.io --namespace' alias kggnw='kubectl get gateways.networking.istio.io --watch --namespace' alias kgga='kubectl get gateways.networking.istio.io --all-namespaces' alias kggaw='kubectl get gateways.networking.istio.io --all-namespaces --watch' +alias kgdr='kubectl get destinationrules.networking.istio.io' +alias kddr='kubectl describe destinationrules.networking.istio.io' + # # Network Policies, Endpoints, # From 4206964f9055ede98e03c1293250db99019f0696 Mon Sep 17 00:00:00 2001 From: Kyle Schultz <82205484+kylejschultz@users.noreply.github.com> Date: Fri, 17 Nov 2023 09:07:57 -0800 Subject: [PATCH 08/16] Update README.md --- README.md | 280 ++++++++++++++++++++++++++++++++---------------------- 1 file changed, 164 insertions(+), 116 deletions(-) diff --git a/README.md b/README.md index 4fceed4..43a995c 100644 --- a/README.md +++ b/README.md @@ -6,11 +6,17 @@ - Modify the plugins list in the `~/.zshrc` file and add `kubectl-aliases`. This list is space separated. - Reload ZSH using with `source $ZSH/oh-my-zsh.sh` or start a new terminal session. +__Note: Alternatively, if you don't wish to use this as a plugin or do not use ZSH, you can copy the list of aliases below and paste them into your shell config file (`~/.bashrc` or similar)__ + ## Command Reference _(May be out of date - check plugin file for most up to date)_
Expand ``` +alias k=kubectl +# +# Cluster Roles and Cluster Role Bindings +# alias kgcr='kubectl get clusterrole' alias kgcrw='kubectl get clusterrole --watch' alias kecr='kubectl edit clusterrole' @@ -21,6 +27,9 @@ alias kgcrbw='kubectl get clusterrolebinding --watch' alias kecrb='kubectl edit clusterrolebinding' alias kdcrb='kubectl describe clusterrolebinding' alias kdelcrb='kubectl delete clusterrolebinding' +# +# Jobs and Cronjobs +# alias kgcj='kubectl get cronjob' alias kgcjw='kubectl get cronjob --watch' alias kgcjn='kubectl get cronjob --namespace' @@ -45,6 +54,9 @@ alias kdj='kubectl describe job' alias kdjn='kubectl describe job --namespace' alias kdelj='kubectl delete job' alias kdeljn='kubectl delete job --namespace' +# +# Daemon Sets +# alias kgds='kubectl get daemonset' alias kgdsw='kubectl get daemonset --watch' alias kgdsn='kubectl get daemonset --namespace' @@ -57,23 +69,9 @@ alias kdds='kubectl describe daemonset' alias kddsn='kubectl describe daemonset --namespace' alias kdelds='kubectl delete daemonset' alias kdeldsn='kubectl delete daemonset --namespace' -alias kgpdb='kubectl get poddisruptionbudget' -alias kgpdbw='kubectl get poddisruptionbudget --watch' -alias kgpdbn='kubectl get poddisruptionbudget --namespace' -alias kgpdbnw='kubectl get poddisruptionbudget --watch --namespace' -alias kgpdba='kubectl get poddisruptionbudget --all-namespaces' -alias kgpdbaw='kubectl get poddisruptionbudget --all-namespaces --watch' -alias kepdb='kubectl edit poddisruptionbudget' -alias kepdbn='kubectl edit poddisruptionbudget --namespace' -alias kdpdb='kubectl describe poddisruptionbudget' -alias kdpdbn='kubectl describe poddisruptionbudget --namespace' -alias kdelpdb='kubectl delete poddisruptionbudget' -alias kdelpdbn='kubectl delete poddisruptionbudget --namespace' -alias kgpc='kubectl get priorityclass' -alias kgpcw='kubectl get priorityclass --watch' -alias kepc='kubectl edit priorityclass' -alias kdpc='kubectl describe priorityclass' -alias kdelpc='kubectl delete priorityclass' +# +# Roles and Rolebindings +# alias kgr='kubectl get role' alias kgrw='kubectl get role --watch' alias kgrn='kubectl get role --namespace' @@ -98,6 +96,9 @@ alias kdrb='kubectl describe rolebinding' alias kdrbn='kubectl describe rolebinding --namespace' alias kdelrb='kubectl delete rolebinding' alias kdelrbn='kubectl delete rolebinding --namespace' +# +# Pods, Pod Templates, Pod Disruption Budgets, Pod Security Policy +# alias kgp='kubectl get pod' alias kgpw='kubectl get pod --watch' alias kgpn='kubectl get pod --namespace' @@ -110,6 +111,38 @@ alias kdp='kubectl describe pod' alias kdpn='kubectl describe pod --namespace' alias kdelp='kubectl delete pod' alias kdelpn='kubectl delete pod --namespace' +alias kgpt='kubectl get podtemplate' +alias kgptw='kubectl get podtemplate --watch' +alias kgptn='kubectl get podtemplate --namespace' +alias kgptnw='kubectl get podtemplate --watch --namespace' +alias kgpta='kubectl get podtemplate --all-namespaces' +alias kgptaw='kubectl get podtemplate --all-namespaces --watch' +alias kept='kubectl edit podtemplate' +alias keptn='kubectl edit podtemplate --namespace' +alias kdpt='kubectl describe podtemplate' +alias kdptn='kubectl describe podtemplate --namespace' +alias kdelpt='kubectl delete podtemplate' +alias kdelptn='kubectl delete podtemplate --namespace' +alias kgpdb='kubectl get poddisruptionbudget' +alias kgpdbw='kubectl get poddisruptionbudget --watch' +alias kgpdbn='kubectl get poddisruptionbudget --namespace' +alias kgpdbnw='kubectl get poddisruptionbudget --watch --namespace' +alias kgpdba='kubectl get poddisruptionbudget --all-namespaces' +alias kgpdbaw='kubectl get poddisruptionbudget --all-namespaces --watch' +alias kepdb='kubectl edit poddisruptionbudget' +alias kepdbn='kubectl edit poddisruptionbudget --namespace' +alias kdpdb='kubectl describe poddisruptionbudget' +alias kdpdbn='kubectl describe poddisruptionbudget --namespace' +alias kdelpdb='kubectl delete poddisruptionbudget' +alias kdelpdbn='kubectl delete poddisruptionbudget --namespace' +alias kgpsp='kubectl get podsecuritypolicy' +alias kgpspw='kubectl get podsecuritypolicy --watch' +alias kepsp='kubectl edit podsecuritypolicy' +alias kdpsp='kubectl describe podsecuritypolicy' +alias kdelpsp='kubectl delete podsecuritypolicy' +# +# Deployments, Stateful Sets, Replica Sets, HPA +# alias kgd='kubectl get deployment' alias kgdw='kubectl get deployment --watch' alias kgdn='kubectl get deployment --namespace' @@ -134,6 +167,33 @@ alias kdss='kubectl describe statefulset' alias kdssn='kubectl describe statefulset --namespace' alias kdelss='kubectl delete statefulset' alias kdelssn='kubectl delete statefulset --namespace' +alias kgrs='kubectl get replicaset' +alias kgrsw='kubectl get replicaset --watch' +alias kgrsn='kubectl get replicaset --namespace' +alias kgrsnw='kubectl get replicaset --watch --namespace' +alias kgrsa='kubectl get replicaset --all-namespaces' +alias kgrsaw='kubectl get replicaset --all-namespaces --watch' +alias kers='kubectl edit replicaset' +alias kersn='kubectl edit replicaset --namespace' +alias kdrs='kubectl describe replicaset' +alias kdrsn='kubectl describe replicaset --namespace' +alias kdelrs='kubectl delete replicaset' +alias kdelrsn='kubectl delete replicaset --namespace' +alias kghpa='kubectl get horizontalpodautoscaler' +alias kghpaw='kubectl get horizontalpodautoscaler --watch' +alias kghpan='kubectl get horizontalpodautoscaler --namespace' +alias kghpanw='kubectl get horizontalpodautoscaler --watch --namespace' +alias kghpaa='kubectl get horizontalpodautoscaler --all-namespaces' +alias kghpaaw='kubectl get horizontalpodautoscaler --all-namespaces --watch' +alias kehpa='kubectl edit horizontalpodautoscaler' +alias kehpan='kubectl edit horizontalpodautoscaler --namespace' +alias kdhpa='kubectl describe horizontalpodautoscaler' +alias kdhpan='kubectl describe horizontalpodautoscaler --namespace' +alias kdelhpa='kubectl delete horizontalpodautoscaler' +alias kdelhpan='kubectl delete horizontalpodautoscaler --namespace' +# +# Storage +# alias kgpvc='kubectl get persistentvolumeclaim' alias kgpvcw='kubectl get persistentvolumeclaim --watch' alias kgpvcn='kubectl get persistentvolumeclaim --namespace' @@ -151,6 +211,14 @@ alias kgpvw='kubectl get persistentvolume --watch' alias kepv='kubectl edit persistentvolume' alias kdpv='kubectl describe persistentvolume' alias kdelpv='kubectl delete persistentvolume' +alias kgsc='kubectl get storageclass' +alias kgscw='kubectl get storageclass --watch' +alias kesc='kubectl edit storageclass' +alias kdsc='kubectl describe storageclass' +alias kdelsc='kubectl delete storageclass' +# +# Ingress and Services +# alias kgi='kubectl get ingress' alias kgiw='kubectl get ingress --watch' alias kgin='kubectl get ingress --namespace' @@ -175,11 +243,9 @@ alias kdsvc='kubectl describe service' alias kdsvcn='kubectl describe service --namespace' alias kdelsvc='kubectl delete service' alias kdelsvcn='kubectl delete service --namespace' -alias kgsc='kubectl get storageclass' -alias kgscw='kubectl get storageclass --watch' -alias kesc='kubectl edit storageclass' -alias kdsc='kubectl describe storageclass' -alias kdelsc='kubectl delete storageclass' +# +# Secrets and Config Maps +# alias kgsec='kubectl get secret' alias kgsecw='kubectl get secret --watch' alias kgsecn='kubectl get secret --namespace' @@ -204,6 +270,9 @@ alias kdcm='kubectl describe configmap' alias kdcmn='kubectl describe configmap --namespace' alias kdelcm='kubectl delete configmap' alias kdelcmn='kubectl delete configmap --namespace' +# +# Service Accounts +# alias kgsa='kubectl get serviceaccount' alias kgsaw='kubectl get serviceaccount --watch' alias kgsan='kubectl get serviceaccount --namespace' @@ -216,6 +285,9 @@ alias kdsa='kubectl describe serviceaccount' alias kdsan='kubectl describe serviceaccount --namespace' alias kdelsa='kubectl delete serviceaccount' alias kdelsan='kubectl delete serviceaccount --namespace' +# +# Nodes, Events, Namespaces +# alias kgno='kubectl get node' alias kgnow='kubectl get node --watch' alias keno='kubectl edit node' @@ -223,57 +295,38 @@ alias kdno='kubectl describe node' alias kdelno='kubectl delete node' alias kgev='kubectl get event' alias kgevw='kubectl get event --watch' +alias kgns='kubectl get namespace' +alias kgnsw='kubectl get namespace --watch' +alias kens='kubectl edit namespace' +alias kdns='kubectl describe namespace' +alias kdelns='kubectl delete namespace' +# +# Certificates and Security +# alias kgcsr='kubectl get certificatesigningrequest' alias kgcsrw='kubectl get certificatesigningrequest --watch' alias kecsr='kubectl edit certificatesigningrequest' alias kdcsr='kubectl describe certificatesigningrequest' alias kdelcsr='kubectl delete certificatesigningrequest' -alias kghpa='kubectl get horizontalpodautoscaler' -alias kghpaw='kubectl get horizontalpodautoscaler --watch' -alias kghpan='kubectl get horizontalpodautoscaler --namespace' -alias kghpanw='kubectl get horizontalpodautoscaler --watch --namespace' -alias kghpaa='kubectl get horizontalpodautoscaler --all-namespaces' -alias kghpaaw='kubectl get horizontalpodautoscaler --all-namespaces --watch' -alias kehpa='kubectl edit horizontalpodautoscaler' -alias kehpan='kubectl edit horizontalpodautoscaler --namespace' -alias kdhpa='kubectl describe horizontalpodautoscaler' -alias kdhpan='kubectl describe horizontalpodautoscaler --namespace' -alias kdelhpa='kubectl delete horizontalpodautoscaler' -alias kdelhpan='kubectl delete horizontalpodautoscaler --namespace' -alias kgpsp='kubectl get podsecuritypolicy' -alias kgpspw='kubectl get podsecuritypolicy --watch' -alias kepsp='kubectl edit podsecuritypolicy' -alias kdpsp='kubectl describe podsecuritypolicy' -alias kdelpsp='kubectl delete podsecuritypolicy' -alias kgpt='kubectl get podtemplate' -alias kgptw='kubectl get podtemplate --watch' -alias kgptn='kubectl get podtemplate --namespace' -alias kgptnw='kubectl get podtemplate --watch --namespace' -alias kgpta='kubectl get podtemplate --all-namespaces' -alias kgptaw='kubectl get podtemplate --all-namespaces --watch' -alias kept='kubectl edit podtemplate' -alias keptn='kubectl edit podtemplate --namespace' -alias kdpt='kubectl describe podtemplate' -alias kdptn='kubectl describe podtemplate --namespace' -alias kdelpt='kubectl delete podtemplate' -alias kdelptn='kubectl delete podtemplate --namespace' -alias kgcs='kubectl get componentstatus' -alias kgcsw='kubectl get componentstatus --watch' -alias kecs='kubectl edit componentstatus' -alias kdcs='kubectl describe componentstatus' -alias kdelcs='kubectl delete componentstatus' -alias kgrs='kubectl get replicaset' -alias kgrsw='kubectl get replicaset --watch' -alias kgrsn='kubectl get replicaset --namespace' -alias kgrsnw='kubectl get replicaset --watch --namespace' -alias kgrsa='kubectl get replicaset --all-namespaces' -alias kgrsaw='kubectl get replicaset --all-namespaces --watch' -alias kers='kubectl edit replicaset' -alias kersn='kubectl edit replicaset --namespace' -alias kdrs='kubectl describe replicaset' -alias kdrsn='kubectl describe replicaset --namespace' -alias kdelrs='kubectl delete replicaset' -alias kdelrsn='kubectl delete replicaset --namespace' +# +# Istio Virtual Servicxes, Gateways, and Destination Rules +# +alias kgvs='kubectl get virtualservices.networking.istio.io' +alias kgvsw='kubectl get virtualservices.networking.istio.io --watch' +alias kgvsn='kubectl get virtualservices.networking.istio.io --namespace' +alias kgvsnw='kubectl get virtualservices.networking.istio.io --watch --namespace' +alias kgvsa='kubectl get virtualservices.networking.istio.io --all-namespaces' +alias kgvsaw='kubectl get virtualservices.networking.istio.io --all-namespaces --watch' +alias kdvs='kubectl describe virtualservices.networking.istio.io' +alias kgg='kubectl get gateways.networking.istio.io' +alias kggw='kubectl get gateways.networking.istio.io --watch' +alias kggn='kubectl get gateways.networking.istio.io --namespace' +alias kggnw='kubectl get gateways.networking.istio.io --watch --namespace' +alias kgga='kubectl get gateways.networking.istio.io --all-namespaces' +alias kggaw='kubectl get gateways.networking.istio.io --all-namespaces --watch' +# +# Network Policies, Endpoints, +# alias kgep='kubectl get endpoints' alias kgepw='kubectl get endpoints --watch' alias kgepn='kubectl get endpoints --namespace' @@ -286,11 +339,25 @@ alias kdep='kubectl describe endpoints' alias kdepn='kubectl describe endpoints --namespace' alias kdelep='kubectl delete endpoints' alias kdelepn='kubectl delete endpoints --namespace' -alias kgns='kubectl get namespace' -alias kgnsw='kubectl get namespace --watch' -alias kens='kubectl edit namespace' -alias kdns='kubectl describe namespace' -alias kdelns='kubectl delete namespace' +alias kgnp='kubectl get networkpolicy' +alias kgnpw='kubectl get networkpolicy --watch' +alias kgnpn='kubectl get networkpolicy --namespace' +alias kgnpnw='kubectl get networkpolicy --watch --namespace' +alias kgnpa='kubectl get networkpolicy --all-namespaces' +alias kgnpaw='kubectl get networkpolicy --all-namespaces --watch' +alias kenp='kubectl edit networkpolicy' +alias kenpn='kubectl edit networkpolicy --namespace' +alias kdnp='kubectl describe networkpolicy' +alias kdnpn='kubectl describe networkpolicy --namespace' +alias kdelnp='kubectl delete networkpolicy' +alias kdelnpn='kubectl delete networkpolicy --namespace' + + +alias kgcs='kubectl get componentstatus' +alias kgcsw='kubectl get componentstatus --watch' +alias kecs='kubectl edit componentstatus' +alias kdcs='kubectl describe componentstatus' +alias kdelcs='kubectl delete componentstatus' alias kgrc='kubectl get replicationcontroller' alias kgrcw='kubectl get replicationcontroller --watch' alias kgrcn='kubectl get replicationcontroller --namespace' @@ -315,18 +382,9 @@ alias kdcrev='kubectl describe controllerrevision' alias kdcrevn='kubectl describe controllerrevision --namespace' alias kdelcrev='kubectl delete controllerrevision' alias kdelcrevn='kubectl delete controllerrevision --namespace' -alias kgnp='kubectl get networkpolicy' -alias kgnpw='kubectl get networkpolicy --watch' -alias kgnpn='kubectl get networkpolicy --namespace' -alias kgnpnw='kubectl get networkpolicy --watch --namespace' -alias kgnpa='kubectl get networkpolicy --all-namespaces' -alias kgnpaw='kubectl get networkpolicy --all-namespaces --watch' -alias kenp='kubectl edit networkpolicy' -alias kenpn='kubectl edit networkpolicy --namespace' -alias kdnp='kubectl describe networkpolicy' -alias kdnpn='kubectl describe networkpolicy --namespace' -alias kdelnp='kubectl delete networkpolicy' -alias kdelnpn='kubectl delete networkpolicy --namespace' +# +# Resource Management +# alias kgli='kubectl get limitrange' alias kgliw='kubectl get limitrange --watch' alias kglin='kubectl get limitrange --namespace' @@ -351,39 +409,27 @@ alias kdqu='kubectl describe resourcequota' alias kdqun='kubectl describe resourcequota --namespace' alias kdelqu='kubectl delete resourcequota' alias kdelqun='kubectl delete resourcequota --namespace' -alias kgmwh='kubectl get mutatingwebhookconfigurations' -alias kgmwhw='kubectl get mutatingwebhookconfigurations --watch' -alias kemwh='kubectl edit mutatingwebhookconfigurations' -alias kdmwh='kubectl describe mutatingwebhookconfigurations' -alias kdelmwh='kubectl delete mutatingwebhookconfigurations' -alias kgvwh='kubectl get validatingwebhookconfigurations' -alias kgvwhw='kubectl get validatingwebhookconfigurations --watch' -alias kevwh='kubectl edit validatingwebhookconfigurations' -alias kdvwh='kubectl describe validatingwebhookconfigurations' -alias kdelvwh='kubectl delete validatingwebhookconfigurations' +alias ktp='kubectl top pod' +alias ktn='kubectl top node' +# +# APIs and CRDs +# alias kgapi='kubectl get apiservices.apiregistration.k8s.io' alias kgapiw='kubectl get apiservices.apiregistration.k8s.io --watch' alias kgcrd='kubectl get customresourcedefinitions.apiextensions.k8s.io' alias kgcrdw='kubectl get customresourcedefinitions.apiextensions.k8s.io --watch' -alias kgvs='kubectl get virtualservices.networking.istio.io' -alias kgvsw='kubectl get virtualservices.networking.istio.io --watch' -alias kgvsn='kubectl get virtualservices.networking.istio.io --namespace' -alias kgvsnw='kubectl get virtualservices.networking.istio.io --watch --namespace' -alias kgvsa='kubectl get virtualservices.networking.istio.io --all-namespaces' -alias kgvsaw='kubectl get virtualservices.networking.istio.io --all-namespaces --watch' -alias kgg='kubectl get gateways.networking.istio.io' -alias kggw='kubectl get gateways.networking.istio.io --watch' -alias kggn='kubectl get gateways.networking.istio.io --namespace' -alias kggnw='kubectl get gateways.networking.istio.io --watch --namespace' -alias kgga='kubectl get gateways.networking.istio.io --all-namespaces' -alias kggaw='kubectl get gateways.networking.istio.io --all-namespaces --watch' +# +# Canaries +# alias kgcan='kubectl get canaries.flagger.app' alias kgcanw='kubectl get canaries.flagger.app --watch' alias kgcann='kubectl get canaries.flagger.app --namespace' alias kgcannw='kubectl get canaries.flagger.app --watch --namespace' alias kgcana='kubectl get canaries.flagger.app --all-namespaces' alias kgcanaw='kubectl get canaries.flagger.app --all-namespaces --watch' - +# +# Contexts and open-ended commands (used for items not included above) +# alias kcuc='kubectl config use-context' alias kcsc='kubectl config set-context' alias kcdc='kubectl config delete-context' @@ -395,19 +441,25 @@ alias kdel='kubectl delete' alias kdelf='kubectl delete -f' alias kgpl='kgp -l' alias kcn='kubectl config set-context $(kubectl config current-context) --namespace' - +# +# Misc kubectl commands +# alias kpf="kubectl port-forward" alias kcp='kubectl cp' alias kaf='safe_kubectlapply' alias keit='kubectl exec -it' - +# +# Rollout Restarts +# alias krh='kubectl rollout history' alias kru='kubectl rollout undo' alias krsss='kubectl rollout status statefulset' - +alias krrsts='kubectl rollout restart sts' alias kga='kubectl get all' alias kgaa='kubectl get all --all-namespaces' - +# +# Logs +# alias kl='kubectl logs' alias kl1h='kubectl logs --since 1h' alias kl1m='kubectl logs --since 1m' @@ -416,9 +468,5 @@ alias klf='kubectl logs -f' alias klf1h='kubectl logs --since 1h -f' alias klf1m='kubectl logs --since 1m -f' alias klf1s='kubectl logs --since 1s -f' - -alias ktp='kubectl top pod' -alias ktn='kubectl top node' - ```
From 99eab45c961174a169852bedc202c95bed986045 Mon Sep 17 00:00:00 2001 From: Kyle Schultz <82205484+kylejschultz@users.noreply.github.com> Date: Wed, 29 Nov 2023 11:10:58 -0800 Subject: [PATCH 09/16] Add Confluent for Kubernetes aliases Add aliases for CFK commands that I use regularly. Not an all inclusive list. --- kubectl-aliases.plugin.zsh | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/kubectl-aliases.plugin.zsh b/kubectl-aliases.plugin.zsh index a71678a..6a5228b 100644 --- a/kubectl-aliases.plugin.zsh +++ b/kubectl-aliases.plugin.zsh @@ -489,5 +489,26 @@ alias klf='kubectl logs -f' alias klf1h='kubectl logs --since 1h -f' alias klf1m='kubectl logs --since 1m -f' alias klf1s='kubectl logs --since 1s -f' - - +# +# Confluent for Kubernetes (CFK) Objects +# +alias kgcl='kubectl get clusterlink.platform.confluent.io' +alias kdcl='kubectl describe clusterlink.platform.confluent.io' +alias kgkt='kubectl get kafkatopics.platform.confluent.io' +alias kdkt='kubectl describe kafkatopics.platform.confluent.io' +alias kgkrc='kubectl get kafkarestclass.platform.confluent.io' +alias kdkrc='kubectl describe kafkarestclass.platform.confluent.io' +alias kgks='kubectl get schema.platform.confluent.io' +alias kdks='kubectl describe schema.platform.confluent.io' +alias kgcfrb='kubectl get confluentrolebinding.platform.confluent.io' +alias kdcfrb='kubectl describe confluentrolebinding.platform.confluent.io' +alias kgkaf='kubectl get kafka.platform.confluent.io' +alias kdkaf='kubectl describe kafka.platform.confluent.io' +alias kgsr='kubectl get schemaregistry.platform.confluent.io' +alias kdsr='kubectl describe schemaregistry.platform.confluent.io' +alias kgcon='kubectl get connect.platform.confluent.io' +alias kdcon='kubectl describe connect.platform.confluent.io' +alias kgksql='kubectl get ksqldb.platform.confluent.io' +alias kdksql='kubectl describe ksqldb.platform.confluent.io' +alias kgzoo='kubectl get zookeeper.platform.confluent.io' +alias kdzoo='kubectl describe zookeeper.platform.confluent.io' From 067f9922839df30a94004a19d275e7041a35c54e Mon Sep 17 00:00:00 2001 From: Kyle Schultz <82205484+kylejschultz@users.noreply.github.com> Date: Wed, 29 Nov 2023 11:11:24 -0800 Subject: [PATCH 10/16] Update README.md --- README.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/README.md b/README.md index 43a995c..6c8bcc6 100644 --- a/README.md +++ b/README.md @@ -468,5 +468,28 @@ alias klf='kubectl logs -f' alias klf1h='kubectl logs --since 1h -f' alias klf1m='kubectl logs --since 1m -f' alias klf1s='kubectl logs --since 1s -f' +# +# Confluent for Kubernetes (CFK) Objects +# +alias kgcl='kubectl get clusterlink.platform.confluent.io' +alias kdcl='kubectl describe clusterlink.platform.confluent.io' +alias kgkt='kubectl get kafkatopics.platform.confluent.io' +alias kdkt='kubectl describe kafkatopics.platform.confluent.io' +alias kgkrc='kubectl get kafkarestclass.platform.confluent.io' +alias kdkrc='kubectl describe kafkarestclass.platform.confluent.io' +alias kgks='kubectl get schema.platform.confluent.io' +alias kdks='kubectl describe schema.platform.confluent.io' +alias kgcfrb='kubectl get confluentrolebinding.platform.confluent.io' +alias kdcfrb='kubectl describe confluentrolebinding.platform.confluent.io' +alias kgkaf='kubectl get kafka.platform.confluent.io' +alias kdkaf='kubectl describe kafka.platform.confluent.io' +alias kgsr='kubectl get schemaregistry.platform.confluent.io' +alias kdsr='kubectl describe schemaregistry.platform.confluent.io' +alias kgcon='kubectl get connect.platform.confluent.io' +alias kdcon='kubectl describe connect.platform.confluent.io' +alias kgksql='kubectl get ksqldb.platform.confluent.io' +alias kdksql='kubectl describe ksqldb.platform.confluent.io' +alias kgzoo='kubectl get zookeeper.platform.confluent.io' +alias kdzoo='kubectl describe zookeeper.platform.confluent.io' ```
From 760964afdeb4c5e622e5664474b8740645c9ef47 Mon Sep 17 00:00:00 2001 From: Kyle Schultz <82205484+kylejschultz@users.noreply.github.com> Date: Wed, 29 Nov 2023 11:13:13 -0800 Subject: [PATCH 11/16] Add kafka edit command Add kafka edit command - used to clear metadata when rolling restart gets stuck, so is needed somewhat often. --- kubectl-aliases.plugin.zsh | 1 + 1 file changed, 1 insertion(+) diff --git a/kubectl-aliases.plugin.zsh b/kubectl-aliases.plugin.zsh index 6a5228b..48ef9eb 100644 --- a/kubectl-aliases.plugin.zsh +++ b/kubectl-aliases.plugin.zsh @@ -504,6 +504,7 @@ alias kgcfrb='kubectl get confluentrolebinding.platform.confluent.io' alias kdcfrb='kubectl describe confluentrolebinding.platform.confluent.io' alias kgkaf='kubectl get kafka.platform.confluent.io' alias kdkaf='kubectl describe kafka.platform.confluent.io' +alias kekaf='kubectl edit kafka.platform.confluent.io' alias kgsr='kubectl get schemaregistry.platform.confluent.io' alias kdsr='kubectl describe schemaregistry.platform.confluent.io' alias kgcon='kubectl get connect.platform.confluent.io' From ba3efe3bdbc88905123be048c4fed8dbe1869f60 Mon Sep 17 00:00:00 2001 From: Kyle Schultz <82205484+kylejschultz@users.noreply.github.com> Date: Wed, 29 Nov 2023 11:13:36 -0800 Subject: [PATCH 12/16] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 6c8bcc6..345c128 100644 --- a/README.md +++ b/README.md @@ -483,6 +483,7 @@ alias kgcfrb='kubectl get confluentrolebinding.platform.confluent.io' alias kdcfrb='kubectl describe confluentrolebinding.platform.confluent.io' alias kgkaf='kubectl get kafka.platform.confluent.io' alias kdkaf='kubectl describe kafka.platform.confluent.io' +alias kekaf='kubectl edit kafka.platform.confluent.io' alias kgsr='kubectl get schemaregistry.platform.confluent.io' alias kdsr='kubectl describe schemaregistry.platform.confluent.io' alias kgcon='kubectl get connect.platform.confluent.io' From dd905d653cd0a4e2711affddf568c6da7a1064b0 Mon Sep 17 00:00:00 2001 From: Kyle Schultz Date: Thu, 29 May 2025 20:19:50 -0700 Subject: [PATCH 13/16] fix pathing issue. update readme to add additional commands present in code. update install instructions in readme --- README.md | 21 +++++++++++++++------ kubectl-aliases.plugin.zsh | 5 ++++- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 345c128..89f38f6 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,20 @@ # Conflict-Free Kubectl aliases - forked from alaa/kubectl-aliases ## How To Install -- Clone repo to whatever local directory you prefer. -- Create a symlink from the local dir to the ZSH_CUSTOM path by using `ln -s "$(pwd)/kubectl-aliases" $ZSH_CUSTOM/plugins` -- Modify the plugins list in the `~/.zshrc` file and add `kubectl-aliases`. This list is space separated. -- Reload ZSH using with `source $ZSH/oh-my-zsh.sh` or start a new terminal session. +- Clone this repo to a local directory: + ```sh + git clone https://github.com/kylejschultz/kubectl-aliases.git ~/.kubectl-aliases-zsh + ``` +- Source the plugin in your `.zshrc`: + ```sh + source ~/.kubectl-aliases-zsh/kubectl-aliases.plugin.zsh + ``` +- Reload ZSH with: + ```sh + source ~/.zshrc + ``` -__Note: Alternatively, if you don't wish to use this as a plugin or do not use ZSH, you can copy the list of aliases below and paste them into your shell config file (`~/.bashrc` or similar)__ +__Note:__ If you don't use ZSH, you can still copy the alias definitions and paste them into your shell config file (`~/.bashrc`, `~/.config/fish/config.fish`, etc.) ## Command Reference _(May be out of date - check plugin file for most up to date)_
@@ -324,6 +332,8 @@ alias kggn='kubectl get gateways.networking.istio.io --namespace' alias kggnw='kubectl get gateways.networking.istio.io --watch --namespace' alias kgga='kubectl get gateways.networking.istio.io --all-namespaces' alias kggaw='kubectl get gateways.networking.istio.io --all-namespaces --watch' +alias kgdr='kubectl get destinationrules.networking.istio.io' +alias kddr='kubectl describe destinationrules.networking.istio.io' # # Network Policies, Endpoints, # @@ -352,7 +362,6 @@ alias kdnpn='kubectl describe networkpolicy --namespace' alias kdelnp='kubectl delete networkpolicy' alias kdelnpn='kubectl delete networkpolicy --namespace' - alias kgcs='kubectl get componentstatus' alias kgcsw='kubectl get componentstatus --watch' alias kecs='kubectl edit componentstatus' diff --git a/kubectl-aliases.plugin.zsh b/kubectl-aliases.plugin.zsh index 48ef9eb..7018f02 100644 --- a/kubectl-aliases.plugin.zsh +++ b/kubectl-aliases.plugin.zsh @@ -1,3 +1,6 @@ +# Ensure cache directory exists before any logic runs +mkdir -p "${ZSH_CACHE_DIR:-$HOME/.zsh_cache}" + # Confirm command to be executed confirm() { echo -n "\e[33mDo you want to run $*? [N/yes] \e[m" @@ -20,7 +23,7 @@ safe_kubectlapply() { } if (( $+commands[kubectl] )); then - __KUBECTL_COMPLETION_FILE="${ZSH_CACHE_DIR}/kubectl_completion" + __KUBECTL_COMPLETION_FILE="${ZSH_CACHE_DIR:-$HOME/.zsh_cache}/kubectl_completion" if [[ ! -f $__KUBECTL_COMPLETION_FILE ]]; then kubectl completion zsh >! $__KUBECTL_COMPLETION_FILE From 5184398d15164981cb671d41845e7d241af83243 Mon Sep 17 00:00:00 2001 From: Kyle Schultz Date: Thu, 29 May 2025 20:33:35 -0700 Subject: [PATCH 14/16] fix whitespace --- README.md | 4 ++-- kubectl-aliases.plugin.zsh | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 89f38f6..c8f898f 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ __Note:__ If you don't use ZSH, you can still copy the alias definitions and pas ## Command Reference _(May be out of date - check plugin file for most up to date)_
Expand - + ``` alias k=kubectl # @@ -106,7 +106,7 @@ alias kdelrb='kubectl delete rolebinding' alias kdelrbn='kubectl delete rolebinding --namespace' # # Pods, Pod Templates, Pod Disruption Budgets, Pod Security Policy -# +# alias kgp='kubectl get pod' alias kgpw='kubectl get pod --watch' alias kgpn='kubectl get pod --namespace' diff --git a/kubectl-aliases.plugin.zsh b/kubectl-aliases.plugin.zsh index 7018f02..afadd61 100644 --- a/kubectl-aliases.plugin.zsh +++ b/kubectl-aliases.plugin.zsh @@ -119,7 +119,7 @@ alias kdelrb='kubectl delete rolebinding' alias kdelrbn='kubectl delete rolebinding --namespace' # # Pods, Pod Templates, Pod Disruption Budgets, Pod Security Policy -# +# alias kgp='kubectl get pod' alias kgpw='kubectl get pod --watch' alias kgpn='kubectl get pod --namespace' From 3d6dd424e0ff5debe8e1bd0de5376fc7bf6aa891 Mon Sep 17 00:00:00 2001 From: Kyle Schultz Date: Thu, 29 May 2025 20:36:26 -0700 Subject: [PATCH 15/16] update install instructions --- README.md | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/README.md b/README.md index c8f898f..1d6df7f 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,7 @@ # Conflict-Free Kubectl aliases - forked from alaa/kubectl-aliases ## How To Install -- Clone this repo to a local directory: - ```sh - git clone https://github.com/kylejschultz/kubectl-aliases.git ~/.kubectl-aliases-zsh - ``` -- Source the plugin in your `.zshrc`: +- Clone this repo to a local directory and source the plugin in your `.zshrc`: ```sh source ~/.kubectl-aliases-zsh/kubectl-aliases.plugin.zsh ``` From 264c9f688fe9630e74ab4e6ff1bc2bfaee1fccac Mon Sep 17 00:00:00 2001 From: Kyle Schultz Date: Sat, 19 Jul 2025 14:26:08 -0700 Subject: [PATCH 16/16] add flux shortcuts and modify confluent/kafka ones --- kubectl-aliases.plugin.zsh | 161 ++++++++++++++++++++++++++++++++----- 1 file changed, 140 insertions(+), 21 deletions(-) diff --git a/kubectl-aliases.plugin.zsh b/kubectl-aliases.plugin.zsh index afadd61..003b7a9 100644 --- a/kubectl-aliases.plugin.zsh +++ b/kubectl-aliases.plugin.zsh @@ -495,24 +495,143 @@ alias klf1s='kubectl logs --since 1s -f' # # Confluent for Kubernetes (CFK) Objects # -alias kgcl='kubectl get clusterlink.platform.confluent.io' -alias kdcl='kubectl describe clusterlink.platform.confluent.io' -alias kgkt='kubectl get kafkatopics.platform.confluent.io' -alias kdkt='kubectl describe kafkatopics.platform.confluent.io' -alias kgkrc='kubectl get kafkarestclass.platform.confluent.io' -alias kdkrc='kubectl describe kafkarestclass.platform.confluent.io' -alias kgks='kubectl get schema.platform.confluent.io' -alias kdks='kubectl describe schema.platform.confluent.io' -alias kgcfrb='kubectl get confluentrolebinding.platform.confluent.io' -alias kdcfrb='kubectl describe confluentrolebinding.platform.confluent.io' -alias kgkaf='kubectl get kafka.platform.confluent.io' -alias kdkaf='kubectl describe kafka.platform.confluent.io' -alias kekaf='kubectl edit kafka.platform.confluent.io' -alias kgsr='kubectl get schemaregistry.platform.confluent.io' -alias kdsr='kubectl describe schemaregistry.platform.confluent.io' -alias kgcon='kubectl get connect.platform.confluent.io' -alias kdcon='kubectl describe connect.platform.confluent.io' -alias kgksql='kubectl get ksqldb.platform.confluent.io' -alias kdksql='kubectl describe ksqldb.platform.confluent.io' -alias kgzoo='kubectl get zookeeper.platform.confluent.io' -alias kdzoo='kubectl describe zookeeper.platform.confluent.io' +# Confluent ClusterLinks +alias kccl='kubectl get clusterlink.platform.confluent.io' +alias kdccl='kubectl describe clusterlink.platform.confluent.io' +# Confluent KafkaTopics +alias kckt='kubectl get kafkatopics.platform.confluent.io' +alias kdckt='kubectl describe kafkatopics.platform.confluent.io' +# Confluent KafkaRestClass +alias kckrc='kubectl get kafkarestclass.platform.confluent.io' +alias kdckrc='kubectl describe kafkarestclass.platform.confluent.io' +# Confluent Schemas +alias kcsch='kubectl get schema.platform.confluent.io' +alias kdcsch='kubectl describe schema.platform.confluent.io' +# Confluent RoleBindings +alias kcrb='kubectl get confluentrolebinding.platform.confluent.io' +alias kdcrb='kubectl describe confluentrolebinding.platform.confluent.io' +# Confluent Kafka +alias kckaf='kubectl get kafka.platform.confluent.io' +alias kdckaf='kubectl describe kafka.platform.confluent.io' +alias keckaf='kubectl edit kafka.platform.confluent.io' +# Confluent SchemaRegistry +alias kcsr='kubectl get schemaregistry.platform.confluent.io' +alias kdcsr='kubectl describe schemaregistry.platform.confluent.io' +# Confluent Connect +alias kccon='kubectl get connect.platform.confluent.io' +alias kdccon='kubectl describe connect.platform.confluent.io' +# Confluent KSQLDB +alias kcksql='kubectl get ksqldb.platform.confluent.io' +alias kdcksql='kubectl describe ksqldb.platform.confluent.io' +# Confluent Zookeeper +alias kczoo='kubectl get zookeeper.platform.confluent.io' +alias kdczoo='kubectl describe zookeeper.platform.confluent.io' +# +# Flux GitOps +# +# Flux GitRepositories +alias kfgr='kubectl get gitrepository.source.toolkit.fluxcd.io' +alias kfgrw='kubectl get gitrepository.source.toolkit.fluxcd.io --watch' +alias kfgrn='kubectl get gitrepository.source.toolkit.fluxcd.io --namespace' +alias kfgrnw='kubectl get gitrepository.source.toolkit.fluxcd.io --watch --namespace' +alias kfgra='kubectl get gitrepository.source.toolkit.fluxcd.io --all-namespaces' +alias kfgraw='kubectl get gitrepository.source.toolkit.fluxcd.io --all-namespaces --watch' +alias kefgr='kubectl edit gitrepository.source.toolkit.fluxcd.io' +alias kefgrn='kubectl edit gitrepository.source.toolkit.fluxcd.io --namespace' +alias kdfgr='kubectl describe gitrepository.source.toolkit.fluxcd.io' +alias kdfgrn='kubectl describe gitrepository.source.toolkit.fluxcd.io --namespace' +alias kdelfgr='kubectl delete gitrepository.source.toolkit.fluxcd.io' +alias kdelfgrn='kubectl delete gitrepository.source.toolkit.fluxcd.io --namespace' +# Flux HelmRepositories +alias kfhr='kubectl get helmrepository.source.toolkit.fluxcd.io' +alias kfhrw='kubectl get helmrepository.source.toolkit.fluxcd.io --watch' +alias kfhrn='kubectl get helmrepository.source.toolkit.fluxcd.io --namespace' +alias kfhrnw='kubectl get helmrepository.source.toolkit.fluxcd.io --watch --namespace' +alias kfhra='kubectl get helmrepository.source.toolkit.fluxcd.io --all-namespaces' +alias kfhraw='kubectl get helmrepository.source.toolkit.fluxcd.io --all-namespaces --watch' +alias kefhr='kubectl edit helmrepository.source.toolkit.fluxcd.io' +alias kefhrn='kubectl edit helmrepository.source.toolkit.fluxcd.io --namespace' +alias kdfhr='kubectl describe helmrepository.source.toolkit.fluxcd.io' +alias kdfhrn='kubectl describe helmrepository.source.toolkit.fluxcd.io --namespace' +alias kdelfhr='kubectl delete helmrepository.source.toolkit.fluxcd.io' +alias kdelfhrn='kubectl delete helmrepository.source.toolkit.fluxcd.io --namespace' +# Flux HelmCharts +alias kfhc='kubectl get helmchart.source.toolkit.fluxcd.io' +alias kfhcw='kubectl get helmchart.source.toolkit.fluxcd.io --watch' +alias kfhcn='kubectl get helmchart.source.toolkit.fluxcd.io --namespace' +alias kfhcnw='kubectl get helmchart.source.toolkit.fluxcd.io --watch --namespace' +alias kfhca='kubectl get helmchart.source.toolkit.fluxcd.io --all-namespaces' +alias kfhcaw='kubectl get helmchart.source.toolkit.fluxcd.io --all-namespaces --watch' +alias kefhc='kubectl edit helmchart.source.toolkit.fluxcd.io' +alias kefhcn='kubectl edit helmchart.source.toolkit.fluxcd.io --namespace' +alias kdfhc='kubectl describe helmchart.source.toolkit.fluxcd.io' +alias kdfhcn='kubectl describe helmchart.source.toolkit.fluxcd.io --namespace' +alias kdelfhc='kubectl delete helmchart.source.toolkit.fluxcd.io' +alias kdelfhcn='kubectl delete helmchart.source.toolkit.fluxcd.io --namespace' +# Flux Kustomizations +alias kfk='kubectl get kustomization.kustomize.toolkit.fluxcd.io' +alias kfkw='kubectl get kustomization.kustomize.toolkit.fluxcd.io --watch' +alias kfkn='kubectl get kustomization.kustomize.toolkit.fluxcd.io --namespace' +alias kfknw='kubectl get kustomization.kustomize.toolkit.fluxcd.io --watch --namespace' +alias kfka='kubectl get kustomization.kustomize.toolkit.fluxcd.io --all-namespaces' +alias kfkaw='kubectl get kustomization.kustomize.toolkit.fluxcd.io --all-namespaces --watch' +alias kefk='kubectl edit kustomization.kustomize.toolkit.fluxcd.io' +alias kefkn='kubectl edit kustomization.kustomize.toolkit.fluxcd.io --namespace' +alias kdfk='kubectl describe kustomization.kustomize.toolkit.fluxcd.io' +alias kdfkn='kubectl describe kustomization.kustomize.toolkit.fluxcd.io --namespace' +alias kdelfk='kubectl delete kustomization.kustomize.toolkit.fluxcd.io' +alias kdelfkn='kubectl delete kustomization.kustomize.toolkit.fluxcd.io --namespace' +# Flux HelmReleases +alias kfhrl='kubectl get helmrelease.helm.toolkit.fluxcd.io' +alias kfhrlw='kubectl get helmrelease.helm.toolkit.fluxcd.io --watch' +alias kfhrln='kubectl get helmrelease.helm.toolkit.fluxcd.io --namespace' +alias kfhrlnw='kubectl get helmrelease.helm.toolkit.fluxcd.io --watch --namespace' +alias kfhrla='kubectl get helmrelease.helm.toolkit.fluxcd.io --all-namespaces' +alias kfhrlaw='kubectl get helmrelease.helm.toolkit.fluxcd.io --all-namespaces --watch' +alias kefhrl='kubectl edit helmrelease.helm.toolkit.fluxcd.io' +alias kefhrln='kubectl edit helmrelease.helm.toolkit.fluxcd.io --namespace' +alias kdfhrl='kubectl describe helmrelease.helm.toolkit.fluxcd.io' +alias kdfhrln='kubectl describe helmrelease.helm.toolkit.fluxcd.io --namespace' +alias kdelfhrl='kubectl delete helmrelease.helm.toolkit.fluxcd.io' +alias kdelfhrln='kubectl delete helmrelease.helm.toolkit.fluxcd.io --namespace' +# Flux Alerts +alias kfal='kubectl get alert.notification.toolkit.fluxcd.io' +alias kfalw='kubectl get alert.notification.toolkit.fluxcd.io --watch' +alias kfaln='kubectl get alert.notification.toolkit.fluxcd.io --namespace' +alias kfalnw='kubectl get alert.notification.toolkit.fluxcd.io --watch --namespace' +alias kfala='kubectl get alert.notification.toolkit.fluxcd.io --all-namespaces' +alias kfalaw='kubectl get alert.notification.toolkit.fluxcd.io --all-namespaces --watch' +alias kefal='kubectl edit alert.notification.toolkit.fluxcd.io' +alias kefaln='kubectl edit alert.notification.toolkit.fluxcd.io --namespace' +alias kdfal='kubectl describe alert.notification.toolkit.fluxcd.io' +alias kdfaln='kubectl describe alert.notification.toolkit.fluxcd.io --namespace' +alias kdelfal='kubectl delete alert.notification.toolkit.fluxcd.io' +alias kdelfaln='kubectl delete alert.notification.toolkit.fluxcd.io --namespace' +# Flux Providers +alias kfpr='kubectl get provider.notification.toolkit.fluxcd.io' +alias kfprw='kubectl get provider.notification.toolkit.fluxcd.io --watch' +alias kfprn='kubectl get provider.notification.toolkit.fluxcd.io --namespace' +alias kfprnw='kubectl get provider.notification.toolkit.fluxcd.io --watch --namespace' +alias kfpra='kubectl get provider.notification.toolkit.fluxcd.io --all-namespaces' +alias kfpraw='kubectl get provider.notification.toolkit.fluxcd.io --all-namespaces --watch' +alias kefpr='kubectl edit provider.notification.toolkit.fluxcd.io' +alias kefprn='kubectl edit provider.notification.toolkit.fluxcd.io --namespace' +alias kdfpr='kubectl describe provider.notification.toolkit.fluxcd.io' +alias kdfprn='kubectl describe provider.notification.toolkit.fluxcd.io --namespace' +alias kdelfpr='kubectl delete provider.notification.toolkit.fluxcd.io' +alias kdelfprn='kubectl delete provider.notification.toolkit.fluxcd.io --namespace' +# Flux Reconciliation shortcuts +alias kfrc='kubectl annotate --overwrite gitrepository.source.toolkit.fluxcd.io flux-system reconcile.fluxcd.io/requestedAt="$(date +%Y-%m-%dT%H:%M:%S%z)" -n flux-system' +alias kfrck='kubectl annotate --overwrite kustomization.kustomize.toolkit.fluxcd.io flux-system reconcile.fluxcd.io/requestedAt="$(date +%Y-%m-%dT%H:%M:%S%z)" -n flux-system' +# Flux status overview +alias kfstat='kubectl get gitrepository,kustomization,helmrelease -A' +alias kfstatfs='kubectl get gitrepository,kustomization,helmrelease -n flux-system' +# Flux branch management (based on your workflows) +alias kfbranch='kubectl -n flux-system get gitrepository flux-system -o jsonpath="{.spec.ref.branch}"' +alias kfsetbranch='kubectl -n flux-system patch gitrepository flux-system --type merge -p "{\"spec\":{\"ref\":{\"branch\":\"$(git rev-parse --abbrev-ref HEAD)\"}}}"' +alias kfsetmain='kubectl -n flux-system patch gitrepository flux-system --type merge -p "{\"spec\":{\"ref\":{\"branch\":\"main\"}}}" +# Flux logs +alias kflog='kubectl logs -n flux-system -l app=source-controller -f' +alias kflogk='kubectl logs -n flux-system -l app=kustomize-controller -f' +alias kflogh='kubectl logs -n flux-system -l app=helm-controller -f' +alias kflogs='kubectl logs -n flux-system -l app=source-controller,app=kustomize-controller,app=helm-controller -f --prefix=true'