Is there any shorter alias on the kubectl/oc for deployments? In OpenShift you have deployment configurations and you can access them using their alias dc
.
Writing deployment
all the time takes too much time. Any idea how to shorten that without setting a local alias on each machine?
Reality:
kubectl get deployment/xyz
Dream:
kubectl get d/xyz
All of the above answers are correct and I endorse the idea of using aliases: I have several myself. But the question was fundamentally about shortnames of API Resources, like dc
for deploymentcontroller
.
And the answer to that question is to use oc api-resources
(or kubectl api-resources
). Each API Resource also includes any SHORTNAMES that are available. For example, the results for me of oc api-resources |grep deploy
on OpenShift 4.10 is:
➜oc api-resources |grep deploy
deployments deploy apps/v1 true Deployment
deploymentconfigs dc apps.openshift.io/v1 true DeploymentConfig
Thus we can see that the previously given answer of "deploy" is a valid SHORTNAME of deployments. But it's also useful for just browsing the list of other available abbreviations.
I'll also make sure that you are aware of oc completion
. For example source <(oc completion zsh)
for zsh. You say you have multiple devices, so you may not set up aliases, but completions are always easy to add. That way you should never have to type more than a few characters and then autocomplete yourself the rest of the way.