Fix RepeatedResourceWarning for Helm Chart deployed by ArgoCD - kubernetes

I have ArgoCD deployed into a K8S cluster which deploys multiple applications based ony Helm charts into my cluster. Each application is stored within a dedicated Git repo and uses a Chart.yaml file to specify a dependency (e.g. the ArgoCD helm chart). In addition I want to customise this Helm chart by overwriting certain K8S resources (e.g. config maps) by defining the corresponding file within a templates directory inside the same repo where the Chart.yaml is stored. I know that I could use the values.yaml file to make these changes, however I would like to have the file within the templates folder. After syncing the application to my cluster I receive a "RepeatedResourceWarning" message.
How can I tell ArgoCD to prioritise always the configuration within the templates folder?

Related

Does helmfile sync will redeploy all existing helm charts

I have a few services running on a kubernetes cluster, and I use Helm Chart where I placed all my services. However, I was asked to transfer Helm Charts into Helmfile.
If I use
helmfile import myrepo/mychart
helmfile sync
Will it redeploy and substitute existing running pods or It will deploy just deploy additional services mentioned
Helm uses a packaging format called charts. A chart is a collection of files that describe a related set of Kubernetes resources. A single chart might be used to deploy something simple, like a memcached pod, or something complex, like a full web app stack with HTTP servers, databases, caches, and so on.
Helmfile is a declarative spec for deploying helm charts. It lets you...
Keep a directory of chart value files and maintain changes in version control.
Apply CI/CD to configuration changes.
Periodically sync to avoid skew in environments.
To avoid upgrades for each iteration of helm, the helmfile executable delegates to helm - as a result, helm must be installed.
Like #DavidMaze suggested, use helm diff command first to determine the changes and then use helm sync command for applying them.

How to get/download configured/updated values.yaml file of deployed application in ArgoCD dashbaord?

I have deployed an application in ArgoCD using open source helm charts(created application using using argo UI dashboard).
I have modified/added some parameters in ArgoCD UI.
I need the values.yaml file with updated data so that I can use it to deploy locally or anywhere using helm command.
The one way is to see the ArgoCD UI, and copy each parameter manually which will take lot of time since I have lot of parameters set.
Is there any easy way to download the values.yaml in argo UI or using argo CLI?

Is There a Way to Detect Changes made to Resources Deployed by a Helm Chart

We have several resources deployed as part of a helm (v3) chart. Some time ago, I made changes to resources deployed by that helm chart manually, via kubectl. This caused some drift between the values in the yaml resources deployed by the helm release (as show by helm get values <release>) and what is actually deployed in the cluster
Example: kubectl describe deployment <deployment> shows an updated image that was manually applied via a kubectl re-apply. Whereas helm show values <release> shows the original image used by helm for said deployment.
I realize that I should have performed a helm upgrade with a modified values.yaml file to execute the image change, but I am wondering if there is a way for me to sync the state of the values I manually updated with the values in the helm release. The goal is to create a new default values.yaml that reflect the current state of the cluster resources.
Thanks!
This is a community wiki answer posted for better visibility. Feel free to expand it.
According to the Helm issue 2730 this feature will not be added in the Helm, as it is outside of the scope of the project.
It looks like there is no existing tool right from the Helm, that would help to port/adapt the life kubernetes resource back into existing or new helm charts/releases.
Based on this, you can use one of the following options:
As suggested by #David Maze. The Helm Diff Plugin will show you the difference between the chart output and the cluster, but then you need to manually update values.yaml and templates.
The helm-adopt plugin is a helm plugin to adopt existing k8s resources into a new generated helm chart.

Deployment for more than one Kubernetes service inside Helm chart /templates folder

I am using Kubernetes helm chart for my Kubernetes service deployment. I have different services now, called x1, x2 upto x10. So now I created x1.yaml inside my templates folder. And running the 'helm install ./mychart'. And now I am getting deployment inside my Kubernetes cluster.
Can I add .yaml files (x2.yaml to x10.yaml) for all my Kubernetes service inside templates folder, and can I deploy together all by using 1 chart ?
I did not properly understood the hierarchy of Helm chart for Kubernetes resource deployment.
Anything that you put into templates/ folder will be rendered as Kube manifest. If you add 10 manifests there - 10 manifests will be applied on "helm install". It is up to you how you want this to work.
You can put all your apps into single Helm chart and create one values.yaml for all your applications. This is absolutely valid practice although not very popular. Whenever you change values.yaml and issue "helm upgrade" - changed manifests will be reapplied.
Or you can create separate chart per application, that's how most of charts look like. In that case you will upgrade applications separately from each other. I think this method is preferred.

Integration of Kubernetes Helm templates for a project deployment

Currently I am working with a project based on a micro service architecture. For making this project, I have 20 Spring Boot micro service projects are there. I for for every root folder I placed my Dockerfile for image building. And I am using Kubernetes cluster for deployment through Helm chart.
My confusion here that, when I created Helm chart, it giving the service.yaml and deployment.yaml inside template directory.
If I am deploying these 20 microservices, do I need to create 20 separate helm chart ? Or Can I create service for every 20 within 1 chart?
I am new to Kubernetes and Helm chart. So I am confused about the standard way of using yaml files with chart. Do I need to create 20 separate chart or can I include in 1 chart?
How can I follow the standard way of chart creation for my micro service projects please?
What I ended up doing (working with a similar stack), is create one microservice Chart, which is stored in an internal Chart repository. Inside of the Helm Chart, I gave enough configuration options, so teams have the flexibility to control their own deployments, but I made sure to set sensible defaults (e.g. make sure the Deployment utilises a RollingUpdateStrategy and readiness probes are configured with sensible defaults).
These configuration options can be passed by the values.yaml file. Teams deploy their microservice via a CICD pipeline, passing the values.yaml file to the helm command (with the -f flag).
I would certainly recommend you read the Helm Template Developer guide, before making the decision. It really depends on how similar your microservices are, but I recommend going for 1 Helm Chart if you have a homogenous environment (which also was the case for me).