Skip to main content

Canary

The Canary CRD allows you to define health checks for monitoring the availability and performance of your services and infrastructure.

Definition

apiVersion: canaries.flanksource.com/v1
kind: Canary
metadata:
name: example-canary
spec:
# Schedule on which to execute the canary
interval: 30s

# Specify the number of replicas for this canary
replicas: 1

# Checks to run for this canary
http:
- name: example-http-check
url: https://example.com

dns:
- name: example-dns-check
server: 8.8.8.8
query: example.com
querytype: A

Schema

The Canary resource supports the following top-level fields:

FieldDescription
spec.intervalThe schedule on which to execute the canary checks
spec.replicasThe number of replicas for this canary
spec.cloudwatchAWS CloudWatch checks
spec.containerdPullContainerd image pull checks
spec.containerdPushContainerd image push checks
spec.dnsDNS resolution checks
spec.dockerPullDocker image pull checks
spec.dockerPushDocker image push checks
spec.elasticsearchElasticsearch health and query checks
spec.execCommand execution checks
spec.folderFile system and folder checks
spec.gitGit repository checks
spec.githubGitHub actions and repository checks
spec.helmHelm chart checks
spec.httpHTTP endpoint checks
spec.icmpICMP/Ping checks
spec.jmeterJMeter performance tests
spec.junitJUnit test checks
spec.kubernetesKubernetes resource checks
spec.ldapLDAP connectivity checks
spec.mongodbMongoDB health and query checks
spec.mssqlMicrosoft SQL Server checks
spec.mysqlMySQL database checks
spec.postgresPostgreSQL database checks
spec.redisRedis health checks
spec.resticRestic backup checks
spec.s3S3 bucket checks
spec.tcpTCP connection checks
spec.webhookWebhook checks

Status

The Canary controller updates the resource with status information, including:

Status FieldDescription
status.lastCheckThe time of the last check
status.statusThe overall status of the canary (Healthy, Unhealthy)
status.messageA descriptive message about the current status
status.errorMessageDetailed error message when checks fail
status.uptime1hAvailability percentage over the last hour
status.latency1hAverage response time over the last hour
status.lastTransitionedTimeThe time when the status last changed

Example

Basic HTTP Check

apiVersion: canaries.flanksource.com/v1
kind: Canary
metadata:
name: website-check
spec:
interval: 1m
http:
- name: website
url: https://example.com
thresholdMillis: 500
responseCodes: [200]
responseContent: "Welcome"
maxSSLExpiry: 7d

DNS Check

apiVersion: canaries.flanksource.com/v1
kind: Canary
metadata:
name: dns-check
spec:
interval: 2m
dns:
- name: google-dns
server: 8.8.8.8:53
query: google.com
querytype: A
minrecords: 1

Multiple Check Types

apiVersion: canaries.flanksource.com/v1
kind: Canary
metadata:
name: multi-check
spec:
interval: 5m
http:
- name: api-check
url: https://api.example.com/health
thresholdMillis: 200
tcp:
- name: database-connection
host: db.example.com
port: 5432
icmp:
- name: network-check
endpoint: 192.168.1.1

See Also