2016-06-06 12:49:53 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								# kubernetes
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-01-04 12:53:07 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								## Name
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-09-08 00:23:54 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								*kubernetes* - enables reading zone data from a Kubernetes cluster.
							 
						 
					
						
							
								
									
										
										
										
											2018-01-04 12:53:07 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								## Description
  
						 
					
						
							
								
									
										
										
										
											2017-09-15 22:27:55 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-11-27 11:28:20 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								This plugin implements the [Kubernetes DNS-Based Service Discovery
							 
						 
					
						
							
								
									
										
										
										
											2017-08-08 05:05:34 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								Specification](https://github.com/kubernetes/dns/blob/master/docs/specification.md).
							 
						 
					
						
							
								
									
										
										
										
											2016-06-06 12:49:53 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-11-27 11:28:20 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								CoreDNS running the kubernetes plugin can be used as a replacement for kube-dns in a kubernetes
							 
						 
					
						
							
								
									
										
										
										
											2017-08-08 05:05:34 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								cluster.  See the [deployment ](https://github.com/coredns/deployment ) repository for details on [how
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								to deploy CoreDNS in Kubernetes](https://github.com/coredns/deployment/tree/master/kubernetes).
							 
						 
					
						
							
								
									
										
										
										
											2016-10-10 20:13:22 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-02-25 09:17:52 +07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								[stubDomains and upstreamNameservers ](https://kubernetes.io/blog/2017/04/configuring-private-dns-zones-upstream-nameservers-kubernetes/ )
							 
						 
					
						
							
								
									
										
										
										
											2019-07-02 16:23:47 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								are implemented via the * forward *  plugin. See the examples below.
							 
						 
					
						
							
								
									
										
										
										
											2017-09-07 10:48:26 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-02-28 18:16:05 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								This plugin can only be used once per Server Block.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-07-01 03:20:21 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								## Syntax
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-08-11 12:50:12 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								~~~
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								kubernetes [ZONES...]
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								~~~
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-10-08 10:20:48 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								With only the plugin specified, the * kubernetes *  plugin will default to the zone specified in
							 
						 
					
						
							
								
									
										
										
										
											2017-08-11 12:50:12 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								the server's block. It will handle all queries in that zone and connect to Kubernetes in-cluster. It
							 
						 
					
						
							
								
									
										
										
										
											2018-11-27 11:28:20 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								will not provide PTR records for services or A records for pods. If **ZONES **  is used it specifies
							 
						 
					
						
							
								
									
										
										
										
											2017-09-14 09:36:06 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								all the zones the plugin should be authoritative for.
							 
						 
					
						
							
								
									
										
										
										
											2017-08-11 12:50:12 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-07-01 03:20:21 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								```
							 
						 
					
						
							
								
									
										
										
										
											2017-08-11 12:50:12 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								kubernetes [ZONES...] {
							 
						 
					
						
							
								
									
										
										
										
											2019-01-13 10:09:51 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    endpoint URL
							 
						 
					
						
							
								
									
										
										
										
											2017-08-14 08:49:26 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    tls CERT KEY CACERT
							 
						 
					
						
							
								
									
										
										
										
											2018-10-30 16:23:40 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    kubeconfig KUBECONFIG CONTEXT
							 
						 
					
						
							
								
									
										
										
										
											2017-08-22 14:56:00 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    namespaces NAMESPACE...
							 
						 
					
						
							
								
									
										
										
										
											2017-08-14 08:49:26 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    labels EXPRESSION
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    pods POD-MODE
							 
						 
					
						
							
								
									
										
										
										
											2017-11-08 08:07:10 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    endpoint_pod_names
							 
						 
					
						
							
								
									
										
										
										
											2017-08-27 01:32:46 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    ttl TTL
							 
						 
					
						
							
								
									
										
										
										
											2018-11-08 20:38:47 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    noendpoints
							 
						 
					
						
							
								
									
										
										
										
											2018-04-26 21:29:29 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    transfer to ADDRESS...
							 
						 
					
						
							
								
									
										
										
										
											2018-01-06 14:52:09 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    fallthrough [ZONES...]
							 
						 
					
						
							
								
									
										
										
										
											2018-11-08 20:38:47 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    ignore empty_service
							 
						 
					
						
							
								
									
										
										
										
											2017-08-09 03:13:38 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}
							 
						 
					
						
							
								
									
										
										
										
											2017-07-01 03:20:21 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								```
							 
						 
					
						
							
								
									
										
										
										
											2017-10-10 09:39:35 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-10-31 13:33:41 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								*  `endpoint`  specifies the **URL **  for a remote k8s API endpoint. 
						 
					
						
							
								
									
										
										
										
											2017-08-10 22:47:09 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								   If omitted, it will connect to k8s in-cluster using the cluster service account.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								*  `tls`  **CERT **  **KEY **  **CACERT **  are the TLS cert, key and the CA cert file names for remote k8s connection. 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								   This option is ignored if connecting in-cluster (i.e. endpoint is not specified).
							 
						 
					
						
							
								
									
										
										
										
											2018-11-27 11:28:20 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								*  `kubeconfig`  **KUBECONFIG **  **CONTEXT **  authenticates the connection to a remote k8s cluster using a kubeconfig file. It supports TLS, username and password, or token-based authentication. This option is ignored if connecting in-cluster (i.e., the endpoint is not specified). 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								*  `namespaces`  **NAMESPACE [NAMESPACE...] **  only exposes the k8s namespaces listed. 
						 
					
						
							
								
									
										
										
										
											2017-08-10 22:47:09 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								   If this option is omitted all namespaces are exposed
							 
						 
					
						
							
								
									
										
										
										
											2019-03-22 08:32:40 -06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								*  `namespace_labels`  **EXPRESSION **  only expose the records for Kubernetes namespaces that match this label selector. 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								   The label selector syntax is described in the
							 
						 
					
						
							
								
									
										
										
										
											2020-03-05 10:09:19 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								   [Kubernetes User Guide - Labels ](https://kubernetes.io/docs/user-guide/labels/ ). An example that
							 
						 
					
						
							
								
									
										
										
										
											2019-04-08 16:45:29 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								   only exposes namespaces labeled as "istio-injection=enabled", would use:
							 
						 
					
						
							
								
									
										
										
										
											2019-03-22 08:32:40 -06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								   `labels istio-injection=enabled` .
							 
						 
					
						
							
								
									
										
										
										
											2017-08-10 22:47:09 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								*  `labels`  **EXPRESSION **  only exposes the records for Kubernetes objects that match this label selector. 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								   The label selector syntax is described in the
							 
						 
					
						
							
								
									
										
										
										
											2019-02-15 11:18:32 +07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								   [Kubernetes User Guide - Labels ](https://kubernetes.io/docs/user-guide/labels/ ). An example that
							 
						 
					
						
							
								
									
										
										
										
											2017-08-10 22:47:09 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								   only exposes objects labeled as "application=nginx" in the "staging" or "qa" environments, would
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								   use: `labels environment in (staging, qa),application=nginx` .
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								*  `pods`  **POD-MODE **  sets the mode for handling IP-based pod A records, e.g. 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								   `1-2-3-4.ns.pod.cluster.local. in A 1.2.3.4` .
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								   This option is provided to facilitate use of SSL certs when connecting directly to pods. Valid
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								   values for **POD-MODE ** :
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								   *  `disabled` : Default. Do not process pod requests, always returning `NXDOMAIN` 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								   *  `insecure` : Always return an A record with IP from request (without checking k8s).  This option
							 
						 
					
						
							
								
									
										
										
										
											2018-07-30 14:37:24 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								     is vulnerable to abuse if used maliciously in conjunction with wildcard SSL certs.  This
							 
						 
					
						
							
								
									
										
										
										
											2017-08-10 22:47:09 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								     option is provided for backward compatibility with kube-dns.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								   *  `verified` : Return an A record if there exists a pod in same namespace with matching IP.  This
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								     option requires substantially more memory than in insecure mode, since it will maintain a watch
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								     on all pods.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-01-04 12:53:07 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								*  `endpoint_pod_names`  uses the pod name of the pod targeted by the endpoint as 
						 
					
						
							
								
									
										
										
										
											2018-11-27 11:28:20 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								   the endpoint name in A records, e.g.,
							 
						 
					
						
							
								
									
										
										
										
											2017-11-08 08:07:10 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								   `endpoint-name.my-service.namespace.svc.cluster.local. in A 1.2.3.4` 
							 
						 
					
						
							
								
									
										
										
										
											2018-01-04 12:53:07 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								   By default, the endpoint-name name selection is as follows: Use the hostname
							 
						 
					
						
							
								
									
										
										
										
											2017-11-08 08:07:10 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								   of the endpoint, or if hostname is not set, use the dashed form of the endpoint
							 
						 
					
						
							
								
									
										
										
										
											2018-11-27 11:28:20 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								   IP address (e.g., `1-2-3-4.my-service.namespace.svc.cluster.local.` )
							 
						 
					
						
							
								
									
										
										
										
											2017-11-08 08:07:10 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								   If this directive is included, then name selection for endpoints changes as
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								   follows: Use the hostname of the endpoint, or if hostname is not set, use the
							 
						 
					
						
							
								
									
										
										
										
											2018-01-04 12:53:07 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								   pod name of the pod targeted by the endpoint. If there is no pod targeted by
							 
						 
					
						
							
								
									
										
										
										
											2017-11-08 12:08:32 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								   the endpoint, use the dashed IP address form.
							 
						 
					
						
							
								
									
										
										
										
											2019-01-23 08:49:16 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								*  `ttl`  allows you to set a custom TTL for responses. The default is 5 seconds.  The minimum TTL allowed is 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  0 seconds, and the maximum is capped at 3600 seconds. Setting TTL to 0 will prevent records from being cached.
							 
						 
					
						
							
								
									
										
										
										
											2018-02-16 11:05:52 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								*  `noendpoints`  will turn off the serving of endpoint records by disabling the watch on endpoints. 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  All endpoint queries and headless service queries will result in an NXDOMAIN.
							 
						 
					
						
							
								
									
										
										
										
											2018-04-26 21:29:29 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								*  `transfer`  enables zone transfers. It may be specified multiples times. `To`  signals the direction 
						 
					
						
							
								
									
										
										
										
											2019-02-21 03:22:01 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  (only `to`  is allowed). **ADDRESS **  must be denoted in CIDR notation (127.0.0.1/32 etc.) or just as
							 
						 
					
						
							
								
									
										
										
										
											2018-04-26 21:29:29 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  plain addresses. The special wildcard `*`  means: the entire internet.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  Sending DNS notifies is not supported.
							 
						 
					
						
							
								
									
										
										
										
											2018-11-27 11:28:20 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  [Deprecated ](https://github.com/kubernetes/dns/blob/master/docs/specification.md#26---deprecated-records ) pod records in the subdomain `pod.cluster.local`  are not transferred.
							 
						 
					
						
							
								
									
										
										
										
											2018-01-06 14:52:09 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								*  `fallthrough`  * * [ZONES...]** If a query for a record in the zones for which the plugin is authoritative 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  results in NXDOMAIN, normally that is what the response will be. However, if you specify this option,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  the query will instead be passed on down the plugin chain, which can include another plugin to handle
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  the query. If * * [ZONES...]** is omitted, then fallthrough happens for all zones for which the plugin
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  is authoritative. If specific zones are listed (for example `in-addr.arpa`  and `ip6.arpa` ), then only
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  queries for those zones will be subject to fallthrough.
							 
						 
					
						
							
								
									
										
										
										
											2019-02-21 03:22:01 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								*  `ignore empty_service`  returns NXDOMAIN for services without any ready endpoint addresses (e.g., ready pods). 
						 
					
						
							
								
									
										
										
										
											2018-07-09 13:08:02 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  This allows the querying pod to continue searching for the service in the search path.
							 
						 
					
						
							
								
									
										
										
										
											2018-11-27 11:28:20 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  The search path could, for example, include another Kubernetes cluster.
							 
						 
					
						
							
								
									
										
										
										
											2017-07-01 03:20:21 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-03-20 13:32:23 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								## Ready
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								This plugin reports readiness to the ready plugin. This will happen after it has synced to the
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								Kubernetes API.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-07-01 03:20:21 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								## Examples
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-10-24 10:16:03 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								Handle all queries in the `cluster.local`  zone. Connect to Kubernetes in-cluster. Also handle all
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								`in-addr.arpa`  `PTR`  requests for `10.0.0.0/17`  . Verify the existence of pods when answering pod 
						 
					
						
							
								
									
										
										
										
											2019-07-02 16:23:47 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								requests.
							 
						 
					
						
							
								
									
										
										
										
											2017-07-01 03:20:21 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-09-07 10:48:26 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								~~~ txt
							 
						 
					
						
							
								
									
										
										
										
											2017-10-24 10:16:03 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								10.0.0.0/17 cluster.local {
							 
						 
					
						
							
								
									
										
										
										
											2017-09-07 10:48:26 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    kubernetes {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        pods verified
							 
						 
					
						
							
								
									
										
										
										
											2017-08-08 05:05:34 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    }
							 
						 
					
						
							
								
									
										
										
										
											2017-09-07 10:48:26 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								~~~
							 
						 
					
						
							
								
									
										
										
										
											2017-08-08 05:05:34 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-08-11 10:16:43 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								Or you can selectively expose some namespaces:
							 
						 
					
						
							
								
									
										
										
										
											2017-07-01 03:20:21 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-09-07 10:48:26 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								~~~ txt
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								kubernetes cluster.local {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    namespaces test staging
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								~~~
							 
						 
					
						
							
								
									
										
										
										
											2017-07-01 03:20:21 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-09-07 10:48:26 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								Connect to Kubernetes with CoreDNS running outside the cluster:
							 
						 
					
						
							
								
									
										
										
										
											2017-07-01 03:20:21 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-09-07 10:48:26 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								~~~ txt
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								kubernetes cluster.local {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    endpoint https://k8s-endpoint:8443
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    tls cert key cacert
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								~~~
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-02-14 15:11:26 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								## stubDomains and upstreamNameservers
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-03-03 23:32:38 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								Here we use the * forward *  plugin to implement a stubDomain that forwards `example.local`  to the nameserver `10.100.0.10:53` .
							 
						 
					
						
							
								
									
										
										
										
											2018-02-14 15:11:26 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								Also configured is an upstreamNameserver `8.8.8.8:53`  that will be used for resolving names that do not fall in `cluster.local` 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								or `example.local` .
							 
						 
					
						
							
								
									
										
										
										
											2017-09-07 10:48:26 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								~~~ txt
							 
						 
					
						
							
								
									
										
										
										
											2019-03-03 23:32:38 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								cluster.local:53 {
							 
						 
					
						
							
								
									
										
										
										
											2019-07-02 16:23:47 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    kubernetes cluster.local
							 
						 
					
						
							
								
									
										
										
										
											2019-03-03 23:32:38 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								example.local {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    forward . 10.100.0.10:53
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								. {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    forward . 8.8.8.8:53
							 
						 
					
						
							
								
									
										
										
										
											2017-09-07 10:48:26 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								~~~
							 
						 
					
						
							
								
									
										
										
										
											2017-08-08 05:05:34 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-02-14 15:11:26 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								The configuration above represents the following Kube-DNS stubDomains and upstreamNameservers configuration.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								~~~ txt
							 
						 
					
						
							
								
									
										
										
										
											2019-03-03 23:32:38 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								stubDomains: |
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								   {“example.local”: [“10.100.0.10:53”]}
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								upstreamNameservers: |
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								   [“8.8.8.8:53”]
							 
						 
					
						
							
								
									
										
										
										
											2018-02-14 15:11:26 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								~~~
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-08-14 08:49:26 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								## AutoPath
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-09-14 09:36:06 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								The * kubernetes *  plugin can be used in conjunction with the * autopath *  plugin.  Using this
							 
						 
					
						
							
								
									
										
										
										
											2018-11-27 11:28:20 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								feature enables server-side domain search path completion in Kubernetes clusters.  Note: `pods`  must
							 
						 
					
						
							
								
									
										
										
										
											2020-05-06 12:07:14 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								be set to `verified`  for this to function properly. Furthermore, the remote IP address in the DNS
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								packet received by CoreDNS must be the IP address of the Pod that sent the request.
							 
						 
					
						
							
								
									
										
										
										
											2017-08-14 08:49:26 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    cluster.local {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        autopath @kubernetes 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        kubernetes {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            pods verified
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    }
							 
						 
					
						
							
								
									
										
										
										
											2017-07-01 03:20:21 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-08-14 08:49:26 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								## Wildcards
  
						 
					
						
							
								
									
										
										
										
											2016-06-06 12:49:53 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-08-11 12:50:12 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								Some query labels accept a wildcard value to match any value.  If a label is a valid wildcard (\*,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								or the word "any"), then that label will match all values.  The labels that accept wildcards are:
							 
						 
					
						
							
								
									
										
										
										
											2017-07-01 03:20:21 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-11-27 11:28:20 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								 *  _endpoint_ in an `A`  record request: _ endpoint _ .service.namespace.svc.zone, e.g., `*.nginx.ns.svc.cluster.local` 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 *  _service_ in an `A`  record request: _ service _ .namespace.svc.zone, e.g., `*.ns.svc.cluster.local` 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 *  _namespace_ in an `A`  record request: service._namespace_.svc.zone, e.g., `nginx.*.svc.cluster.local` 
							 
						 
					
						
							
								
									
										
										
										
											2018-01-04 12:53:07 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								 *  _port and/or protocol_ in an `SRV`  request: __port_.__protocol_.service.namespace.svc.zone.,
							 
						 
					
						
							
								
									
										
										
										
											2018-11-27 11:28:20 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								   e.g., `_http.*.service.ns.svc.cluster.local` 
							 
						 
					
						
							
								
									
										
										
										
											2019-02-21 15:15:17 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								 *  multiple wildcards are allowed in a single query, e.g., `A`  Request `*.*.svc.zone.`  or `SRV`  request `*.*.*.*.svc.zone.` 
							 
						 
					
						
							
								
									
										
										
										
											2018-04-26 21:29:29 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-11-27 11:28:20 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								 For example, wildcards can be used to resolve all Endpoints for a Service as `A`  records. e.g.: `*.service.ns.svc.myzone.local`  will return the Endpoint IPs in the Service `service`  in namespace `default` :
							 
						 
					
						
							
								
									
										
										
										
											2019-10-07 16:38:46 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								```
							 
						 
					
						
							
								
									
										
										
										
											2018-03-13 11:35:29 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								*.service.default.svc.cluster.local. 5	IN A	192.168.10.10
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								*.service.default.svc.cluster.local. 5	IN A	192.168.25.15
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								```
							 
						 
					
						
							
								
									
										
										
										
											2019-06-09 00:10:57 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								## Metadata
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-10-07 16:38:46 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								The kubernetes plugin will publish the following metadata, if the * metadata * 
							 
						 
					
						
							
								
									
										
										
										
											2019-06-09 00:10:57 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								plugin is also enabled:
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-05-06 12:07:14 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								 *  `kubernetes/endpoint` : the endpoint name in the query
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 *  `kubernetes/kind` : the resource kind (pod or svc) in the query
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 *  `kubernetes/namespace` : the namespace in the query
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 *  `kubernetes/port-name` : the port name in an SRV query
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 *  `kubernetes/protocol` : the protocol in an SRV query
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 *  `kubernetes/service` : the service name in the query
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 *  `kubernetes/client-namespace` : the client pod's namespace (see requirements below)
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 *  `kubernetes/client-pod-name` : the client pod's name (see requirements below)
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								The `kubernetes/client-namespace`  and `kubernetes/client-pod-name`  metadata work by reconciling the
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								client IP address in the DNS request packet to a known pod IP address. Therefore the following is required:
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 *  `pods verified`  mode must be enabled
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 *  the remote IP address in the DNS packet received by CoreDNS must be the IP address
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								   of the Pod that sent the request.
							 
						 
					
						
							
								
									
										
										
										
											2019-10-04 17:48:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								## Metrics
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-10-08 10:20:48 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								If monitoring is enabled (via the * prometheus *  plugin) then the following metrics are exported:
							 
						 
					
						
							
								
									
										
										
										
											2019-10-07 16:38:46 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								*  `coredns_kubernetes_dns_programming_duration_seconds{service_kind}`  - Exports the 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  [DNS programming latency SLI ](https://github.com/kubernetes/community/blob/master/sig-scalability/slos/dns_programming_latency.md ).
							 
						 
					
						
							
								
									
										
										
										
											2019-10-04 17:48:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  The metrics has the `service_kind`  label that identifies the kind of the
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  [kubernetes service ](https://kubernetes.io/docs/concepts/services-networking/service ).
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  It may take one of the three values:
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    *  `cluster_ip` 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    *  `headless_with_selector` 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    *  `headless_without_selector` 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								## Bugs
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-12-29 13:35:17 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								The duration metric only supports the "headless\_with\_selector" service currently.