Skip to main content
In this lesson you’ll configure a dedicated ServiceAccount and RBAC rules so an Argo Events Sensor can submit Argo Workflows into a target namespace. This resolves “permission denied” errors when the Sensor attempts to create a Workflow using the cluster default ServiceAccount. Why this matters:
  • Using a scoped ServiceAccount with minimal RBAC permissions is more secure than relying on the default ServiceAccount.
  • It prevents permission errors and enables the Sensor to create Workflows in a separate namespace.
Problem evidence (sensor error when using the default ServiceAccount):
This shows the Sensor (running in argo-events) attempted to create a Workflow in the argo namespace using the default ServiceAccount and was forbidden. Planned steps:
  1. Create a ServiceAccount in the Sensor’s namespace (argo-events).
  2. Create a Role and RoleBinding in the target namespace (argo) to allow the ServiceAccount to create/read Workflows.
  3. Update the Sensor to use the new ServiceAccount.
  4. Trigger the Sensor and confirm the Workflow is created.

Resources Overview

References:

1. Create the ServiceAccount

First, list existing ServiceAccounts in the argo-events namespace, then create a new one called workflow-trigger-sa:
Expected output after creation:

2. Create Role and RoleBinding for Argo Workflows

Create a Role in the argo namespace that grants the minimum permissions the Sensor needs for Argo Workflows, and a RoleBinding that binds the workflow-trigger-sa ServiceAccount from the argo-events namespace to that Role. Manifest to apply:
Apply the manifest:
Expected apply output:
If you see an error like “unknown command ‘apply’ for ‘kubectl1’”, it likely indicates an alias or PATH issue (for example, k pointing to an unexpected binary). Use the full kubectl binary or fix the alias so k maps to kubectl.

3. Update the Sensor to Use the ServiceAccount

Edit your Sensor manifest to set spec.template.serviceAccountName to the ServiceAccount you created (workflow-trigger-sa). Below is a minimal Sensor snippet showing where to configure this:
Apply the updated Sensor manifest or edit the resource directly:
After updating, the Sensor will use workflow-trigger-sa when creating Workflows in the argo namespace.

4. Trigger the Sensor and Confirm Workflow Creation

Trigger the webhook event source (example using curl):
You should receive a success response from the event source (for example, success). Then check logs to confirm the event flow: Example event source logs:
Example Sensor logs:
Verify the Workflow exists in the argo namespace:
Describe the Workflow to inspect labels and the ServiceAccount used by the creator:
You should see labels like workflow.argoproj.io/creator and evidence that the Workflow was submitted by the workflow-trigger-sa ServiceAccount. Check the Workflow pod logs to confirm the job ran successfully (example cowsay output):

Summary / Event Flow

  • The webhook EventSource receives the HTTP POST and publishes the event to the event bus.
  • The Sensor subscribes to the event bus, evaluates dependencies, and triggers the Argo Workflow.
  • The Sensor uses the configured spec.template.serviceAccountName (workflow-trigger-sa) to submit the Workflow into the argo namespace.
  • The Role and RoleBinding in the argo namespace grant the ServiceAccount the necessary permissions to create and read Argo Workflows.
This setup ensures your Sensor submits Workflows securely using a limited, purpose-built ServiceAccount instead of the cluster default ServiceAccount.

Watch Video

Practice Lab