How do I upgrade from helm 3.0.0? - kubernetes

I'm currently running helm 3.0.0 in ubuntu and want to upgrade to helm > 3.0.2 for gitlab. The install instructions suggest it's as simple as deleting the helm binary and downloading the new one and the release notes all suggest there are no breaking changes. Could it possibly be that simple?

It should be that simple, provided you put the binary in the right place in your path (i.e. replace the one that you already get from which helm, assuming you're on unix).
You could test it by running some of the following helm commands:
helm version will tell you what you're running.
helm list will
tell you what you have installed in your cluster (add -n
<namespace> for a different namespace)
If you're ok to temporarily install something into the cluster, follow a helm example to install something and then delete it again with a helm delete

Related

Use init container for running commands in the actual pod

I need to install some libraries in my pod before it starts working as expected.
My use case: I need some libraries that will support SMB (samba), and the image that I have to use does not have it installed.
Unfortunately, exec'ing into the actual pod and running commands do not seem to be a very good idea.
Is there a way by which I can use an init-container to install libsmbclient-dev in my ubuntu pod?
Edit: Some restrictions in my case.
I use helm chart to install my app (nextcloud). So I guess I cannot use a custom image (as far as I know, we cannot use our own images in an existing helm chart). This would have been the best solution.
I cannot run commands in kubernetes value.yaml since I do not use kubectl to install my app. Also I need to restart apache2 after I install the library, and unfortunately, restarting apache2 results in restarting the pod, effectively making the whole installation meaningless.
Since nextcloud helm allows the use of initcontainers, I wondered if that could be used, but as far as I understand the usability of initcontainers, this is not possible (?).
You should build your own container image - e.g. with docker - and push it to a container repository that is suitable for your cluster, e.g. Docker Hub, AWS ECR, Google Artifact registry ...
First install docker (https://docs.docker.com/get-docker/)
create an empty directory and change into it.
Then create a file Dockerfile with the following content:
FROM ubuntu:22.04
RUN apt-get update && apt-get install -y libsmbclient-dev \
&& rm -rf /var/lib/apt/lists/*
Execute
docker build -t myimage:latest .
This will download Ubuntu and build a new container image where the commands from the RUN statement will be executed. The image name will be myimage and the version will be latest.
Then push your image with docker push to your appropriate repository.
See also Docker best practices:
https://docs.docker.com/develop/develop-images/dockerfile_best-practices/

What was "helm chart export" command doing in helm 3.6

I am upgrading my projects to helm 3.7 and the helm chart export command in no longer supported.
https://github.com/helm/helm/releases/tag/v3.7.0
Also there is no Documentation for versions previous to 3.7 available. I want to upgrade my project and need to know how to replace the code.
Helm chart export command was used to extract the helm chart to a specific destination after you pulled the helm chart image. On which destination you could then run for example helm install

ERROR: gcloud crashed (ModuleNotFoundError): No module named 'distutils.spawn'

I have been deploying my service on App Engine for a long time now and never had an issue until today.
Command to Deploy
gcloud app deploy app.yaml
Output
Beginning deployment of service [default]...
Building and pushing image for service [default]
ERROR: gcloud crashed (ModuleNotFoundError): No module named 'distutils.spawn'
I just deployed this morning with no issues and randomly when I tried to redeploy now I get the above error. Hopefully someone can help figure out what caused this issue.
For info:
app.yaml
runtime: custom
env: flex
manual_scaling:
instances: 1
resources:
cpu: 1
memory_gb: 4
disk_size_gb: 10
Gcloud version
$ gcloud --version
Google Cloud SDK 341.0.0
alpha 2021.05.14
beta 2021.05.14
bq 2.0.68
core 2021.05.14
gsutil 4.62
minikube 1.20.0
skaffold 1.23.0
I had a similar issue, on my case this was the solution:
sudo apt-get install python3-distutils
Same exact problem.
Building and pushing image for service [default]
ERROR: gcloud crashed (ModuleNotFoundError): No module named 'distutils.spawn'
This issue seemed to be in the snap install of google-cloud-sdk in Ubuntu 20.04.2 LTS (You can select it pre-installed during the ISO setup.. DONT)
I was getting this in 18.04 as well
FINALLY solved it..
But.. I had to make sure I did not snap install google-cloud-sdk
I also..
sudo apt update
sudo apt upgrade
Then I made sure the snap install was not installed. (After a fresh install of Ubuntu). Sense I use dockerfiles it's easy for me to zap a dev environment and get it back.
But Id imagine if you can't zap your os and make sure not to let the OS put it's snap install of google-cloud-sdk.. You could snap remove google-cloud-sdk and then hunt for all it's configuration files.. And remove them.
At that point
https://cloud.google.com/sdk/docs/install#deb
Follow that... I did so exactly... FINALLY seemed to work. I used the apt install route they explain.. NOT the snap.
I tried all the pip install sudo apt-get install python3-distutils Till I was blue in the face... NADA.
somehow.. The Snap being present puts PATH settings that use the wrong distutils.
On my box now that I search for it.. In Totally fresh OS state... No Snap install and going through exactly the cloud.google.com/sdk/docs/install#deb work..
Here is distutils everywhere on my box in Ubuntu 20.03.2 LTS
$ sudo find / -name distutils
/snap/lxd/19188/lib/python2.7/distutils
/snap/core18/1944/usr/lib/python3.6/distutils
/snap/core18/1944/usr/lib/python3.7/distutils
/snap/core18/1944/usr/lib/python3.8/distutils
/usr/lib/python3.8/distutils
/usr/lib/python3.9/distutils
/usr/lib/python2.7/distutils
Note.. There's no google-cloud-sdk in the snap!!
The gcloud app deploy FINALLY works!! Passes the part where it starts to deploy.
But as the others in this.. It happened completly random.
All I can guess is...... Something clobered distutils as an update somewhere and started pointing to a garbage path.
Make sure you search for distutils find out where it is.. what's referencing it.. Somewhere in that mess you can fix it.
One thing I was able to discover is this problem will come default from 20.04.2.
I downloaded the most recent iso.. thinking it was an 18.04 issue.
Installed it fresh into Virtual Box.. And got exactly this same issue. So my solution fix (no SNAP).. Is against a totally clean 20.04.2 brand spanking new Ubuntu LTS VM. Default everything.
===============
Regarding the random one day it worked.. the next it didn't...
Here's the thing about snaps in Ubuntu:
https://www.google.com/search?q=Do+snap+packages+update+automatically%3F&rlz=1C1CHBF_enUS834US834&ei=ygynYJGRIo3f-gSLzb3YDg&oq=Do+snap+packages+update+automatically%3F&gs_lcp=Cgdnd3Mtd2l6EAMyCAghEBYQHRAeUJ-TCVifkwlgj5kJaABwAXgAgAFziAHVAZIBAzEuMZgBAKABAqABAaoBB2d3cy13aXrAAQE&sclient=gws-wiz&ved=0ahUKEwiRnrfXz9nwAhWNr54KHYtmD-sQ4dUDCA4&uact=5
"Do snap packages update automatically?
Snaps update automatically, and by default, the snapd daemon checks for updates 4 times a day. Each update check is called a refresh."
so that's how it randomly broke if you used a snap

Where are the helm repos added on my windows computer

Mine is a Windows 10 computer.
I ran the following command to install official kubernetes helm charts repository.
helm repo add stable https://charts.helm.sh/stable
The installation was successful as it says.
I wanted to understand where they are installed.
Searched on my home folder, and also ProgramData but could not find.
Any help would be appreciated.
Watching some videos, just found the answer.
Run the following command.
helm env
And you should see all the relevant locations.
And note, this works on ubuntu as well!
These docs describe the helm default file location per operating system.
According to them, your repository files should be under %TEMP%\helm.

helm template --debug or helm install --dry-run --debug , which is best?

I would like to know which is best between helm template --debug
and helm install --dry-run --debug
Thank you
The difference between the two commands is that helm install --dry-run will send things to a Kubernetes cluster, but helm template won't.
My general experience has been that debugging intricate Go templates can be tricky, and if I'm having YAML issues (and especially if I have the Kubernetes API documentation up in a browser tab) the helm template output is more than sufficient for my needs, and is a little faster and has fewer dependencies. So I frequently use helm template.
In contrast, by the time I've gotten the Go templating logic and YAML formatting correct, I'm usually ready to actually do a test deployment; so when I helm install it's almost never with --dry-run. If I've gotten the object layout wrong this will still complain, and if it's right then I'm ready to start sending requests to the service.
This is an addition to the answer of David
I always use helm template --debug
A common problem when developing helm templates are whitespace errors (for example incorrect indentations).
Only helm template --debug (but neither helm install nor plain helm template) will generate the invalid yaml, which can be used for easy debugging, because the helm error messages are rarely helpful.