Setup Kubernetes Admin on Linux with Brew

My goal for the year was to transition from a Macbook Pro to an iPad Pro for most of my development tasks, which required migrating my kubernetes admin tools to function in the cloud. To accomplish this, I’m using several AWS EC2 instances running Ubuntu.
Here, I will detail how I set up this instance to support my usual kubectl, k9s, helm and kustomize tooling.
Install Brew
Brew is available for Linux, and since I’m already using it, I installed that first. Before getting started, I need to install build-essential so I have all the necessary development tools.
sudo apt-get install build-essential
Now for brew.
curl https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh \
| NONINTERACTIVE=1 bash
In this case, I’ve set NONINTERACTIVE=1
so that Brew doesn’t ask any questions and just installs it, as I already have sudo set up for my user.
I then add this to my .bash_profile
to set brew up and use auto-completion.
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
if type brew &>/dev/null; then
HOMEBREW_PREFIX="$(brew --prefix)"
if [[ -r "${HOMEBREW_PREFIX}/etc/profile.d/bash_completion.sh" ]]; then
source "${HOMEBREW_PREFIX}/etc/profile.d/bash_completion.sh"
else
for COMPLETION in "${HOMEBREW_PREFIX}/etc/bash_completion.d/"*; do
[[ -r "$COMPLETION" ]] && source "$COMPLETION"
done
fi
fi
Kubectl
Before installing the other tools, I need kubectl so I can control kubernetes. As I’m usually using AWS EKS, I need to have a specific version to work with the kube config that the AWS CLI creates. To do this, I use asdf to manage different versions of kubectl and install the version I want.
brew install asdf
asdf plugin-add kubectl https://github.com/asdf-community/asdf-kubectl.git
asdf install kubectl 1.23.6
asdf global kubectl 1.23.6
Now, I have version 1.23.6, which works with the AWS CLI.
I also use an alias, so I don’t have to always type out kubectl
.
alias k=kubectl
K9S
I love using k9s to manage my kubernetes clusters. It’s easy to install with brew.
brew install derailed/k9s/k9s
Now, I can view what I’m working on.
Helm and Kustomize
They both can be added using brew
brew install helm
brew install kustomize
Conclusion
Thanks to Brew, I have successfully configured my EC2 instance to enable me to manage all my Kubernetes clusters using my preferred tools through a terminal interface.