Issue in creating helm chart in github repository - kubernetes-helm

I am trying to create a test helm chart in private gitrepo and it is not working.
Here are the Steps:
$ helm create helm-test
$ cd <private-gitrepo-dir>
$ cp -r <helm-test-dir> .
$ helm package . # I see the helm-test-<ver>.tgz
$ helm repo index --url https://github.int.privatename.com/<repo-name>
# tgz file and index.yaml are there in the directory
$ git add . && git commit -m "initial commit " && git push
# now pull the chart
$ helm repo add helm-test https://github.int.privatename.com/<repo-name>/
Error: looks like "https://github.int.privatename.com/<repo-name>/ is not a valid chart repository or cannot be reached: error converting YAML to JSON: yaml: line 182: mapping values are not allowed in this context```
Can you please help me, where is line 182?

Related

deploying kubernetes through helm on jenkins requires authentication

I am trying to deploy my microservice application using kops on aws through jenkins CI/CD pipeline but I am getting error authentication required
my jenkins helm chart and jenkins file
https://github.com/chuksdsilent/ci-cd-kube.git
Error
> git rev-parse --resolve-git-dir /home/ubuntu/3.80.38.55/3.80.38.55/workspace/k8-Jenkins/.git # timeout=10
> git config remote.origin.url https://github.com/chuksdsilent/ci-cd-kube.git # timeout=10
Fetching upstream changes from https://github.com/chuksdsilent/ci-cd-kube.git
> git --version # timeout=10
> git --version # 'git version 2.25.1'
using GIT_ASKPASS to set credentials github-login
> git fetch --tags --force --progress -- https://github.com/chuksdsilent/ci-cd-kube.git +refs/heads/*:refs/remotes/origin/* # timeout=10
> git rev-parse refs/remotes/origin/main^{commit} # timeout=10
> git config core.sparsecheckout # timeout=10
> git checkout -f 451949675ad9895645597a3b25d3a200ef8d1de5 # timeout=10
+ helm upgrade --install --force vprofile-stack helm/vprofilecharts --set appimage=oshabz/k8-jenkins:V9 --namespace prod
Error: Kubernetes cluster unreachable: <html><head><meta http-equiv='refresh' content='1;url=/login?from=%2Fversion'/><script>window.location.replace('/login?from=%2Fversion');</script></head><body style='background-color:white; color:white;'>
Authentication required

How do I know which repository the installed Chart belongs to

I have many helm repositories in my kubernetes,
And I installed a lot of charts,
So How do I know which repository the installed Chart belongs to?
For example:
$> helm repo list
NAME URL
lucy-dev https://harbor.mydomain.net/chartrepo/lucy-dev
lucy-prod https://harbor.mydomain.net/chartrepo/lucy-prod
$> helm ls -n msgbox-lucy -o yaml
- app_version: "1.0"
chart: msgbox-lucy-8.27.3
name: msgbox-lucy
namespace: msgbox-lucy
revision: "48"
status: deployed
updated: 2022-04-19 08:11:16.761059067 +0000 UTC
I can't use helm show because:
$> helm show all msgbox-lucy -n msgbox-lucy --debug
show.go:195: [debug] Original chart version: ""
Error: non-absolute URLs should be in form of repo_name/path_to_chart, got: msgbox-lucy
...
I don't believe you're guaranteed to get the info you're looking for, however we can try.
Find the latest Helm secret for your Helm release.
kubectl get secret -n msgbox-lucy
Yours might look something like this:
sh.helm.release.v1.msgbox-lucy.v5
and run this command to view the chart's metadata:
SECRET_NAME="sh.helm.release.v1.msgbox-lucy.v5"
kubectl get secret $SECRET_NAME -o json | jq .data.release \
| tr -d '"' | base64 -d | base64 -d | gzip -d \
| jq '.chart.metadata'
The metadata should hopefully show you 2 things you're looking for. The chart name will be under the name field. The chart repository URL might be under sources.
I say "might" because the chart developer should have added it there, but they might not have.
Then you can match the URL to your repo alias.
If it's not included in the metadata, you're probably out of luck for now.
There is an open Github issue about exactly this feature you're wanting:
https://github.com/helm/helm/issues/4256
And an open PR that adds that feature:
https://github.com/helm/helm/pull/10369
And an open PR to add a HIP (Helm Improvement Proposal) for adding that feature:
https://github.com/helm/community/pull/224
You can run helm search repo <keyword>
This will search for the keyword msgbox-lucy in all your available repos and list results.
helm search repo msgbox-lucy
Official Doc : https://helm.sh/docs/helm/helm_search_repo/

