diff --git a/README.md b/README.md index 3ce9325..1d6df7f 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,26 @@ -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 +- Clone this repo to a local directory and source the plugin in your `.zshrc`: + ```sh + source ~/.kubectl-aliases-zsh/kubectl-aliases.plugin.zsh + ``` +- Reload ZSH with: + ```sh + source ~/.zshrc + ``` + +__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)_ +
+ 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' @@ -11,6 +31,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' @@ -35,6 +58,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' @@ -47,23 +73,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' @@ -88,6 +100,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' @@ -100,6 +115,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' @@ -124,6 +171,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' @@ -141,6 +215,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' @@ -165,11 +247,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' @@ -194,6 +274,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' @@ -206,6 +289,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' @@ -213,57 +299,40 @@ 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' +alias kgdr='kubectl get destinationrules.networking.istio.io' +alias kddr='kubectl describe destinationrules.networking.istio.io' +# +# Network Policies, Endpoints, +# alias kgep='kubectl get endpoints' alias kgepw='kubectl get endpoints --watch' alias kgepn='kubectl get endpoints --namespace' @@ -276,11 +345,24 @@ 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' @@ -305,18 +387,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' @@ -341,39 +414,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' @@ -385,19 +446,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' @@ -406,36 +473,29 @@ 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' - -``` - -# 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 +# +# 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' ``` - -## 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 - ``` +
diff --git a/kubectl.plugin.zsh b/kubectl-aliases.plugin.zsh similarity index 64% rename from kubectl.plugin.zsh rename to kubectl-aliases.plugin.zsh index ad57682..003b7a9 100644 --- a/kubectl.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" @@ -11,6 +14,7 @@ confirm() { fi } +# Force confirmation before using kaf (kubectl apply -f $1) safe_kubectlapply() { context=$(kubectl config current-context) echo "\n" @@ -19,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 @@ -30,8 +34,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 +48,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 +75,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 +90,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 +117,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 +132,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 +188,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 +232,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 +264,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 +291,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 +306,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 +316,41 @@ 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' +alias kgdr='kubectl get destinationrules.networking.istio.io' +alias kddr='kubectl describe destinationrules.networking.istio.io' + +# +# Network Policies, Endpoints, +# alias kgep='kubectl get endpoints' alias kgepw='kubectl get endpoints --watch' alias kgepn='kubectl get endpoints --namespace' @@ -307,11 +363,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 +406,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,39 +433,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' @@ -416,19 +465,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' @@ -437,6 +492,146 @@ 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' +# +# Confluent for Kubernetes (CFK) Objects +# +# 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'