SlideShare uma empresa Scribd logo
1 de 32
Baixar para ler offline
Setting up Notifications,
Alerts & Webhooks with Flux
Alison Dowdney, Developer Advocate, Weaveworks
Stacey Potter, Community Manager, Weaveworks
Weaveworks is founded on open source
● Flux (& GitOps Toolkit) (CNCF): GitOps for k8s
● Flagger (CNCF): Declarative Progressive Delivery for Service
Meshes
● Cortex (CNCF): Distributed, Long-term-storage TSDB
compatible with Prometheus
● Weave Ignite: VMs with container UX & built-in GitOps
management
● EKSctl: Create an Amazon EKS cluster with one command
● (and many many more projects!)
weave.works
Setting up Notifications, Alerts, & Webhooks w/ Flux
Speakers Help/Support
Duration
30-45 Minutes
Alison Dowdney
DX Engineer
Weaveworks
Stacey Potter
Community Mgr
Weaveworks
Browser
Safari copy/paste
shortcuts may not work
Using Zoom
Questions?
• Use chat (button: top
left corner of screen)
• Escape to exit full
screen
• “To Everyone” or “To
all panelists and
attendees”
Support:
https://support.zoom.us/hc/
en-us/articles/206175806-T
op-Questions
Troubleshooting
Use chat
If the issue is not easily resolved,
we ask that you follow along as
we demo the sample app.
👋 Hello GitOps and Flux Users! 👋
Flux users! 😻 Sneak peek to the power
of Flux (v2)!
New users! ⚡ The Power of GitOps
with Flux!
👋 Get Connected 💬 🤝
1. Fluxcd.io
2. Check out the Flux docs at:
https://toolkit.fluxcd.io/get-started/
3. GitHub Discussions Q&A:
https://github.com/fluxcd/flux2/discussi
ons/categories/q-a
4. CNCF Slack #Flux channel
● GitOps is an app dev and operations methodology
● GitOps is a methodology, not a specific tool or
technology.
● GitOps applies to everything
and brings business value.
What is GitOps? … and why do I want it?
GitOps leverages:
● an entire system that is described declaratively
● code that is version controlled and
● software agents that reconcile and ensure correctness
(along with alerts, etc).
4 Principles of GitOps
demo
Notifications, Alerts & Webhooks
*Note we’re not going to be covering them in this order! :)
The Plan
● Why you want notifications with Flux
● Setting up webhook received with Github
● Setting up Discord notifications with Flux
Why?
● When you're looking at the terminal only you know
what’s going on
● Surfacing alerts through messaging apps, and other services
gives your team visibility, and saves you time, as you don't
have to relay as many messages, flux is doing that for you
● Automation is one of the key principles of GitOps, less
manual ops === more time for building cool things
● and that’s why automation is one of the key business values
of gitops
● Read more at gitops.community
tl;dr Flux
● The most powerful tool to get the GitOps experience
● A set of Kubernetes controllers
● GitOps based continuous delivery system
Kubernet get
Create a kubernetes cluster using your tool of choice
I'm using k3ds eks because we're doing some loadbalancey stuff
and I don't really want to expose my dev station to the world
Bootstrap your cluster
1. Export tokens
2. Bootstrap
your cluster
3. Clone the cluster repository, then cd into it
$ export GITHUB_TOKEN=<your-token>
$ export GITHUB_USER=<your-username>
$ export REPO_NAME="woug-demo"
$ flux bootstrap github 
--owner=$GITHUB_USER 
--repository=$REPO_NAME 
--branch=main 
--personal
$ git clone git@github.com:$GITHUB_USER/$REPO_NAME
$ cd naw-example
Creating webhook receiver secret
$ TOKEN=$(head -c 12 /dev/urandom | shasum | cut -d ' ' -f1)
$ echo $TOKEN
$ kubectl -n flux-system create secret generic webhook-token

