aks
is a command line tool that let you manage the authorized IP ranges of managed AKS clusters. Therefore it uses Azure CLI
and kubectl
in the background.
Make sure you use a Node version of at least 14.1.0
. Besides Node, Azure CLI
and kubectl
needs to be installed on your machine.
npm install -g @floriandorau/aks-management-cli
Run aks --help
to see how to use it.
aks <command>
Commands:
aks config <command> Manage aks configuration
aks context <command> Manage aks context configurations
aks get-credentials Get access credentials for a managed Kubernetes cluster
aks ip <command> Manage authorized ip range of managed Kubernetes cluster
aks completion generate completion script
Options:
--version Show version
--help Show help
Before you can use aks
you need to set up a application config in your home directory. In order to do so you can use the following command. This will create an empty config file where aks
will store its configuration.
aks config init
At second you need to configure your contexts. With this aks
can determine which parameters should be used dependent on your current kubectl
context.
To add a new context in your configuration you can use the following command.
aks context add {cluster-name} {resource-group} {subscription-id}
You can add multiple contexts to your configuration. If the cluster name matches the output of kubectl config current-context
, aks
can automatically use the correct settings for cluster name, resource group and its corresponding subscription.
If you want to know, which context is already added to your aks
configuration you can use the following command.
aks context list
The main purpose of aks
is managing the authorized IP ranges of AKS clusters. Therefore it provides the following commands which you can use to modify the authorized ip ranges of a cluster which matches your currrent kubectl
context.
Usage: aks ip <command>
Commands:
aks ip add-current Adds your current public ip to AKS authorized ip-ranges
aks ip add <ip> Adds <ip> to AKS authorized ip-ranges
aks ip clear-range Clears existing authorized ip-range of AKS
aks ip remove-current Removes current public ip from AKS authorized ip-ranges if exists
aks ip remove <ip> Removes <ip> from AKS authorized ip-ranges
aks ip show-current Prints your current public ip address
aks ip show-range Prints current authorized ip-range of AKS
Options:
--version Show version
--help Show help
All "current" commands will determine you current public IP address and modify the IP range accordingly.