Bash - Install helm, kubectl, and eksctl if not already installed
Install common command-lind tools to interact with Kubernetes clusters and Amazon EKS if the environment doesn’t already have it.
Install kubectl
Install the latest amd64
version of kubectl
for managing Kubernetes 1.23
clusters if not installed:
if which kubectl >/dev/null 2>&1; then
echo "kubectl installed";
else
echo "kubectl not installed. Installing...";
curl -o kubectl https://s3.us-west-2.amazonaws.com/amazon-eks/1.23.7/2022-06-29/bin/linux/amd64/kubectl
fi;
For more info or other versions, see Installing or updating kubectl
in the Amazon EKS User Guide.
Install helm
Install the latest version of helm
for deploying container applications to Kubernetes if not installed:
if which helm >/dev/null 2>&1; then
echo "helm installed";
else
echo "helm not installed. Installing...";
sudo yum install -y openssl \
&& curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 \
&& chmod 700 get_helm.sh \
&& ./get_helm.sh;
fi;
For more info or other versions, see Installing Helm in the official HELM Docs.
Install eksctl
Install the latest version of eksctl
for making it easier to manage Kubernetes clusters running on Amazon EKS if not installed:
if which eksctl >/dev/null 2>&1; then
echo "eksctl installed";
else
echo "eksctl not installed. Installing...";
curl --silent --location "https://github.com/weaveworks/eksctl/releases/latest/download/eksctl_$(uname -s)_amd64.tar.gz" | tar xz -C /tmp
sudo mv /tmp/eksctl /usr/local/bin
fi;
For more info or other versions, see Installing or updating eksctl
in the Amazon EKS User Guide.
Install all
Install the latest version of any of the above that are not installed:
# kubctl
if which kubectl >/dev/null 2>&1; then
echo "kubectl installed";
else
echo "kubectl not installed. Installing...";
curl -o kubectl https://s3.us-west-2.amazonaws.com/amazon-eks/1.23.7/2022-06-29/bin/linux/amd64/kubectl
fi;
# helm
if which helm >/dev/null 2>&1; then
echo "helm installed";
else
echo "helm not installed. Installing...";
sudo yum install -y openssl \
&& curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 \
&& chmod 700 get_helm.sh \
&& ./get_helm.sh;
fi;
# eksctl
if which eksctl >/dev/null 2>&1; then
echo "eksctl installed";
else
echo "eksctl not installed. Installing...";
curl --silent --location "https://github.com/weaveworks/eksctl/releases/latest/download/eksctl_$(uname -s)_amd64.tar.gz" | tar xz -C /tmp
sudo mv /tmp/eksctl /usr/local/bin
fi;