Kubernetes Tools

Für den Betrieb eines Kubernetes Clusters werden einige Tools benötigt.

dieses sind nicht immer direkt in den Repositories der Distributionen verfügbar. Das folgende Script installiert die wichtigsten Tools in /usr/local/bin und fügt den Pfad zur PATH Variable hinzu.

echo "install needed tools"
  sudo yum install -y epel-release
  sudo yum install -y vim tar git libiscsi-utils iscsi-initiator-utils nfs-utils
  sudo systemctl enable --now iscsid

echo "add /usr/local/bin to PATH"
  echo "PATH=\"/usr/local/bin:\$PATH\"" | sudo tee -a /root/.bashrc | tee -a $HOME/.bashrc

echo "installing kubectl"
  sudo curl -Lo /usr/local/bin/kubectl https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl
  sudo chmod +x /usr/local/bin/kubectl

echo "installing helm"
  curl -L https://get.helm.sh/helm-v3.15.3-linux-amd64.tar.gz|sudo tar xvz -C /usr/local/bin/ --strip-components=1 --wildcards '*/helm'

echo "installing flux"
  curl -s https://fluxcd.io/install.sh | sudo bash

echo "installing ranchercli"
  curl -L https://github.com/rancher/cli/releases/download/v2.8.0/rancher-linux-amd64-v2.8.0.tar.gz|sudo tar xvz -C /usr/local/bin --strip-components=2 --wildcards '*/rancher'

echo "installing cilium"
  CILIUM_CLI_VERSION=$(curl -s https://raw.githubusercontent.com/cilium/cilium-cli/main/stable.txt)
  CLI_ARCH=amd64
  curl -L --fail https://github.com/cilium/cilium-cli/releases/download/${CILIUM_CLI_VERSION}/cilium-linux-${CLI_ARCH}.tar.gz | sudo tar xzvC /usr/local/bin

echo "installing hubble"
  HUBBLE_VERSION=$(curl -s https://raw.githubusercontent.com/cilium/hubble/master/stable.txt)
  HUBBLE_ARCH=amd64
  curl -L --fail https://github.com/cilium/hubble/releases/download/$HUBBLE_VERSION/hubble-linux-${HUBBLE_ARCH}.tar.gz | sudo tar xzvC /usr/local/bin

echo "installing kubectl krew plugin"
	curl -L https://github.com/kubernetes-sigs/krew/releases/latest/download/krew-linux_amd64.tar.gz | sudo tar -xzv -C /usr/local/bin ./krew-linux_amd64
	sudo chmod +x /usr/local/bin/krew-linux_amd64 
	sudo /usr/local/bin/krew-linux_amd64 install krew
	/usr/local/bin/krew-linux_amd64 install krew

	sudo grep KREW_ROOT /root/.bash_profile -q || echo 'export PATH="${KREW_ROOT:-$HOME/.krew}/bin:$PATH"' | sudo tee -a /root/.bash_profile
	grep KREW_ROOT ${HOME}/.bash_profile -q || echo 'export PATH="${KREW_ROOT:-$HOME/.krew}/bin:$PATH"' | tee -a ${HOME}/.bash_profile

echo "installing krew plugins"
	for I in neat cert-manager cilium change-ns df-pv sick-pods; do
		sudo /usr/local/bin/kubectl krew install $I
		/usr/local/bin/kubectl krew install $I
	done