| 
									
										
										
										
											2019-08-30 15:58:25 +01:00
										 |  |  | .\" Generated by Mmark Markdown Processer - mmark.miek.nl | 
					
						
							| 
									
										
										
										
											2020-03-31 14:18:39 +00:00
										 |  |  | .TH "COREDNS-HEALTH" 7 "March 2020" "CoreDNS" "CoreDNS Plugins" | 
					
						
							| 
									
										
										
										
											2019-04-06 08:42:40 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-21 22:38:40 +01:00
										 |  |  | .SH "NAME" | 
					
						
							| 
									
										
										
										
											2019-04-06 08:42:40 +01:00
										 |  |  | .PP | 
					
						
							|  |  |  | \fIhealth\fP - enables a health check endpoint. | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-21 22:38:40 +01:00
										 |  |  | .SH "DESCRIPTION" | 
					
						
							| 
									
										
										
										
											2019-04-06 08:42:40 +01:00
										 |  |  | .PP | 
					
						
							| 
									
										
										
										
											2019-06-24 12:37:27 +01:00
										 |  |  | Enabled process wide health endpoint. When CoreDNS is up and running this returns a 200 OK HTTP | 
					
						
							| 
									
										
										
										
											2019-12-29 13:35:17 +01:00
										 |  |  | status code. The health is exported, by default, on port 8080/health. | 
					
						
							| 
									
										
										
										
											2018-01-04 12:53:07 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-21 22:38:40 +01:00
										 |  |  | .SH "SYNTAX" | 
					
						
							| 
									
										
										
										
											2019-04-06 08:42:40 +01:00
										 |  |  | .PP | 
					
						
							|  |  |  | .RS | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | .nf | 
					
						
							| 
									
										
										
										
											2018-01-04 12:53:07 +00:00
										 |  |  | health [ADDRESS] | 
					
						
							| 
									
										
										
										
											2019-04-06 08:42:40 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-04 12:53:07 +00:00
										 |  |  | .fi | 
					
						
							| 
									
										
										
										
											2019-04-06 08:42:40 +01:00
										 |  |  | .RE | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | .PP | 
					
						
							|  |  |  | Optionally takes an address; the default is \fB\fC:8080\fR. The health path is fixed to \fB\fC/health\fR. The | 
					
						
							|  |  |  | health endpoint returns a 200 response code and the word "OK" when this server is healthy. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | .PP | 
					
						
							| 
									
										
										
										
											2019-03-30 13:56:52 +00:00
										 |  |  | An extra option can be set with this extended syntax: | 
					
						
							| 
									
										
										
										
											2018-01-25 21:59:08 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-06 08:42:40 +01:00
										 |  |  | .PP | 
					
						
							|  |  |  | .RS | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | .nf | 
					
						
							| 
									
										
										
										
											2018-01-25 21:59:08 +00:00
										 |  |  | health [ADDRESS] { | 
					
						
							|  |  |  |     lameduck DURATION | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2019-04-06 08:42:40 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-25 21:59:08 +00:00
										 |  |  | .fi | 
					
						
							| 
									
										
										
										
											2019-04-06 08:42:40 +01:00
										 |  |  | .RE | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | .IP \(bu 4 | 
					
						
							|  |  |  | Where \fB\fClameduck\fR will make the process unhealthy then \fIwait\fP for \fBDURATION\fP before the process | 
					
						
							|  |  |  | shuts down. | 
					
						
							| 
									
										
										
										
											2018-03-05 19:58:28 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-06 08:42:40 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | .PP | 
					
						
							| 
									
										
										
										
											2019-04-21 22:38:40 +01:00
										 |  |  | If you have multiple Server Blocks, \fIhealth\fP can only be enabled in one of them (as it is process | 
					
						
							| 
									
										
										
										
											2019-04-06 08:42:40 +01:00
										 |  |  | wide). If you really need multiple endpoints, you must run health endpoints on different ports: | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | .PP | 
					
						
							|  |  |  | .RS | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | .nf | 
					
						
							| 
									
										
										
										
											2018-03-05 19:58:28 +00:00
										 |  |  | com { | 
					
						
							|  |  |  |     whoami | 
					
						
							|  |  |  |     health :8080 | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | net { | 
					
						
							|  |  |  |     erratic | 
					
						
							|  |  |  |     health :8081 | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2019-04-06 08:42:40 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-03-05 19:58:28 +00:00
										 |  |  | .fi | 
					
						
							| 
									
										
										
										
											2019-04-06 08:42:40 +01:00
										 |  |  | .RE | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-21 22:38:40 +01:00
										 |  |  | .PP | 
					
						
							| 
									
										
										
										
											2019-08-30 15:58:25 +01:00
										 |  |  | Doing this is supported but both endpoints ":8080" and ":8081" will export the exact same health. | 
					
						
							| 
									
										
										
										
											2019-04-21 22:38:40 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | .SH "METRICS" | 
					
						
							| 
									
										
										
										
											2019-04-06 08:42:40 +01:00
										 |  |  | .PP | 
					
						
							| 
									
										
										
										
											2019-10-10 07:45:28 +01:00
										 |  |  | If monitoring is enabled (via the \fIprometheus\fP plugin) then the following metric is exported: | 
					
						
							| 
									
										
										
										
											2019-04-06 08:42:40 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | .IP \(bu 4 | 
					
						
							| 
									
										
										
										
											2019-04-21 22:38:40 +01:00
										 |  |  | \fB\fCcoredns_health_request_duration_seconds{}\fR - duration to process a HTTP query to the local | 
					
						
							|  |  |  | \fB\fC/health\fR endpoint. As this a local operation it should be fast. A (large) increase in this | 
					
						
							|  |  |  | duration indicates the CoreDNS process is having trouble keeping up with its query load. | 
					
						
							| 
									
										
										
										
											2019-04-06 08:42:40 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-04 12:53:07 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-06 08:42:40 +01:00
										 |  |  | .PP | 
					
						
							|  |  |  | Note that this metric \fIdoes not\fP have a \fB\fCserver\fR label, because being overloaded is a symptom of | 
					
						
							|  |  |  | the running process, \fInot\fP a specific server. | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-21 22:38:40 +01:00
										 |  |  | .SH "EXAMPLES" | 
					
						
							| 
									
										
										
										
											2019-04-06 08:42:40 +01:00
										 |  |  | .PP | 
					
						
							|  |  |  | Run another health endpoint on http://localhost:8091 | 
					
						
							|  |  |  | \[la]http://localhost:8091\[ra]. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | .PP | 
					
						
							|  |  |  | .RS | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | .nf | 
					
						
							|  |  |  | \&. { | 
					
						
							| 
									
										
										
										
											2018-01-04 12:53:07 +00:00
										 |  |  |     health localhost:8091 | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2019-04-06 08:42:40 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-04 12:53:07 +00:00
										 |  |  | .fi | 
					
						
							| 
									
										
										
										
											2019-04-06 08:42:40 +01:00
										 |  |  | .RE | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | .PP | 
					
						
							| 
									
										
										
										
											2018-01-25 21:59:08 +00:00
										 |  |  | Set a lameduck duration of 1 second: | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-06 08:42:40 +01:00
										 |  |  | .PP | 
					
						
							|  |  |  | .RS | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | .nf | 
					
						
							|  |  |  | \&. { | 
					
						
							| 
									
										
										
										
											2018-03-05 19:58:28 +00:00
										 |  |  |     health localhost:8092 { | 
					
						
							| 
									
										
										
										
											2018-01-25 21:59:08 +00:00
										 |  |  |         lameduck 1s | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2019-04-06 08:42:40 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-25 21:59:08 +00:00
										 |  |  | .fi | 
					
						
							| 
									
										
										
										
											2019-04-06 08:42:40 +01:00
										 |  |  | .RE | 
					
						
							|  |  |  | 
 |