Skip this section if you’ve already got ansible installed and configure. if not, then the easiest way of using ansible I’ve found is via a pip install. Depending on your OS will depend on your package manager for the next step, in my case Im using Ubuntu.
sudo apt-get update
sudo apt-get install -y python3 python3-venv python3-pip
sudo python3 -m pip install ansible
or if you do not want to install ansible globally, then you can do my preferred install which is a local environment for ansible via:
cd ~
mkdir ansible
cd ./ansible
python -m venv ./local
source ./local/bin/activate
python3 -m pip install ansible
The above will create a local directory in the folder ansible, from there it will install the chain of applications needed to run it and with the source command will attach it to the path of the current terminal session. Note, for each new terminal session you will have to reenter source ./local/bin/activate.
ansible-playbook site.yml
Once ansible script has ran, you will need to copy the kube config file from the master node. The easiest way todo this is via scp.
mkdir ~/.kube
scp pi@<master node ip>:/home/pi/.kube/config ~/.kube/config
Next, we will need to install kubectl
sudo apt-get update
sudo apt-get install -y ca-certificates curl
sudo apt-get install -y apt-transport-https
sudo curl -fsSLo /etc/apt/keyrings/kubernetes-archive-keyring.gpg https://packages.cloud.google.com/apt/doc/apt-key.gp
echo "deb [signed-by=/etc/apt/keyrings/kubernetes-archive-keyring.gpg] https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee /etc/apt/sources.list.d/kubernetes.list
sudo apt-get update
sudo apt-get install -y kubectl
for alternative installs have a look at kubernetes documentation : here
Once installed, you can test the kubectl on the command line with the command below:
kubectl get pods -n kube-system
For those who want a more visual management experience, there’s a number of good GUI and terminal tools. Here are a list and URLs for some of my favorites:
URL https://www.rancher.com/ Github: https://github.com/rancher/rancher
URL https://k9scli.io/ Github: https://github.com/derailed/k9s