- GitOps workflow steps
- Helm chart with GitOps workflow
- Helm configuration reference
- Custom values
- Automatic drift remediation
- Example repository layout
- Known issues
You can deploy Helm charts to your Kubernetes cluster and keep the resources in your cluster in sync with your charts and values. To do this, you use the pull-based GitOps features of the agent for Kubernetes.
This feature is in Alpha and an epic exists to track future work. Tell us about your use cases by leaving comments in the epic.
To update a Kubernetes cluster by using GitOps with charts, complete the following steps.
- Ensure you have a working Kubernetes cluster, and that the chart is in a GitLab project.
- In the same project, register and install the GitLab agent.
- Configure the agent configuration file so that the agent monitors the project for changes to the chart. Use the GitOps configuration reference for guidance.
To update a Kubernetes cluster by using Helm charts:
- Ensure you have a working Kubernetes cluster.
- In a GitLab project:
- Store your Helm charts.
- Register and install the GitLab agent.
- Update the agent configuration file so that the agent monitors the project for changes to the chart. Use the configuration reference for guidance.
Any time you commit updates to your chart repository, the agent applies the chart in the cluster.
The following snippet shows an example of the possible keys and values for the GitOps section of an agent configuration file (
gitops: charts: - release_name: my-application-release source: project: id: my-group/my-project-with-chart ref: branch: production path: dir-in-project/with/charts namespace: my-ns max_history: 1 values: - inline: someKey: example value
|List of charts you want to be applied in your cluster. Charts are applied concurrently.|
|Required. Name of the release to use when applying the chart.|
|Optional. Custom values for the release. An array of objects. Only supports |
|Optional. Namespace to use when applying the chart. Defaults to |
|Optional. Maximum number of release revisions to store in the cluster.|
|Required. From where the chart should get installed. Only supports project sources.|
|Required. ID of the project where Helm chart is committed. Authentication is not supported.|
|Optional. Git reference in the configured Git repository to fetch the Chart from. If not specified or empty, the default branch is used. If specified, it must contain either |
|Branch name in the configured Git repository to fetch the Chart from.|
|Tag name in the configured Git repository to fetch the Chart from.|
|Commit SHA in the configured Git repository to fetch the Chart from.|
|Optional. Path of the chart in the project repository. Root of the repository is used by default. Should be the directory with the |
Introduced in GitLab 15.6. Requires both GitLab and the installed agent to be version 15.6 or later.
To customize the values for a release, set the
values key. It must be
an array of objects. Each object must have exactly one top-level key that describes
where the values come from. The supported top-level keys are:
inline: Specify the values inline in YAML format, similar to a Helm values file.
When installing a chart with custom values:
- Custom values get merged on top of the chart’s default
- Values from subsequent entries in the
valuesarray overwrite values from previous entries.
gitops: charts: - release_name: some-release values: - inline: someKey: example value # ...
Drift happens when the current configuration of an infrastructure resource differs from its desired configuration. Typically, drift is caused by manually editing resources directly, rather than by editing the code that describes the desired state. Minimizing the risk of drift helps to ensure configuration consistency and successful operations.
In GitLab, the agent for Kubernetes regularly compares the desired state from the chart source with the actual state from the Kubernetes cluster. Deviations from the desired state are fixed at every check. These checks happen automatically every 5 minutes. They are not configurable.
/my-chart ├── templates | └── ... ├── charts | └── ... ├── Chart.yaml ├── Chart.lock ├── values.yaml ├── values.schema.json └── some-file-used-in-chart.txt
The following are known issues:
- Your chart must be in a GitLab project. The project must be an agent configuration project or a public project. This known issue also exists for manifest-based GitOps and is tracked in this epic.
- Values for the chart must be in a
values.yamlfile. This file must be with the chart, in the same project and path.
- Because of drift detection and remediation, the release history stored in the cluster is not useful. A new release is created every five minutes and the oldest release is discarded. Eventually history consists only of the same information. View this issue for details.
Make sure values are in
values.yaml and in the same directory as the
The filename must be lowercase, with
.yaml extension (not