Skip to content

Correct Way to Install Loki Stack with Custom Configurations via Argo CD and Helm

If you’re seeking to install the loki-stack in Kubernetes using Argo CD, while also making specific configuration changes (like setting custom values for retention period or enabling deletes), here’s how it can be done:

Understanding Loki Stack and Helm Chart Configuration

The official Loki stack comes with multiple sub-chart dependencies, each having its own configuration file—usually named values.yaml. For instance, to adjust log retention:

loki: # Necessary for accessing values of sub-chart 
   loki:
     storage:
       type: 'filesystem'
# Add your custom configurations here as shown above

This structure ensures you can specify the desired configuration parameters directly in its respective chart. If it’s not clear where to configure certain aspects, refer here for more guidance on Helm charts’ nesting and values management.

Argo CD Implementation Steps

Here is a step-by-step guide to install loki-stack with the required custom configurations through Argo CD:

  1. Ensure you have your local copy of helm chart along with any modifications (if applicable) committed into Git Repository for version control and collaboration purposes, including updates like changing retention period settings or enabling deletes in charts/loki-stack.
  2. Create a Helm release using Argo CD which loads the desired configurations:
helm repo update # Make sure your local chart is up to date with remote charts 
argocd project add myproject (adds current directory as part of the Project)
argocd repo add stable https://k8s-charts.storage.googleapis.com/stable #(if not already added, adds official Kubernetes Helm Chart Repository for stability chart releases)
  1. Using Argo CD CLI or directly through UI (ArgoCD dashboard), create a new Application resource representing your loki-stack deployment:
  2. Define the required values in its respective YAML files and ensure they match with what was previously configured locally on their own repository, if any alterations were made beforehand which should be committed first to Git Repository for syncing through Argo CD automatically at runtime as changes are pushed or merged thereafter. The specific fields can vary based upon your needs but will typically look similar:
apiVersion: argoproj.io/v1alpha0 # Specify the application version according to what is available in helm chart repo you added previously for stable charts  
kind: Application          # Define resource type, i.e., ArgoCD Applications here which will be used by ARGO CD as part of installation process 
metadata:           #(Required) Metadata object where we can provide unique name and labels to the application (in this case `loki-stack`)  
name:               loki             # Unique Name for your helm release, i.e., Application instance in Argo CD; In our example it is called as "LokiStackApplication"    
namespace:          default           #(Default namespace used by the chart or can be changed based on user preference)  
  1. Finally apply these resources to ensure loki-stack with your specific configurations gets installed into Argo CD and ultimately propagated live in Kubernetes cluster within specified environment, managed as per desired state:
argocd app deploy lokecho (deployment command if changes were committed locally) | argocd api has been used for deployment from local repo to remote helm chart repository successfully.    # Here the `loki-stack` is being deployed with specific configurations via Argo CD  

Always remember, while implementing these steps through Helm or any other Deployment tool like Argocd, make sure you’re following best practices for configuration management and version control to maintain a robust system.


Previous Post
Understanding Project Access Tokens in GitLab A T
Next Post
Declaring Configuration for Self Hosted Build Agen