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 the2-demo branch and inspect the existing pod:
1.1 Scale the Deployment
Edit theblock-buster Deployment manifest to increase replicas from 1 to 2:
GitRepository in flux-system might look like this:
2. Introducing Webhooks for Immediate Reconciliation
Waiting for the staticinterval 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 thenotification-controller as a NodePort service:
2.2 Create the GitHub Webhook Secret
Generate a Kubernetes secret influx-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
Useflux CLI to create a Receiver CR that listens for ping and push events:
/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.
localtunnel:
/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:Conclusion
By integrating FluxCD’s Notification Controller with GitHub webhooks, you gain near-instantaneous reconciliation onpush events, accelerating your GitOps feedback loop and improving deployment velocity.