From 2596aef866e67425d450f8fc006ec0e216e01c93 Mon Sep 17 00:00:00 2001 From: Yusuf Kocaman Date: Mon, 7 Jan 2019 17:24:44 +0300 Subject: [PATCH 1/2] added change namespace and rolling restart functions for kubectl --- plugins/kubectl/kubectl.plugin.zsh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/plugins/kubectl/kubectl.plugin.zsh b/plugins/kubectl/kubectl.plugin.zsh index 4cfe3f45b..fa74df164 100644 --- a/plugins/kubectl/kubectl.plugin.zsh +++ b/plugins/kubectl/kubectl.plugin.zsh @@ -59,6 +59,7 @@ alias kgns='kubectl get namespaces' alias kens='kubectl edit namespace' alias kdns='kubectl describe namespace' alias kdelns='kubectl delete namespace' +alias kcn='kubectl config set-context $(kubectl config current-context) --namespace' #change namespace # ConfigMap management alias kgcm='kubectl get configmaps' @@ -80,6 +81,10 @@ alias kdd='kubectl describe deployment' alias kdeld='kubectl delete deployment' alias ksd='kubectl scale deployment' alias krsd='kubectl rollout status deployment' +# Recreate all pods in deployment with zero-downtime +kres(){ + kubectl set env $@ REFRESHED_AT=$(date +%Y%m%d%H%M%S) +} # Rollout management. alias kgrs='kubectl get rs' From d8c71bbce128aaf9f774bf38b6dc573d1a29380d Mon Sep 17 00:00:00 2001 From: Yusuf Kocaman Date: Mon, 7 Jan 2019 17:35:39 +0300 Subject: [PATCH 2/2] added details about kcn and kres --- plugins/kubectl/README.md | 2 ++ plugins/kubectl/kubectl.plugin.zsh | 3 +-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/plugins/kubectl/README.md b/plugins/kubectl/README.md index a93a9339e..b30f90548 100644 --- a/plugins/kubectl/README.md +++ b/plugins/kubectl/README.md @@ -46,6 +46,7 @@ plugins=(... kubectl) | kdeli | `kubectl delete ingress` | Delete ingress resources matching passed argument | | | | **Namespace management** | | kgns | `kubectl get namespaces` | List the current namespaces in a cluster | +| kcn | `kubectl config set-context ...` | Change current namespace | | kens | `kubectl edit namespace` | Edit namespace resource from the default editor | | kdns | `kubectl describe namespace` | Describe namespace resource in detail | | kdelns | `kubectl delete namespace` | Delete the namespace. WARNING! This deletes everything in the namespace | @@ -67,6 +68,7 @@ plugins=(... kubectl) | kdeld | `kubectl delete deployment` | Delete the deployment | | ksd | `kubectl scale deployment` | Scale a deployment | | krsd | `kubectl rollout status deployment` | Check the rollout status of a deployment | +| kres | `kubectl set env $@ REFRESHED_AT=...` | Recreate all pods in deployment with zero-downtime | | | | **Rollout management** | | kgrs | `kubectl get rs` | To see the ReplicaSet `rs` created by the deployment | | krh | `kubectl rollout history` | Check the revisions of this deployment | diff --git a/plugins/kubectl/kubectl.plugin.zsh b/plugins/kubectl/kubectl.plugin.zsh index fa74df164..d388d6543 100644 --- a/plugins/kubectl/kubectl.plugin.zsh +++ b/plugins/kubectl/kubectl.plugin.zsh @@ -59,7 +59,7 @@ alias kgns='kubectl get namespaces' alias kens='kubectl edit namespace' alias kdns='kubectl describe namespace' alias kdelns='kubectl delete namespace' -alias kcn='kubectl config set-context $(kubectl config current-context) --namespace' #change namespace +alias kcn='kubectl config set-context $(kubectl config current-context) --namespace' # ConfigMap management alias kgcm='kubectl get configmaps' @@ -81,7 +81,6 @@ alias kdd='kubectl describe deployment' alias kdeld='kubectl delete deployment' alias ksd='kubectl scale deployment' alias krsd='kubectl rollout status deployment' -# Recreate all pods in deployment with zero-downtime kres(){ kubectl set env $@ REFRESHED_AT=$(date +%Y%m%d%H%M%S) }