Helm cli command to update Image tag

I am trying to login remotely into my Helm repository and update Image tag in the values.yml file and later on push my changes into repository.
Can someone please help me in updating Image tag and push helm charts to repo?
curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3
chmod 700 get_helm.sh
./get_helm.sh
helm repo add charts https://harbor.xxx.com/chartrepo/nodeapp-helm-charts --username ${{ secrets.HARBOR_USERNAME }} --password ${{ secrets.HARBOR_PASSWORD }}
helm repo update
helm repo list

Helm delete all releases

I'm trying find a way to delete all deployed releases in Helm.
It appears that Helm does not support deleting all releases, with --all or otherwise.
Would there be another way to delete all Helm releases in one command?
To delete all Helm releases in Linux(in Helm v2.X) with a single command, you can use some good old bash. Just pipe the output of helm ls --short to xargs, and run helm delete for each release returned.
helm ls --all --short | xargs -L1 helm delete
Adding --purge will delete the charts as well, as per #Yeasin Ar Rahman's comment.
helm ls --all --short | xargs -L1 helm delete --purge
On Windows, you can delete all releases with this command, again, with --purge deleting the charts as well.
helm del $(helm ls --all --short) --purge
Update: As per #lucidyan comment, the --purge arg is not available in Helm v3.
For helm 3 you have to provide namespaces so there is an awk step before xargs :
helm ls -a --all-namespaces | awk 'NR > 1 { print "-n "$2, $1}' | xargs -L1 helm delete
This results in commands like:
helm delete -n my-namespace my-release
This worked for me in a powershell cmd window:
helm del $(helm ls --all --short) --purge
helm delete $(helm ls --short)
Description:
helm ls --short gives a list of releases ids.
helm delete id1 id2 id3 deletes releases with ids: id1, id2, id3.
So combining them we get:
helm delete $(helm ls --short)
I regularly delete all releases in Helm too, so I thought it'd be useful to make a Helm plugin for it.
Install:
helm plugin install https://github.com/tedmiston/helm-delete-all-plugin --version 0.0.3
(You may be able to omit the --version x part on newer versions of Helm.)
Usage:
helm delete-all
https://github.com/tedmiston/helm-delete-all-plugin
If you use xargs in the alpine container then you will get the following error;
xargs: unrecognized option: L
So, you can use the following command to delete all releases in a specific namespace for the helm v3.
helm uninstall -n <namespace> $(helm ls --short -n <namespace>)
There is a really good plugin for delete all helm releases from all namespaces (The previous plugin in this post doesn't work for me) .
Install:
helm plugin install https://github.com/BarelElbaz/helm-delete-all
usage:
helm delete-all
you can provide more flags such as --deletePersistent for delete PVCs
or skipping a specific namespace by --except-namespace
To delete all releases in a particular namespace
helm ls --short -n <<namespace>> | xargs -L1 helm uninstall -n <<namespace>>

sync laravel code with github

I want to sync my code to my github repo, so anytime I update my code it should be updated in the repo. Is there any proper and structured way of doing this.
So this is how I am doing it now
1
$ cd my-project
$ git init
$ git remote add origin GITHUB_URL
$ git pull origin master
$ git status
$ git add .
$ git commit -m "Init repo."
$ git push -u origin master
then just repeat following steps
$ git add .
$ git commit -m "Init repo."
$ git push -u origin master