Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
C
Coredns
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Railgun
Coredns
Commits
c3d3ff28
Commit
c3d3ff28
authored
Aug 28, 2016
by
Miek Gieben
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'cleanup-for-release'
parents
0c57748b
676dc919
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
32 additions
and
51 deletions
+32
-51
conf/chaosCorefile
conf/chaosCorefile
+0
-4
conf/etcdCorefile
conf/etcdCorefile
+0
-10
conf/k8sCorefile
conf/k8sCorefile
+0
-25
middleware/kubernetes/README.md
middleware/kubernetes/README.md
+32
-12
No files found.
conf/chaosCorefile
deleted
100644 → 0
View file @
0c57748b
.:1053 authors.bind:1053 {
chaos CoreDNS-001 "Miek Gieben" miek@miek.nl
proxy . 8.8.8.8:53
}
conf/etcdCorefile
deleted
100644 → 0
View file @
0c57748b
.:1053 {
etcd skydns.local {
stubzones
path /skydns
endpoint http://localhost:2379
upstream 8.8.8.8:53 8.8.4.4:53
debug
}
proxy . 8.8.8.8:53
}
conf/k8sCorefile
deleted
100644 → 0
View file @
0c57748b
# Serve on port 53
.:53 {
# use kubernetes middleware for domain "coredns.local"
kubernetes coredns.local {
# Kubernetes data API resync period
# Example values: 60s, 5m, 1h
resyncperiod 5m
# Use url for k8s API endpoint
endpoint http://localhost:8080
# Assemble k8s record names with the template
template {service}.{namespace}.{zone}
# Only expose the k8s namespace "demo"
namespaces demo
# Only expose the records for kubernetes objects
# that matches this label selector. The label
# selector syntax is described in the kubernetes
# API documentation: http://kubernetes.io/docs/user-guide/labels/
# Example selector below only exposes objects tagged as
# "application=nginx" in the staging or qa environments.
#labels environment in (staging, qa),application=nginx
}
# Perform DNS response caching for the coredns.local zone
# Cache timeout is provided by the integer in seconds
#cache 180 coredns.local
}
middleware/kubernetes/README.md
View file @
c3d3ff28
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
`kubernetes`
enables reading zone data from a kubernetes cluster. Record names
`kubernetes`
enables reading zone data from a kubernetes cluster. Record names
are constructed as "myservice.mynamespace.coredns.local" where:
are constructed as "myservice.mynamespace.coredns.local" where:
*
"myservice" is the name of the k8s service (this may include multiple DNS labels,
*
"myservice" is the name of the k8s service (this may include multiple DNS labels,
such as "c1.myservice"),
such as "c1.myservice"),
*
"mynamespace" is the k8s namespace for the service, and
*
"mynamespace" is the k8s namespace for the service, and
*
"coredns.local" is the zone configured for
`kubernetes`
.
*
"coredns.local" is the zone configured for
`kubernetes`
.
...
@@ -64,7 +64,7 @@ Defaults:
...
@@ -64,7 +64,7 @@ Defaults:
*
If the
`template`
keyword is omitted, the default template of "{service}.{namespace}.{zone}" is used.
*
If the
`template`
keyword is omitted, the default template of "{service}.{namespace}.{zone}" is used.
*
If the
`resyncperiod`
keyword is omitted, the default resync period is 5 minutes.
*
If the
`resyncperiod`
keyword is omitted, the default resync period is 5 minutes.
*
The
`labels`
keyword is only used when filtering results based on kubernetes label selector syntax
*
The
`labels`
keyword is only used when filtering results based on kubernetes label selector syntax
is required. The label selector syntax is described in the kubernetes API documentation at:
is required. The label selector syntax is described in the kubernetes API documentation at:
http://kubernetes.io/docs/user-guide/labels/
http://kubernetes.io/docs/user-guide/labels/
### Template syntax
### Template syntax
...
@@ -90,7 +90,7 @@ The kubernetes control client can be downloaded from the generic URL:
...
@@ -90,7 +90,7 @@ The kubernetes control client can be downloaded from the generic URL:
For example, the kubectl client for Linux can be downloaded using the command:
For example, the kubectl client for Linux can be downloaded using the command:
`curl -sSL "http://storage.googleapis.com/kubernetes-release/release/v1.2.4/bin/linux/amd64/kubectl"`
`curl -sSL "http://storage.googleapis.com/kubernetes-release/release/v1.2.4/bin/linux/amd64/kubectl"`
The
`contrib/kubernetes/testscripts/10_setup_kubectl.sh`
script can be stored in the same directory as
The
`contrib/kubernetes/testscripts/10_setup_kubectl.sh`
script can be stored in the same directory as
kubectl to setup kubectl to communicate with kubernetes running on the localhost.
kubectl to setup kubectl to communicate with kubernetes running on the localhost.
...
@@ -111,20 +111,40 @@ $ ./kubectl get service --namespace=demo
...
@@ -111,20 +111,40 @@ $ ./kubectl get service --namespace=demo
~~~
~~~
The script
`contrib/kubernetes/testscripts/20_setup_k8s_services.sh`
creates a couple of sample namespaces
The script
`contrib/kubernetes/testscripts/20_setup_k8s_services.sh`
creates a couple of sample namespaces
with services running in those namespaces. The automated kubernetes integration tests in
with services running in those namespaces. The automated kubernetes integration tests in
`test/kubernetes_test.go`
depend on these services and namespaces to exist in kubernetes.
`test/kubernetes_test.go`
depend on these services and namespaces to exist in kubernetes.
#### Launch CoreDNS
#### Launch CoreDNS
Build CoreDNS and launch using the configuration file in
`conf/k8sCorefile`
.
Build CoreDNS and launch using this configuration file:
This configuration file sets up CoreDNS to use the zone
`coredns.local`
for
the kubernetes services.
~~~
txt
# Serve on port 53
.:53 {
kubernetes coredns.local {
resyncperiod 5m
endpoint http://localhost:8080
template {service}.{namespace}.{zone}
namespaces demo
# Only expose the records for kubernetes objects
# that matches this label selector.
# See http://kubernetes.io/docs/user-guide/labels/
# Example selector below only exposes objects tagged as
# "application=nginx" in the staging or qa environments.
#labels environment in (staging, qa),application=nginx
}
#cache 180 coredns.local # optionally enable caching
}
~~~
Put it in
`~/k8sCorefile`
for instance. This configuration file sets up CoreDNS to use the zone
`coredns.local`
for the kubernetes services.
The command to launch CoreDNS is:
The command to launch CoreDNS is:
~~~
~~~
$ ./coredns -conf
conf/k8sCoreF
ile
$ ./coredns -conf
~/k8sCoref
ile
~~~
~~~
In a separate terminal a DNS query can be issued using dig:
In a separate terminal a DNS query can be issued using dig:
...
@@ -158,10 +178,10 @@ mynginx.demo.coredns.local. 0 IN A 10.0.0.10
...
@@ -158,10 +178,10 @@ mynginx.demo.coredns.local. 0 IN A 10.0.0.10
## Implementation Notes/Ideas
## Implementation Notes/Ideas
### Basic Zone Mapping
### Basic Zone Mapping
The middleware is configured with a "zone" string. For
The middleware is configured with a "zone" string. For
example: "zone = coredns.local".
example: "zone = coredns.local".
The Kubernetes service "myservice" running in "mynamespace" would map
The Kubernetes service "myservice" running in "mynamespace" would map
to: "myservice.mynamespace.coredns.local".
to: "myservice.mynamespace.coredns.local".
The middleware should publish an A record for that service and a service record.
The middleware should publish an A record for that service and a service record.
...
@@ -277,9 +297,9 @@ TBD:
...
@@ -277,9 +297,9 @@ TBD:
*
Improve lookup to reduce size of query result obtained from k8s API.
*
Improve lookup to reduce size of query result obtained from k8s API.
(namespace-based?, other ideas?)
(namespace-based?, other ideas?)
*
Additional features:
*
Additional features:
*
Reverse IN-ADDR entries for services. (Is there any value in supporting
*
Reverse IN-ADDR entries for services. (Is there any value in supporting
reverse lookup records?) (need tests, functionality should work based on @aledbf's code.)
reverse lookup records?) (need tests, functionality should work based on @aledbf's code.)
*
(done) ~~How to support label specification in Corefile to allow use of labels to
*
(done) ~~How to support label specification in Corefile to allow use of labels to
indicate zone? For example, the following
indicate zone? For example, the following
configuration exposes all services labeled for the "staging" environment
configuration exposes all services labeled for the "staging" environment
and tenant "customerB" in the zone "customerB.stage.local":
and tenant "customerB" in the zone "customerB.stage.local":
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment