alias k="kubectl"
alias kg="kubectl get"
alias kc="kubectl create"
alias kgp="kubectl get pods"
export ks="-n kube-system"
export all="--all-namespaces"
export y="-o yaml"
export j="-o json"
export dry="--dry-run -o yaml"
# bash auto completion could have used "complete -F __start_kubectl k" for alias
source <(kubectl completion bash)
source <(kubectl completion bash| sed s/kubectl/k/g)
will generate deployment yaml
k run nginx --image=nginx $dry
nginx.yaml:
apiVersion: apps/v1
kind: Deployment
metadata:
creationTimestamp: null
labels:
run: nginx
name: nginx
spec:
replicas: 1
selector:
matchLabels:
run: nginx
strategy: {}
template:
metadata:
creationTimestamp: null
labels:
run: nginx
spec:
containers:
- image: nginx
name: nginx
resources: {}
status: {}
list all pods from all namespaces
kgp $all
list all pods in kube-system
kgp $ks
so much can be added to the list but want to, keep it simple and just to give an idea
set ts=2 sw=2 et ai
set pastetoggle=<f2>
set relativenumber
set list