HealthCheck
Cloudders Health Check operator supports custom resource definition called HealthCheck
.
Its used to create uptime/health checks against external and internal services.
The current supported protocol is only HTTP(S). More will come with future releasases.
Example HTTP health check
In the below example we will create a simple HealthCheck
that searches for a string
on this documentation page:
kubectl apply -f - <<EOF
apiVersion: check.cloudders.com/v1alpha1
kind: HealthCheck
metadata:
name: cloudders-docs-configuration
spec:
testInterval: 60
http:
url: "https://cloudders.com/docs/configuration/notificationrule"
searchFor:
string: "on this documentation page"
EOF
Example TCP health check
In the below example we will create a simple HealthCheck
that probes TCP service on port 8080:
kubectl apply -f - <<EOF
apiVersion: check.cloudders.com/v1alpha1
kind: HealthCheck
metadata:
name: service-8080
spec:
testInterval: 60
tcp:
ipv4: "127.0.0.1"
port: 8080
EOF
After the HealthCheck
is applied with kubectl
we can see the results with the following command:
kubectl get healthchecks
And the command will print the current running HealthCheck
resources in the namespace:
NAMESPACE NAME URL TEST INTERVAL LAST CHECKED HEALTHY RESPONSE TIME SEARCH TYPE SEARCH FOR
cloudders cloudders-docs-configuration https://cloudders.com/docs/configuration/notificationrule 60 2023-07-14T07:14:46Z true 234ms string on this documentation page
The HealthCheck
also supports SSL
certificate expiration monitoring when used against https
targets. Check the Fields section for configuration details.
Fields
Below is a table of all fields supported by the HealthCheck
CRD under spec:
Field name | Type | Example | Description |
---|---|---|---|
http/tcp | Section | http: or tcp: | Type of the HealthCheck which we are creating. The CRD supports TCP and HTTP health checks with the relevant fields. |
url: | String for http: | https://cloudders.com | Destination URL against which we run our HealthCheck . It supports http and https schema for now. You can use external and internal URLs like the one in the example, or like for internally exposed Kubernetes service: http://my-microservice.my-awesome-product:8080 |
testInterval: | Integer | 60 | Value in seconds. testIntervals lower than 30 seconds can cause the HealthCheck to be rate limited from the destination service. |
sslCheck: | Section for http: | Under this Section we set our search expiration value in days | |
expiration: | Integer for http: | 10 | Monitor for SSL certificate expiration in days |
searchFor: | Section for http: | Under this Section we set our search expressions or strings | |
string: | String for http: | operator | Simple string value which we search for in the response body |
expression: | String for http: | \w{1}perato\w{1} | Fully compatible PCRE regular expression for matching output in the response body |
ipv4: | String for tcp: | 127.0.0.1 or FQDN | Your IPv4 address or FQDN hostname. |
port: | Integer | 8080 | Port which we are going to probe against. It should be not open and not filtered. |