feat(kubectl): add convenient aliases for 'kubectl rollout restart' to enhance usability and simplify deployment workflows

This commit is contained in:
mofibo 2025-01-02 17:58:39 +01:00
parent d82669199b
commit 8eb09de255
2 changed files with 7 additions and 1 deletions

View File

@ -12,7 +12,7 @@ plugins=(... kubectl)
## Aliases
| Alias | Command | Description |
| :------- | :------------------------------------------------- | :----------------------------------------------------------------------------------------------- |
|:---------|:---------------------------------------------------|:-------------------------------------------------------------------------------------------------|
| k | `kubectl` | The kubectl command |
| kca | `kubectl --all-namespaces` | The kubectl command targeting all namespaces |
| kaf | `kubectl apply -f` | Apply a YML file |
@ -72,6 +72,8 @@ 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 |
| krrd | `kubectl rollout restart deployment` | Rollout restart a deployment |
| krrd | `kubectl rollout restart deploy` | Rollout restart a deployment |
| kres | `kubectl set env $@ REFRESHED_AT=...` | Recreate all pods in deployment with zero-downtime |
| | | **Rollout management** |
| kgrs | `kubectl get replicaset` | List all ReplicaSets `rs` created by the deployment |
@ -110,6 +112,7 @@ plugins=(... kubectl)
| kdelss | `kubectl delete statefulset` | Delete the statefulset |
| ksss | `kubectl scale statefulset` | Scale a statefulset |
| krsss | `kubectl rollout status statefulset` | Check the rollout status of a deployment |
| krrss | `kubectl rollout restart statefulset` | Rollout restart a statefulset |
| | | **Service Accounts management** |
| kdsa | `kubectl describe sa` | Describe a service account in details |
| kdelsa | `kubectl delete sa` | Delete the service account |

View File

@ -96,6 +96,8 @@ alias kdd='kubectl describe deployment'
alias kdeld='kubectl delete deployment'
alias ksd='kubectl scale deployment'
alias krsd='kubectl rollout status deployment'
alias krrd='kubectl rollout restart deployment'
alias krrd='kubectl rollout restart deploy'
function kres(){
kubectl set env $@ REFRESHED_AT=$(date +%Y%m%d%H%M%S)
@ -118,6 +120,7 @@ alias kdss='kubectl describe statefulset'
alias kdelss='kubectl delete statefulset'
alias ksss='kubectl scale statefulset'
alias krsss='kubectl rollout status statefulset'
alias krrss='kubectl rollout restart statefulset'
# Port forwarding
alias kpf="kubectl port-forward"