Configure Alias on Windows for Kubectl

I was getting a bit tired of typing the kubectl command everytime. To solve this and only type k instead of kubectl, it’s possible to add an alias to Windows.

1. Create a directory in c:\program files\ called k8s
2. Create a cmd file and save it as alias.cmd in c:\program files\k8s\:

@echo off
doskey k=kubectl $*

3. Add an entry to the registry which calls this alias.cmd file everytime when a command window is opened. This can be done with the following file. Save it as addtoregistry.reg:

Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Microsoft\Command Processor]
"AutoRun"="c:\\\"Program Files\"\\k8s\\alias.cmd"

Download both files here

— update
Ahmet Alp Balkan has created more than 800 aliases for kubectl which works on Linux.
I converted the aliases Ahmet created, so they work on Windows. Read his blog to read the syntax and see the original aliases on his GitHub account:

If you don’t mind to wait for the loading of all the aliases when opening a command prompt, you can find the Windows aliases here


2 gedachtes over “Configure Alias on Windows for Kubectl

Geef een reactie

Vul je gegevens in of klik op een icoon om in te loggen. logo

Je reageert onder je account. Log uit /  Bijwerken )

Facebook foto

Je reageert onder je Facebook account. Log uit /  Bijwerken )

Verbinden met %s

Deze site gebruikt Akismet om spam te bestrijden. Ontdek hoe de data van je reactie verwerkt wordt.