Quick Start
Introduction
This page helps to get started with Kubernetes management.
Since we mainly use Azure AKS as managed Kubernetes service, this guide uses the Azure CLI.
Preparation
Use the Azure CLI to save Kubernetes contexts to your local .kubeconfig
.
Login Azure
First you need to login to Azure via the command line:
az login
Cluster list
List all available clusters:
az aks list --query "[].name"
Install context for cluster
Save credentials to your local .kubeconfig
to grant access to a cluster listed on previous step:
# manually update "ambimax-staging" with desired name
clusterName=ambimax-staging; az aks get-credentials --overwrite-existing --name "$clusterName" --resource-group "$clusterName"
k9s management
Install k9s
Ensure k9s is installed
brew install k9s
Configure k9s
Download our default config here
Move config file to ~/.kube/config
mv ~/Downloads/k9s_config ~/.kube/config
Change the permissions so the config can only be accessed by you
chmod 700 ~/.kube
chmod 600 ~/.kube/config
you should see ambimax-servinga
when running
kubectl config current-context
Use k9s
Just use the name to start the tool
k9s
Navigate tool with cursors or use key bindings like ESC
. More documentation
Action | Command | Comment |
---|---|---|
Show active keyboard mnemonics and help | ? | |
Show all available resource alias | ctrl-a | |
To bail out of K9s | :q , ctrl-c | |
View a Kubernetes resource using singular/plural or short-name | : po⏎ | accepts singular, plural, short-name or alias ie pod or pods |
View a Kubernetes resource in a given namespace | : alias namespace⏎ | |
Filter out a resource view given a filter | / filter⏎ | Regex2 supported ie `fred |
Inverse regex filter | / ! filter⏎ | Keep everything that doesn't match. |
Filter resource view by labels | / -l label-selector⏎ | |
Fuzzy find a resource given a filter | / -f filter⏎ | |
Bails out of view/command/filter mode | <esc> | |
Key mapping to describe, view, edit, view logs,... | d ,v , e , l ,... | |
To view and switch to another Kubernetes context | : ctx⏎ | |
To view and switch to another Kubernetes context | : ctx context-name⏎ | |
To view and switch to another Kubernetes namespace | : ns⏎ | |
To view all saved resources | : screendump or sd⏎ | |
To delete a resource (TAB and ENTER to confirm) | ctrl-d | |
To kill a resource (no confirmation dialog!) | ctrl-k | |
Launch pulses view | : pulses or pu⏎ | |
Launch XRay view | : xray RESOURCE [NAMESPACE]⏎ | RESOURCE can be one of po, svc, dp, rs, sts, ds, NAMESPACE is optional |
Launch Popeye view | : popeye or pop⏎ | See popeye |
View pod log
Use l
to view logs.
SSH into pod
Use s
to ssh into any pod.
Port forwarding
Select desired pod and use shift
+ f
to add port forwarding.
For MySQL use 127.0.0.1 in TablePlus
Show secret
Navigate to :
secret
to view all secrets. Select any secret and press x
to view its decoded content.