AKS Management

This is the start of a series of posts as I come across tips and tricks for managing the Azure Kubernetes Service. These may be scripts, utilities (CLI or apps), and other various things that come across my keyboard as I work with AKS.

K9s

K9s is a utility that is a great for helping you get around and discover resources in a Kubernetes cluster through a terminal interface. It takes care of interacting with kubectl command for you so your cluster could run on-premises or in Azure.

Get Started

You can find the install instructions offer multiple methods based on your OS and preference. To install this using Chocolatey:


choco install k9s -y

You can verify the installation after that by running:


k9s version

You will see output similar to:

Use

You can run the command with various flags to control what scope it runs for a cluster. If you just run k9s with no flags, it will open the command-line graphic to the whole cluster.

After you have the application running, there are a few keyboard shortcuts that are useful to help get around. Every screen you will have these quick keys accessible. They are visible on the screen at all times:

Others to be aware of starting out:

  • ESCAPE – Escape key is used to go back to the previous screen

  • :+q – Used to quit the application.

  • : – (colon) will bring a command prompt up where you can type an alias to move around to different areas of the cluster. You can start typing a few characters and intellisense/tab completion will be available.

  • CTRL+a – this will bring up a complete list of all the alias that you can use in the prompt

  • SHIFT+f – this bring up a prompt for configuring port-forwarding on the selected pod or container (dependent upon what context your view is on at the time)

  • :+ctx – the alais ctx allows you to change context of the current cluster. A big time saver when things are busy.

Closing

The terminal interaction that K9s offers is extremely useful for those still learning how to get around a cluster using kubectl. As well, even if you are already familiar with kubectl it saves a lot typing when you manage several clusters.