Home > Software engineering >  Alert for aks pedning pods with azure monitor
Alert for aks pedning pods with azure monitor

Time:12-01

I need to set an alert for pending pods in aks with azure monitor. If the pending pod count reaches 10 for a duration of 1hr an alert should be triggered. I have tried some ways but not able to get through.

CodePudding user response:

I tried to create the alert rules for the pod state is pending

I have followed the below steps to create the alert rules

Have the AKS cluster and in that cluster I have created the alert rules as shown below

Go-ToPortalAKS-cluster → click on Alertcreate new alert

Selected the signal type as metrics and signal name as "Number of pods by phase"

enter image description here

In the condition page I have given the required fields

enter image description here

Used the dimensions to monitor the specific time series

enter image description here

To check alerts I have mentioned the look back period for 1 hour

enter image description here

I have enabled the recommended alert rules to send to email and click on review and create

enter image description here

I have created the example pod with pending state as shown below

apiVersion: v1
kind: Pod
metadata:
  name: nodepod
  labels: 
    name: nodepod
spec:
  restartpolicy: Never
  containers:
  - name: nodepod
    image: alpine
    resources:
      limits:
        memory: "128Mi"
        cpu: "500m"
    ports:
      - containerPort: 8080
  nodeSelector:
    memoryOptimised: "yes" 

Created the 10 pods and all my pods are in pending state

enter image description here

I have reached the 10 pending pods so I got the new alert with fired state

enter image description here

Below is my newly created alert for the pod state pending

enter image description here

  • Related