Notes to Self

Alex Sokolsky's Notes on Computers and Programming

kubectl Installation

Install the kubectl cli to interact with the Kubernetes API:

sudo apt-get update
# apt-transport-https may be a dummy package; if so, you can skip that package
sudo apt-get install -y apt-transport-https ca-certificates curl
curl -fsSL | sudo gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg
# This overwrites any existing configuration in /etc/apt/sources.list.d/kubernetes.list
echo 'deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] /' | sudo tee /etc/apt/sources.list.d/kubernetes.list

and then:

sudo apt-get update
sudo apt-get install -y kubectl

Set up autocompletion in bash:

echo "source <(kubectl completion bash)" >> ~/.bashrc

Alternatively in zsh:

echo "source <(kubectl completion zsh)" >> ~/.zshrc