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-To → Portal → AKS-cluster → click on Alert → create new alert
Selected the signal type as metrics and signal name as "Number of pods by phase"
In the condition page I have given the required fields
Used the dimensions to monitor the specific time series
To check alerts I have mentioned the look back period for 1 hour
I have enabled the recommended alert rules to send to email and click on review and create
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
I have reached the 10 pending pods so I got the new alert with fired state
Below is my newly created alert for the pod state pending