fluend plugin in kuberntes - kubernetes

I want to install a plugin for fluentd throttle in kuberntes during chart installtion
I found this command: for fluentd
$ gem install fluent-plugin-throttle
but I am new to kuberntes and could not found where to add so it will be installed as part of the chart deployment

If you are using the official (now deprecated) you can supply plugins.pluginsList for the chart to download and install for you.

Take a quick look at the values.yaml of the official fluentd helm chart and you will see in line 42 the following section:
plugins:
enabled: false
pluginsList: []
So basically you just need to edit this file by setting enabled to true and providing your plugins list, so it may look as follows:
plugins:
enabled: true
pluginsList:
- fluent-plugin-throttle
You can even upgrade your already deployed fluentd with such list of additional plugins. You can compare it with this comment about the installation of grafana plugins.

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

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.

How do I upgrade from helm 3.0.0?

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

How do I force-reinstall a package with Ansible?

I'm using Ansible to deploy .deb packages from a custom repository.
Sometimes a developer can forget to change the package number, so the repository will have the new package with the old version. This is unnecessary, so I would like to always reinstall the package. How do I do that?
There is the force=yes option for apt module. Ansible documentation says:
If yes, force installs/removes.
But that seems to be about force-accepting any warnings. At least when I turn it off, Ansible gets blocked with a warning about an untrusted source. (Both the repository and the servers are in the same intranet, so that should not be an issue)
I could use this:
- name: force-reinstall myservice
shell: apt-get --reinstall install myservice
But this way I cannot use other options for apt module, and Ansible gets blocked on warnings the same way.
Is there a way to always reinstall a package and avoid blocking on any interactivity?
The proper way is definitely to use the correct version number. But if you don't want to enforce that then the easiest workaround is to first remove the package and then install it again. That is effectively same as reinstalling.
- name: remove package
apt: name=package_name state=absent
- name: install package
apt: name=package_name state=present update_cache=yes
Unfortunately I don't see any possibility for a "reinstall" with the apt package module.
The only possibility is the one already mentioned in the question via shell or better via command module.
- name: Reinstall of package by command.
command: "apt --reinstall install package"
With the apt module you only have the possibility to do an uninstall (state=absent) followed by a new install (state=present). I don't see a problem with the idempotent approach of Ansible, if you use an appropriate condition via when. For example:
- name: Reinstall of package by uninstall and new install.
apt:
name: package
state: "{{ item }}"
with_items: ['absent', 'present']
when: reinstall_is_required
But: An uninstall and a new install can be very risky depending on the package, also this is not the same as a reinstall like "apt --reinstall install package".
I faced the same problem of needing the option of a reinstall.
I installed an application and in the config of the application I changed the execution user for this application. Reinstall changes the owners for all files and folders accordingly.
Uninstall and new install: Uninstall removes all config files (including the one I changed) and the new install creates the package default config files.
Reinstall via apt: The config files remain unchanged (are not overwritten by the package default config) and the configuration of the application is applied with the customized config.
For this reason, the reinstall option of apt is the only option for me.