Continuing with previous post,
- Editor of your choice
By default, kubectl uses default editor (which is most of the time vim or nano), you can set editor of your choice by setting the following environment variable with editor of you choice.
export KUBE_EDITOR=`code --wait`
- Edit while you create
You can edit the resource definition right before deploying whether from a file or remote link. This helps when you are deploying sample application from remote link and want to edit something before deploying.
$ kubectl create -f life.yml --edit
$ kubectl create -f https://goo.gl/Z6WMNF --edit
- explain
To read more information about resource right from the terminal.
kubectl explain pod
kubectl explain pod.spec
kubectl explain pod.spec.containers
- forgot the key
To check if type of the field/key, whether it is required or not
kubectl explain life --recursive
- Logs always help
To get more useful informations like request/response body, Curl commands for equivalent kubectl commands
-v=9 CURL command
-v=8 request and response body
-v=6 method and apipath
- To explore all api paths
kubectl get --raw /
- Run before you run
Always dry run before deploying your application to avoid any consequences.
$ kubectl create configmap life --from-file=life --dry-run
- Krew
Krew is kubectl plugin manager to search/install plugins for kubectl which is quite useful
$ kubectl krew search
$ kubectl krew install <plugin>