--from-literal=token=$TOKEN
Create yaml for load balancer
Exposing the webhook receiver
apiVersion: v1
kind: Service
metadata:
name: receiver
namespace: flux-system
spec:
type: LoadBalancer
selector:
app: notification-controller
ports:
- name: http
port: 80
protocol: TCP
targetPort: 9292
Creating the receiver
create the receiver
$ flux create receiver flux-system 
--type github 
--event ping 
--event push 
--secret-ref webhook-token 
--resource GitRepository/flux-system 
--namespace flux-system 
--export > naw-receiver.yaml
# naw-receiver.yaml
apiVersion: notification.toolkit.fluxcd.io/v1beta1
kind: Receiver
metadata:
name: flux-system
namespace: flux-system
spec:
type: github
events:
- "ping"
- "push"
secretRef:
name: webhook-token
resources:
- kind: GitRepository
name: flux-system
It should produce the following:
Commit and push this all
Setup GitHub Webook
● Navigate to your repo's settings, and webhooks
● Create new webhook
● htto://url of loadbalancer , http insecure + path of hook flux
get receiver flux-system /hook
● $echo $TOKEN is the secret
Create a Discord Webhook
● assuming you have already created a discord server, if not
discord.new
● Create a text channel for your alerts
● Select the settings cog on the text channel you want to post
alerts into
● Select Create Webhook
● Give your Webhook a name, Copy the Webhook url, set aside
details for later
● Save changes
Define a provider
Create a secret with the webhook url
Create a notification provider for Discord by referencing the
above secret
$ kubectl -n flux-system create secret generic discord-url 
--from-literal=address=https://discord.com/api/webhooks/YOUR_DISCORD/WEBHOOK
export $D_CHANNEL=""
export $D_BOTUSR=""
$ flux create alert-provider naw-provider 
--type discord 
--secret-ref discord-url 
--channel $D_CHANNEL 
--username $D_BOTUSR 
--export > naw-provider.yaml
Define a provider (cont’d)
it should produce this file
# naw-provider.yaml
apiVersion: notification.toolkit.fluxcd.io/v1beta1
kind: Receiver
metadata:
name: naw-provder
namespace: flux-system
spec:
channel: $D_CHANNEL
secretRef:
name: discord-url
type: discord
username: $D_BOTUSR
Define an alert
Create an alert definition for all repositories and Kustomizations
Yaml output
$ flux create alert naw-alert 
--provider-ref naw-provider 
--event-severity info 
--event-source Kustomization/'*' 
--event-source GitRepository/'*' 
--namespace flux-system 
--export > naw-alert.yaml
# naw-provider.yaml
apiVersion: notification.toolkit.fluxcd.io/v1beta1
kind: Receiver
metadata:
name: naw-provder
namespace: flux-system
spec:
channel: $D_CHANNEL
secretRef:
name: discord-url
type: discord
username: $D_BOTUSR
Deploying the alert definitions to our
cluster
Commit the files to the repository
$ git add naw-alert.yaml
$ git add naw-provider.yaml
$ git commit -sm "Add alert, alert provider for
discord"
$ git push
Checking everything's in order
Use kubectl to get the status of the alert
$ kubectl -n flux-system get alerts
NAME READY STATUS AGE
naw-alert True Initialized 1m
Testing it out
Creating a new deployment
● Create a GitRepository source for podinfo
● Create a Kustomization for podinfo
$ flux create source git podinfo 
--url=https://github.com/stefanprodan/podinfo 
--branch=master 
--interval=30s 
--export > ./podinfo-source.yaml
$ flux create kustomization podinfo 
--source=podinfo 
--path="./kustomize" 
--prune=true 
--validation=client 
--interval=5m 
--export > ./podinfo-kustomization.yaml
Testing it out
● Commit them to git
$ git add podinfo-source.yaml
$ git add podinfo-kustomization.yaml
$ git commit -m "Add podinfo deployment"
$ git push
Testing it out: Creating some failures
● Create a invalid GitRepository source
● Delete source
$ flux create source git nonexist 
--url=https://github.com/alisondy/nonexist 
--branch=main 
--interval=30s 
--export > ./nonexist-source.yaml
$ git add nonexist-source.yaml
$ git commit -m "Add a faulty source"
$ git push
$ git rm nonexist-source.yaml
$ git commit -m "Get rid of the non existent source"
$ git push
What we did
● We setup a webhook receiver using flux
● Configured gitup to send push notifications to it
● We setup flux so it alerted in discord
With those skills you will be able to adopt one of the key gitops
principles we covered earlier...AUTOMATION!
Resources
- Flux Docs (https://fluxcd.io/docs/)
- Setup Notifications (https://fluxcd.io/docs/guides/notifications/)
- Setup Webhook Receivers
(https://fluxcd.io/docs/guides/webhook-receivers/)
- Alison’s Demo Repo (https://github.com/alisondy/flux-demos)
Alison’s slides.md
- YouTube Playlist: The Power of GitOps with Flux v2
(https://youtube.com/playlist?list=PL9lTuCFNLaD3fI_g-NXWVxopnJ0adn65d)
Migrate to Flux v2!
Sign up for our Flux Migration
Workshops!
bit.ly/FluxMigrationSurvey
Upcoming Events
April 28: CNCF Cloud Native Live: Migrating
from Flux v1 to Flux v2 (Leigh Capili)
April 29: Doing GitOps for multicloud resource management
using Crossplane and Flux2 (Leonardo Murillo @ Conf42: Cloud
Native 2021)
May 3: GitOpsCon @ KubeCon EU
June 9-10: GitOps Days 2021
GitOpsDays.com
Next Steps
• Join us on Flux discussions if you have more questions:
https://github.com/fluxcd/flux2/discussions
• Flux Community: https://fluxcd.io/community/
• Join the GitOps Community Group:
https://www.meetup.com/GitOps-Community/
• More info on GitOps? Visit www.gitops.community/
• Join the GitOps Community LinkedIn Group:
https://www.linkedin.com/groups/13914610/
THANK YOU!

Mais conteúdo relacionado

Mais procurados

Mais procurados (20)

Flyway _ A Database Version Management Tool
Flyway _ A Database Version Management ToolFlyway _ A Database Version Management Tool
Flyway _ A Database Version Management Tool
 
Introduction to kubernetes
Introduction to kubernetesIntroduction to kubernetes
Introduction to kubernetes
 
Jenkins
JenkinsJenkins
Jenkins
 
Helm - Application deployment management for Kubernetes
Helm - Application deployment management for KubernetesHelm - Application deployment management for Kubernetes
Helm - Application deployment management for Kubernetes
 
Washington DC MuleSoft Meetup: CI/CD Pipeline with MuleSoft and Azure DevOps
Washington DC MuleSoft Meetup: CI/CD Pipeline with MuleSoft and Azure DevOpsWashington DC MuleSoft Meetup: CI/CD Pipeline with MuleSoft and Azure DevOps
Washington DC MuleSoft Meetup: CI/CD Pipeline with MuleSoft and Azure DevOps
 
Cloud Native Engineering with SRE and GitOps
Cloud Native Engineering with SRE and GitOpsCloud Native Engineering with SRE and GitOps
Cloud Native Engineering with SRE and GitOps
 
Getting started with Docker
Getting started with DockerGetting started with Docker
Getting started with Docker
 
Introduction to Docker
Introduction to DockerIntroduction to Docker
Introduction to Docker
 
Kubernetes Architecture and Introduction
Kubernetes Architecture and IntroductionKubernetes Architecture and Introduction
Kubernetes Architecture and Introduction
 
(Declarative) Jenkins Pipelines
(Declarative) Jenkins Pipelines(Declarative) Jenkins Pipelines
(Declarative) Jenkins Pipelines
 
Kubernetes: A Short Introduction (2019)
Kubernetes: A Short Introduction (2019)Kubernetes: A Short Introduction (2019)
Kubernetes: A Short Introduction (2019)
 
BitBucket presentation
BitBucket presentationBitBucket presentation
BitBucket presentation
 
CI-Jenkins.pptx
CI-Jenkins.pptxCI-Jenkins.pptx
CI-Jenkins.pptx
 
Prometheus + Grafana = Awesome Monitoring
Prometheus + Grafana = Awesome MonitoringPrometheus + Grafana = Awesome Monitoring
Prometheus + Grafana = Awesome Monitoring
 
Docker 101 - from 0 to Docker in 30 minutes
Docker 101 - from 0 to Docker in 30 minutesDocker 101 - from 0 to Docker in 30 minutes
Docker 101 - from 0 to Docker in 30 minutes
 
Monitoring using Prometheus and Grafana
Monitoring using Prometheus and GrafanaMonitoring using Prometheus and Grafana
Monitoring using Prometheus and Grafana
 
Rtf v2 ingress muleSoft meetup self managed kubernetes
Rtf v2 ingress muleSoft meetup self managed kubernetesRtf v2 ingress muleSoft meetup self managed kubernetes
Rtf v2 ingress muleSoft meetup self managed kubernetes
 
Kubernetes
KubernetesKubernetes
Kubernetes
 
Introduction to GitHub Actions
Introduction to GitHub ActionsIntroduction to GitHub Actions
Introduction to GitHub Actions
 
ArgoCD and Tekton: Match made in Kubernetes heaven | DevNation Tech Talk
ArgoCD and Tekton: Match made in Kubernetes heaven | DevNation Tech TalkArgoCD and Tekton: Match made in Kubernetes heaven | DevNation Tech Talk
ArgoCD and Tekton: Match made in Kubernetes heaven | DevNation Tech Talk
 

Semelhante a Setting up Notifications, Alerts & Webhooks with Flux v2 by Alison Dowdney

Life of a Chromium Developer
Life of a Chromium DeveloperLife of a Chromium Developer
Life of a Chromium Developer
mpaproductions
 
Php Inside - confoo 2011 - Derick Rethans
Php Inside -  confoo 2011 - Derick RethansPhp Inside -  confoo 2011 - Derick Rethans
Php Inside - confoo 2011 - Derick Rethans
Bachkoutou Toutou
 

Semelhante a Setting up Notifications, Alerts & Webhooks with Flux v2 by Alison Dowdney (20)

Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)
Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)
Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)
 
Fullstack workshop
Fullstack workshopFullstack workshop
Fullstack workshop
 
Acquia BLT for the Win, or How to speed up the project setup, development an...
Acquia BLT for the Win, or  How to speed up the project setup, development an...Acquia BLT for the Win, or  How to speed up the project setup, development an...
Acquia BLT for the Win, or How to speed up the project setup, development an...
 
Beyond Puppet
Beyond PuppetBeyond Puppet
Beyond Puppet
 
Dependencies Managers in C/C++. Using stdcpp 2014
Dependencies Managers in C/C++. Using stdcpp 2014Dependencies Managers in C/C++. Using stdcpp 2014
Dependencies Managers in C/C++. Using stdcpp 2014
 
Deploying TYPO3 Neos websites using Surf
Deploying TYPO3 Neos websites using SurfDeploying TYPO3 Neos websites using Surf
Deploying TYPO3 Neos websites using Surf
 
CI/CD with Jenkins and Docker - DevOps Meetup Day Thailand
CI/CD with Jenkins and Docker - DevOps Meetup Day ThailandCI/CD with Jenkins and Docker - DevOps Meetup Day Thailand
CI/CD with Jenkins and Docker - DevOps Meetup Day Thailand
 
Os dev tool box
Os dev tool boxOs dev tool box
Os dev tool box
 
DevOPS training - Day 2/2
DevOPS training - Day 2/2DevOPS training - Day 2/2
DevOPS training - Day 2/2
 
Kubernetes laravel and kubernetes
Kubernetes   laravel and kubernetesKubernetes   laravel and kubernetes
Kubernetes laravel and kubernetes
 
Life of a Chromium Developer
Life of a Chromium DeveloperLife of a Chromium Developer
Life of a Chromium Developer
 
One-Man Ops
One-Man OpsOne-Man Ops
One-Man Ops
 
.Git for WordPress Developers
.Git for WordPress Developers.Git for WordPress Developers
.Git for WordPress Developers
 
[EXTENDED] Ceph, Docker, Heroku Slugs, CoreOS and Deis Overview
[EXTENDED] Ceph, Docker, Heroku Slugs, CoreOS and Deis Overview[EXTENDED] Ceph, Docker, Heroku Slugs, CoreOS and Deis Overview
[EXTENDED] Ceph, Docker, Heroku Slugs, CoreOS and Deis Overview
 
Package a PyApp as a Flatpak Package: An HTTP Server for Example @ PyCon APAC...
Package a PyApp as a Flatpak Package: An HTTP Server for Example @ PyCon APAC...Package a PyApp as a Flatpak Package: An HTTP Server for Example @ PyCon APAC...
Package a PyApp as a Flatpak Package: An HTTP Server for Example @ PyCon APAC...
 
Php Inside - confoo 2011 - Derick Rethans
Php Inside -  confoo 2011 - Derick RethansPhp Inside -  confoo 2011 - Derick Rethans
Php Inside - confoo 2011 - Derick Rethans
 
Capistrano deploy Magento project in an efficient way
Capistrano deploy Magento project in an efficient wayCapistrano deploy Magento project in an efficient way
Capistrano deploy Magento project in an efficient way
 
Lean Drupal Repositories with Composer and Drush
Lean Drupal Repositories with Composer and DrushLean Drupal Repositories with Composer and Drush
Lean Drupal Repositories with Composer and Drush
 
Buildout: creating and deploying repeatable applications in python
Buildout: creating and deploying repeatable applications in pythonBuildout: creating and deploying repeatable applications in python
Buildout: creating and deploying repeatable applications in python
 
Cloud Native Okteto Cloud
Cloud Native Okteto Cloud Cloud Native Okteto Cloud
Cloud Native Okteto Cloud
 

Mais de Weaveworks

SRE and GitOps for Building Robust Kubernetes Platforms.pdf
SRE and GitOps for Building Robust Kubernetes Platforms.pdfSRE and GitOps for Building Robust Kubernetes Platforms.pdf
SRE and GitOps for Building Robust Kubernetes Platforms.pdf
Weaveworks
 
How to Avoid Kubernetes Multi-tenancy Catastrophes
How to Avoid Kubernetes Multi-tenancy CatastrophesHow to Avoid Kubernetes Multi-tenancy Catastrophes
How to Avoid Kubernetes Multi-tenancy Catastrophes
Weaveworks
 

Mais de Weaveworks (20)

Weave AI Controllers (Weave GitOps Office Hours)
Weave AI Controllers (Weave GitOps Office Hours)Weave AI Controllers (Weave GitOps Office Hours)
Weave AI Controllers (Weave GitOps Office Hours)
 
Flamingo: Expand ArgoCD with Flux (Office Hours)
Flamingo: Expand ArgoCD with Flux (Office Hours)Flamingo: Expand ArgoCD with Flux (Office Hours)
Flamingo: Expand ArgoCD with Flux (Office Hours)
 
Webinar: Capabilities, Confidence and Community – What Flux GA Means for You
Webinar: Capabilities, Confidence and Community – What Flux GA Means for YouWebinar: Capabilities, Confidence and Community – What Flux GA Means for You
Webinar: Capabilities, Confidence and Community – What Flux GA Means for You
 
Six Signs You Need Platform Engineering
Six Signs You Need Platform EngineeringSix Signs You Need Platform Engineering
Six Signs You Need Platform Engineering
 
SRE and GitOps for Building Robust Kubernetes Platforms.pdf
SRE and GitOps for Building Robust Kubernetes Platforms.pdfSRE and GitOps for Building Robust Kubernetes Platforms.pdf
SRE and GitOps for Building Robust Kubernetes Platforms.pdf
 
Webinar: End to End Security & Operations with Chainguard and Weave GitOps
Webinar: End to End Security & Operations with Chainguard and Weave GitOpsWebinar: End to End Security & Operations with Chainguard and Weave GitOps
Webinar: End to End Security & Operations with Chainguard and Weave GitOps
 
Flux Beyond Git Harnessing the Power of OCI
Flux Beyond Git Harnessing the Power of OCIFlux Beyond Git Harnessing the Power of OCI
Flux Beyond Git Harnessing the Power of OCI
 
Automated Provisioning, Management & Cost Control for Kubernetes Clusters
Automated Provisioning, Management & Cost Control for Kubernetes ClustersAutomated Provisioning, Management & Cost Control for Kubernetes Clusters
Automated Provisioning, Management & Cost Control for Kubernetes Clusters
 
How to Avoid Kubernetes Multi-tenancy Catastrophes
How to Avoid Kubernetes Multi-tenancy CatastrophesHow to Avoid Kubernetes Multi-tenancy Catastrophes
How to Avoid Kubernetes Multi-tenancy Catastrophes
 
Building internal developer platform with EKS and GitOps
Building internal developer platform with EKS and GitOpsBuilding internal developer platform with EKS and GitOps
Building internal developer platform with EKS and GitOps
 
GitOps Testing in Kubernetes with Flux and Testkube.pdf
GitOps Testing in Kubernetes with Flux and Testkube.pdfGitOps Testing in Kubernetes with Flux and Testkube.pdf
GitOps Testing in Kubernetes with Flux and Testkube.pdf
 
Intro to GitOps with Weave GitOps, Flagger and Linkerd
Intro to GitOps with Weave GitOps, Flagger and LinkerdIntro to GitOps with Weave GitOps, Flagger and Linkerd
Intro to GitOps with Weave GitOps, Flagger and Linkerd
 
Implementing Flux for Scale with Soft Multi-tenancy
Implementing Flux for Scale with Soft Multi-tenancyImplementing Flux for Scale with Soft Multi-tenancy
Implementing Flux for Scale with Soft Multi-tenancy
 
Accelerating Hybrid Multistage Delivery with Weave GitOps on EKS
Accelerating Hybrid Multistage Delivery with Weave GitOps on EKSAccelerating Hybrid Multistage Delivery with Weave GitOps on EKS
Accelerating Hybrid Multistage Delivery with Weave GitOps on EKS
 
The Story of Flux Reaching Graduation in the CNCF
The Story of Flux Reaching Graduation in the CNCFThe Story of Flux Reaching Graduation in the CNCF
The Story of Flux Reaching Graduation in the CNCF
 
Shift Deployment Security Left with Weave GitOps & Upbound’s Universal Crossp...
Shift Deployment Security Left with Weave GitOps & Upbound’s Universal Crossp...Shift Deployment Security Left with Weave GitOps & Upbound’s Universal Crossp...
Shift Deployment Security Left with Weave GitOps & Upbound’s Universal Crossp...
 
Securing Your App Deployments with Tunnels, OIDC, RBAC, and Progressive Deliv...
Securing Your App Deployments with Tunnels, OIDC, RBAC, and Progressive Deliv...Securing Your App Deployments with Tunnels, OIDC, RBAC, and Progressive Deliv...
Securing Your App Deployments with Tunnels, OIDC, RBAC, and Progressive Deliv...
 
Flux’s Security & Scalability with OCI & Helm Slides.pdf
Flux’s Security & Scalability with OCI & Helm Slides.pdfFlux’s Security & Scalability with OCI & Helm Slides.pdf
Flux’s Security & Scalability with OCI & Helm Slides.pdf
 
Flux Security & Scalability using VS Code GitOps Extension
Flux Security & Scalability using VS Code GitOps Extension Flux Security & Scalability using VS Code GitOps Extension
Flux Security & Scalability using VS Code GitOps Extension
 
Deploying Stateful Applications Securely & Confidently with Ondat & Weave GitOps
Deploying Stateful Applications Securely & Confidently with Ondat & Weave GitOpsDeploying Stateful Applications Securely & Confidently with Ondat & Weave GitOps
Deploying Stateful Applications Securely & Confidently with Ondat & Weave GitOps
 

Último

Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 

Último (20)

AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
JohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptxJohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptx
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 

Setting up Notifications, Alerts & Webhooks with Flux v2 by Alison Dowdney

  • 1. Setting up Notifications, Alerts & Webhooks with Flux Alison Dowdney, Developer Advocate, Weaveworks Stacey Potter, Community Manager, Weaveworks
  • 2. Weaveworks is founded on open source ● Flux (& GitOps Toolkit) (CNCF): GitOps for k8s ● Flagger (CNCF): Declarative Progressive Delivery for Service Meshes ● Cortex (CNCF): Distributed, Long-term-storage TSDB compatible with Prometheus ● Weave Ignite: VMs with container UX & built-in GitOps management ● EKSctl: Create an Amazon EKS cluster with one command ● (and many many more projects!) weave.works
  • 3. Setting up Notifications, Alerts, & Webhooks w/ Flux Speakers Help/Support Duration 30-45 Minutes Alison Dowdney DX Engineer Weaveworks Stacey Potter Community Mgr Weaveworks Browser Safari copy/paste shortcuts may not work Using Zoom Questions? • Use chat (button: top left corner of screen) • Escape to exit full screen • “To Everyone” or “To all panelists and attendees” Support: https://support.zoom.us/hc/ en-us/articles/206175806-T op-Questions Troubleshooting Use chat If the issue is not easily resolved, we ask that you follow along as we demo the sample app.
  • 4. 👋 Hello GitOps and Flux Users! 👋 Flux users! 😻 Sneak peek to the power of Flux (v2)! New users! ⚡ The Power of GitOps with Flux!
  • 5. 👋 Get Connected 💬 🤝 1. Fluxcd.io 2. Check out the Flux docs at: https://toolkit.fluxcd.io/get-started/ 3. GitHub Discussions Q&A: https://github.com/fluxcd/flux2/discussi ons/categories/q-a 4. CNCF Slack #Flux channel
  • 6. ● GitOps is an app dev and operations methodology ● GitOps is a methodology, not a specific tool or technology. ● GitOps applies to everything and brings business value. What is GitOps? … and why do I want it?
  • 7. GitOps leverages: ● an entire system that is described declaratively ● code that is version controlled and ● software agents that reconcile and ensure correctness (along with alerts, etc). 4 Principles of GitOps
  • 9. Notifications, Alerts & Webhooks *Note we’re not going to be covering them in this order! :) The Plan ● Why you want notifications with Flux ● Setting up webhook received with Github ● Setting up Discord notifications with Flux
  • 10. Why? ● When you're looking at the terminal only you know what’s going on ● Surfacing alerts through messaging apps, and other services gives your team visibility, and saves you time, as you don't have to relay as many messages, flux is doing that for you ● Automation is one of the key principles of GitOps, less manual ops === more time for building cool things ● and that’s why automation is one of the key business values of gitops ● Read more at gitops.community
  • 11. tl;dr Flux ● The most powerful tool to get the GitOps experience ● A set of Kubernetes controllers ● GitOps based continuous delivery system
  • 12. Kubernet get Create a kubernetes cluster using your tool of choice I'm using k3ds eks because we're doing some loadbalancey stuff and I don't really want to expose my dev station to the world
  • 13. Bootstrap your cluster 1. Export tokens 2. Bootstrap your cluster 3. Clone the cluster repository, then cd into it $ export GITHUB_TOKEN=<your-token> $ export GITHUB_USER=<your-username> $ export REPO_NAME="woug-demo" $ flux bootstrap github --owner=$GITHUB_USER --repository=$REPO_NAME --branch=main --personal $ git clone git@github.com:$GITHUB_USER/$REPO_NAME $ cd naw-example
  • 14. Creating webhook receiver secret $ TOKEN=$(head -c 12 /dev/urandom | shasum | cut -d ' ' -f1) $ echo $TOKEN $ kubectl -n flux-system create secret generic webhook-token --from-literal=token=$TOKEN
  • 15. Create yaml for load balancer Exposing the webhook receiver apiVersion: v1 kind: Service metadata: name: receiver namespace: flux-system spec: type: LoadBalancer selector: app: notification-controller ports: - name: http port: 80 protocol: TCP targetPort: 9292
  • 16. Creating the receiver create the receiver $ flux create receiver flux-system --type github --event ping --event push --secret-ref webhook-token --resource GitRepository/flux-system --namespace flux-system --export > naw-receiver.yaml # naw-receiver.yaml apiVersion: notification.toolkit.fluxcd.io/v1beta1 kind: Receiver metadata: name: flux-system namespace: flux-system spec: type: github events: - "ping" - "push" secretRef: name: webhook-token resources: - kind: GitRepository name: flux-system It should produce the following: Commit and push this all
  • 17. Setup GitHub Webook ● Navigate to your repo's settings, and webhooks ● Create new webhook ● htto://url of loadbalancer , http insecure + path of hook flux get receiver flux-system /hook ● $echo $TOKEN is the secret
  • 18. Create a Discord Webhook ● assuming you have already created a discord server, if not discord.new ● Create a text channel for your alerts ● Select the settings cog on the text channel you want to post alerts into ● Select Create Webhook ● Give your Webhook a name, Copy the Webhook url, set aside details for later ● Save changes
  • 19. Define a provider Create a secret with the webhook url Create a notification provider for Discord by referencing the above secret $ kubectl -n flux-system create secret generic discord-url --from-literal=address=https://discord.com/api/webhooks/YOUR_DISCORD/WEBHOOK export $D_CHANNEL="" export $D_BOTUSR="" $ flux create alert-provider naw-provider --type discord --secret-ref discord-url --channel $D_CHANNEL --username $D_BOTUSR --export > naw-provider.yaml
  • 20. Define a provider (cont’d) it should produce this file # naw-provider.yaml apiVersion: notification.toolkit.fluxcd.io/v1beta1 kind: Receiver metadata: name: naw-provder namespace: flux-system spec: channel: $D_CHANNEL secretRef: name: discord-url type: discord username: $D_BOTUSR
  • 21. Define an alert Create an alert definition for all repositories and Kustomizations Yaml output $ flux create alert naw-alert --provider-ref naw-provider --event-severity info --event-source Kustomization/'*' --event-source GitRepository/'*' --namespace flux-system --export > naw-alert.yaml # naw-provider.yaml apiVersion: notification.toolkit.fluxcd.io/v1beta1 kind: Receiver metadata: name: naw-provder namespace: flux-system spec: channel: $D_CHANNEL secretRef: name: discord-url type: discord username: $D_BOTUSR
  • 22. Deploying the alert definitions to our cluster Commit the files to the repository $ git add naw-alert.yaml $ git add naw-provider.yaml $ git commit -sm "Add alert, alert provider for discord" $ git push
  • 23. Checking everything's in order Use kubectl to get the status of the alert $ kubectl -n flux-system get alerts NAME READY STATUS AGE naw-alert True Initialized 1m
  • 24. Testing it out Creating a new deployment ● Create a GitRepository source for podinfo ● Create a Kustomization for podinfo $ flux create source git podinfo --url=https://github.com/stefanprodan/podinfo --branch=master --interval=30s --export > ./podinfo-source.yaml $ flux create kustomization podinfo --source=podinfo --path="./kustomize" --prune=true --validation=client --interval=5m --export > ./podinfo-kustomization.yaml
  • 25. Testing it out ● Commit them to git $ git add podinfo-source.yaml $ git add podinfo-kustomization.yaml $ git commit -m "Add podinfo deployment" $ git push
  • 26. Testing it out: Creating some failures ● Create a invalid GitRepository source ● Delete source $ flux create source git nonexist --url=https://github.com/alisondy/nonexist --branch=main --interval=30s --export > ./nonexist-source.yaml $ git add nonexist-source.yaml $ git commit -m "Add a faulty source" $ git push $ git rm nonexist-source.yaml $ git commit -m "Get rid of the non existent source" $ git push
  • 27. What we did ● We setup a webhook receiver using flux ● Configured gitup to send push notifications to it ● We setup flux so it alerted in discord With those skills you will be able to adopt one of the key gitops principles we covered earlier...AUTOMATION!
  • 28. Resources - Flux Docs (https://fluxcd.io/docs/) - Setup Notifications (https://fluxcd.io/docs/guides/notifications/) - Setup Webhook Receivers (https://fluxcd.io/docs/guides/webhook-receivers/) - Alison’s Demo Repo (https://github.com/alisondy/flux-demos) Alison’s slides.md - YouTube Playlist: The Power of GitOps with Flux v2 (https://youtube.com/playlist?list=PL9lTuCFNLaD3fI_g-NXWVxopnJ0adn65d)
  • 29. Migrate to Flux v2! Sign up for our Flux Migration Workshops! bit.ly/FluxMigrationSurvey
  • 30. Upcoming Events April 28: CNCF Cloud Native Live: Migrating from Flux v1 to Flux v2 (Leigh Capili) April 29: Doing GitOps for multicloud resource management using Crossplane and Flux2 (Leonardo Murillo @ Conf42: Cloud Native 2021) May 3: GitOpsCon @ KubeCon EU June 9-10: GitOps Days 2021 GitOpsDays.com
  • 31. Next Steps • Join us on Flux discussions if you have more questions: https://github.com/fluxcd/flux2/discussions • Flux Community: https://fluxcd.io/community/ • Join the GitOps Community Group: https://www.meetup.com/GitOps-Community/ • More info on GitOps? Visit www.gitops.community/ • Join the GitOps Community LinkedIn Group: https://www.linkedin.com/groups/13914610/