Skip to main content
In this tutorial, we’ll walk through how to use FluxCD’s Notification Controller Receiver API to trigger on-demand reconciliation of a GitRepository resource via GitHub webhooks. By the end, you’ll reduce your GitOps feedback loop from minutes to seconds.

1. Setup & Scaling the Deployment

First, switch to the 2-demo branch and inspect the existing pod:
Example output:

1.1 Scale the Deployment

Edit the block-buster Deployment manifest to increase replicas from 1 to 2:
Save, commit, and watch the new pods spin up:
By default, Flux polls the Git repository every minute. The GitRepository in flux-system might look like this:
Verify Flux polling status:

2. Introducing Webhooks for Immediate Reconciliation

Waiting for the static interval isn’t always ideal. FluxCD’s Notification Controller lets you trigger reconciliation on demand via webhooks. The high-level workflow is:

2.1 Expose Notification Controller

Expose the notification-controller as a NodePort service:
Confirm the service is up:
Example:

2.2 Create the GitHub Webhook Secret

Generate a Kubernetes secret in flux-system. The token must match the “Secret” configured in GitHub:
Keep your webhook token secure. Never commit it to a public repo.

2.3 Create a Flux Receiver

Use flux CLI to create a Receiver CR that listens for ping and push events:
That generates:
Apply and push:
Check the Receiver status:
Example:
Copy the webhook path (/hook/ab09b3ac...) for GitHub configuration.

2.4 Configure GitHub Webhook

In your GitHub repo’s Settings → Webhooks → Add webhook, set:
  • Payload URL: https://<your-host>/hook/<receiver-path>
  • Content type: application/json
  • Secret: your github-webhook-token
Select only the push (and optionally ping) event to avoid unnecessary traffic.
If testing on a local cluster, you can expose your service via localtunnel:
The tool will return a public URL, e.g.:
Append your /hook/... path to form the full Payload URL.

3. Testing the Webhook-triggered Reconciliation

Now let’s scale the deployment again, this time to 4 replicas:
Commit and push your change:
In another terminal, watch Flux detect the update via webhook:
You should see the new revision appear almost instantly—no waiting for the 1m0s interval.

Conclusion

By integrating FluxCD’s Notification Controller with GitHub webhooks, you gain near-instantaneous reconciliation on push events, accelerating your GitOps feedback loop and improving deployment velocity.

Watch Video