For the complete documentation index, see llms.txt. This page is also available as Markdown.
GitOpsRbac

Manage GitOps application access with labels

Configure label-based role-based access control (RBAC) to control which GitOps applications each user can view and sync

Harness uses role-based access control (RBAC) across the platform, including GitOps. In addition to standard RBAC, you can restrict access to GitOps applications using labels on those applications. The GitOps application list shows only the applications each user is authorized to access based on label-based RBAC.


What you will learn from this topic

  • Label-based RBAC: How Harness matches application labels to resource groups and roles.

  • Labeling strategy: How to define labels that scale across many applications.

  • Resource groups and roles: How to create resource groups, assign GitOps permissions, and bind roles to users.

  • Harness default labels: Which labels Harness applies automatically and how to use them in resource groups.


Before you begin

Review these topics before you configure label-based RBAC:

  • ApplicationSets: Go to ApplicationSet basics to understand how ApplicationSets generate applications.

  • Harness ApplicationSets: Go to ApplicationSets to review Harness ApplicationSet workflows.

  • Harness RBAC: Go to RBAC in Harness to understand roles, resource groups, and role bindings.


Benefits of label-based RBAC

Label-based RBAC gives you finer control than name- or namespace-based permissions alone. The main benefits are:

  • Granular control: Define permissions from application characteristics instead of individual application names.

  • Scalability: Manage access for large application portfolios without one-off role assignments.

  • Consistency: Apply uniform access policies across teams and environments.

  • Flexibility: Adapt to organizational changes without rebuilding your entire RBAC model.

Implement label-based RBAC

The following walkthrough configures label-based access from labeling strategy through role binding.

1

Define your labeling strategy

Before you add labels, define a consistent strategy your teams can follow. For example:

  • harness.io/env-type: [prod|staging|dev]

  • harness.io/team: [frontend|backend|data]

  • harness.io/criticality: [high|medium|low]

2

Add labels to your application

Add labels that match your strategy on each GitOps application, or generate them from an ApplicationSet template.

Add a label on an existing application

In your project, do the following:

  1. Click GitOps.

  2. Click Applications, then select your application.

  3. On the options bar, select App Details.

  4. Add a Label that matches your labeling strategy.

Add labels through ApplicationSet templates

Instead of labeling each application manually, add labels in your ApplicationSet template. For example:

3

Create resource groups in Harness

Resource groups let you scope GitOps applications by label.

  1. In Project Settings, navigate to Access Control > Resource Groups.

  2. Click New Resource Group.

  3. Enter a name, then click Save.

  4. On the left, select Resources, then select GitOps > Applications.

  5. Select All, then click Save.

Filter by label

To scope a resource group to specific applications, select By Label, click Add, enter a label from your strategy (for example, harness.io/env-type: prod), then click Add Application Labels.

4

Create a role with permissions

Create a role that grants the GitOps permissions users need on applications in the resource group.

  1. In Project Settings, navigate to Access Control > Roles.

  2. Click New Role.

  3. Enter a name, then click Save.

  4. Under GitOps, enable View and Sync (or the permissions your workflow requires).

5

Bind roles and resource groups to users

Assign the role and resource group to the users or groups who need access.

  1. In Project Settings, navigate to Access Control > Role Bindings.

  2. Create a binding that maps your role and resource group to a user or user group.

After the binding is in place, those users can sync applications that match the labels in the resource group.

Harness default labels

When Harness generates applications from ApplicationSets, it can apply default labels that associate applications with Harness services and environments. You can use these labels in resource group filters:

  • harness.io/envRef: Enter the environment identifier to associate the application with a Harness environment.

  • harness.io/serviceRef: Enter the service identifier to associate the application with a Harness service.


Troubleshooting

Sync operation fails because of permissions

Confirm the user has a role binding that includes Sync on GitOps applications. Verify that application labels match the label filters on the resource group in the binding.

Labels do not appear on applications

Confirm your ApplicationSet template includes the labels in template.metadata.labels. If you add labels through a pipeline, verify the pipeline step runs successfully and that no conflicting ApplicationSet definitions overwrite the labels.

User cannot see expected applications in the GitOps application list

Check the user's role bindings and confirm the resource group label filters include the labels on the application. Users only see applications that match their authorized resource groups.


Next steps

You configured label-based RBAC for GitOps applications. Extend access control and application management with these topics:

Last updated

Was this helpful?