kubectl get resource --short-names
Ok, lets get all the persistent volume claims in our production namespace. So, the command would be:
kubectl get persistentvolumeclaims --namespace=production
Ok, the command is easy to understand, but writing such big commands in their full forms can be a pain quickly. Now image writing such big commands in the shell or powershell prompt again and again while debugging an issue.
Does it sound good?
Error debugging can quickly turn into nightmare if you have additionally take care of spellings of such big commands.
Now you would be thinking to reduce down this effort.
Thankfully we do have short identifiers for such type of common resource types.
Let me share the short identifier of above command
kubectl get pvc -n production
And if you use alias as well,
ku get pvc -n production
Isn’t this a lot better?
Here’s the complete list of shortened resource types you can use:
componentstatuses
= csconfigmaps
= cmendpoints
= epevents
= evlimitranges
= limitsnamespaces
= nsnodes
= nopersistentvolumeclaims
= pvcpersistentvolumes
= pvpods
= poreplicationcontrollers
= rcresourcequotas
= quotaserviceaccounts
= saservices
= svccustomresourcedefinitions
= crd, crdsdaemonsets
= dsdeployments
= deployreplicasets
= rsstatefulsets
= stshorizontalpodautoscalers
= hpacronjobs
= cjcertificiaterequests
= cr, crscertificates
= cert, certscertificatesigningrequests
= csringresses
= ingnetworkpolicies
= netpolpodsecuritypolicies
= pspreplicasets
= rsscheduledscalers
= sspriorityclasses
= pcstorageclasses
= sc
I hope you enjoyed this blog!
Happy automation!