This post aims to show you how to install Kubectl, Helm 3 and S3 plugin so that you can easily store the chart in a S3 bucket form your Ubuntu machine. Though I always use an automated approach to create and store the helm chart, I had to create a helm chart in Ubuntu in order to identify and Helm S3 plugin compatibility issue.
1. Install kubectl
To install kubectl in Ubuntu
nano script.sh
chmod 775 script.sh
Next, paste then the following lines to create a shell script.
#!/bin/bash
sudo apt-get update && sudo apt-get install -y apt-transport-https
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
echo "deb https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee -a /etc/apt/sources.list.d/kubernetes.list
sudo apt-get update
sudo apt-get install -y kubectl
run the script
./script.sh
When the kubectl get installed, type kubectl in the shell to see if it’s running OK.
Ref: https://kubernetes.io/docs/tasks/tools/install-kubectl/
2. Install Helm
sudo snap install helm –classic
Command ‘helm’ is available in ‘/snap/bin/helm’
‘/snap/bin’ is not included in the PATH environment variable. To include it into the path run:
export PATH=$PATH:/snap/bin/
and then run echo $PATH to check if the path has been added successfully.
Ref: https://helm.sh/docs/intro/install/
3.Install HELM s3 plugin
apt-get -y install git
helm plugin install
https://github.com/hypnoglow/helm-s3.git
Type ‘helm’ to check if the plugin has been installed properly.
Ref: https://github.com/hypnoglow/helm-s3
Create a sample helm chart and upload it to s3
Once you are done with the above-mentioned steps. You can create and store a helm chart using the command below. Make sure you have set up an AWS credential on your Ubuntu machine. Make sure that the S3 bucket has been secured using a policy so that only you can upload files from your local machine.
To create a sample chart run the commands below:
helm create sample-chart
helm s3 init s3://your-s3-buckt-name/charts
helm repo add my-charts s3://your-s3-buckt-name/charts
cd sample-chart
helm dependency update
helm package.
helm s3 push --force *.tgz my-charts
Now, if you type “helm repo list”, you will see that your chart repo named “my-charts” has been added to your
local machine. Also, check your S3 bucket’s charts directory to see if the chart file named sample-chart-0.1.0.tgz has been uploaded.