Skip to content

Provide shortened aliases for common kubectl commands like switching namespaceΒ #1182

@MurzNN

Description

@MurzNN

What would you like to be added?

I suggest to add shortened aliases for most used commands in kubectl tool like this:

  • switch namespace:
kubectl set ns my-namespace
# alias of full command: kubectl config set-context --current --namespace=my-namespace
  • query in all namespaces:
kubectl get pods -A
# alias of full command: k get pods --all-namespaces
  • display wide information:
kubectl get pods -W
# alias of full command: kubectl get pods -o wide
  • configure access to new cluster as single command:
kubectl config set my-cluster -S https://1.2.3.4 -CA fake-ca-file -U developer -CC fake-cert-file -CK fake-key-seefile -N frontend
# alias of bunch of commands:
kubectl config set-cluster my-cluster --server=https://1.2.3.4 --certificate-authority=fake-ca-file
kubectl config set-credentials developer --client-certificate=fake-cert-file --client-key=fake-key-seefile
kubectl config set-context dev-frontend --cluster=my-cluster --namespace=frontend --user=developer

Last command alias looks not such short, but it's much easier to execute a single command, instead of three ones!

The above are only examples of common long-typing commands from my perspective.

And via this feature request I want to start discussion about adding practice to provide shortened aliases for most of common kubectl commands to extend the life of the keyboards of all Kuberbetes users :)

Why is this needed?

Most often, I and, it seems to me, most other Kubernetes users are typing manually a lot of kubectl commands with different arguments multiple times every day.

That's good that Kubernetes provides commands and arguments, that are clear without any additional description.

But when we typing them every day, we spend too much time to unnecessary keyboard presses.

In most other tools It's common practice to provide shorten versions of common commands and arguments, to safe users time and extend the life of their keyboards.

So let's think about Kubernetes users and their keyboards too, and provide shortened (abbreviated) aliases for most used commands!

/sig cli

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/featureCategorizes issue or PR as related to a new feature.needs-triageIndicates an issue or PR lacks a `triage/foo` label and requires one.sig/cliCategorizes an issue or PR as relevant to SIG CLI.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions