Skip to content

Commit

Permalink
Merge pull request #7376 from gjtempleton/External-CoreFile
Browse files Browse the repository at this point in the history
[Feature] CoreDNS: External CoreFile option
  • Loading branch information
k8s-ci-robot authored Sep 10, 2019
2 parents e0f792a + 5f92e1a commit 8087994
Show file tree
Hide file tree
Showing 9 changed files with 55 additions and 2 deletions.
35 changes: 35 additions & 0 deletions docs/cluster_spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,41 @@ Specifying KubeDNS will install kube-dns as the default service discovery.

This will install [CoreDNS](https://coredns.io/) instead of kube-dns.

If you are using CoreDNS and want to use an entirely custom CoreFile you can do this by specifying the file. This will not work with any other options which interact with the default CoreFile.

**Note:** If you are using this functionality you will need to be extra vigiliant on version changes of CoreDNS for changes in functionality of the plugins being used etc.

```yaml
spec:
kubeDNS:
provider: CoreDNS
externalCoreFile: |
amazonaws.com:53 {
errors
log . {
class denial error
}
health :8084
prometheus :9153
proxy . 169.254.169.253 {
}
cache 30
}
.:53 {
errors
health :8080
autopath @kubernetes
kubernetes cluster.local {
pods verified
upstream 169.254.169.253
fallthrough in-addr.arpa ip6.arpa
}
prometheus :9153
proxy . 169.254.169.253
cache 300
}
```

**Note:** If you are upgrading to CoreDNS, kube-dns will be left in place and must be removed manually (you can scale the kube-dns and kube-dns-autoscaler deployments in the `kube-system` namespace to 0 as a starting point). The `kube-dns` Service itself should be left in place, as this retains the ClusterIP and eliminates the possibility of DNS outages in your cluster. If you would like to continue autoscaling, update the `kube-dns-autoscaler` Deployment container command for `--target=Deployment/kube-dns` to be `--target=Deployment/coredns`.

### kubeControllerManager
Expand Down
2 changes: 2 additions & 0 deletions pkg/apis/kops/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,8 @@ type KubeDNSConfig struct {
CacheMaxConcurrent int `json:"cacheMaxConcurrent,omitempty"`
// Domain is the dns domain
Domain string `json:"domain,omitempty"`
// ExternalCoreFile is used to provide a complete CoreDNS CoreFile by the user - ignores other provided flags which modify the CoreFile.
ExternalCoreFile string `json:"externalCoreFile,omitempty"`
// Image is the name of the docker image to run - @deprecated as this is now in the addon
Image string `json:"image,omitempty"`
// Replicas is the number of pod replicas - @deprecated as this is now in the addon and controlled by autoscaler
Expand Down
2 changes: 2 additions & 0 deletions pkg/apis/kops/v1alpha1/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,8 @@ type KubeDNSConfig struct {
CacheMaxConcurrent int `json:"cacheMaxConcurrent,omitempty"`
// Domain is the dns domain
Domain string `json:"domain,omitempty"`
// ExternalCoreFile is used to provide a complete CoreDNS CoreFile by the user - ignores other provided flags which modify the CoreFile.
ExternalCoreFile string `json:"externalCoreFile,omitempty"`
// Image is the name of the docker image to run - @deprecated as this is now in the addon
Image string `json:"image,omitempty"`
// Replicas is the number of pod replicas - @deprecated as this is now in the addon, and controlled by autoscaler
Expand Down
2 changes: 2 additions & 0 deletions pkg/apis/kops/v1alpha1/zz_generated.conversion.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions pkg/apis/kops/v1alpha2/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,8 @@ type KubeDNSConfig struct {
CacheMaxConcurrent int `json:"cacheMaxConcurrent,omitempty"`
// Domain is the dns domain
Domain string `json:"domain,omitempty"`
// ExternalCoreFile is used to provide a complete CoreDNS CoreFile by the user - ignores other provided flags which modify the CoreFile.
ExternalCoreFile string `json:"externalCoreFile,omitempty"`
// Image is the name of the docker image to run - @deprecated as this is now in the addon
Image string `json:"image,omitempty"`
// Replicas is the number of pod replicas - @deprecated as this is now in the addon, and controlled by autoscaler
Expand Down
2 changes: 2 additions & 0 deletions pkg/apis/kops/v1alpha2/zz_generated.conversion.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ metadata:
addonmanager.kubernetes.io/mode: EnsureExists
data:
Corefile: |
{{- if KubeDNS.ExternalCoreFile }}
{{ KubeDNS.ExternalCoreFile }}
{{- else }}
.:53 {
errors
health
Expand All @@ -74,6 +77,7 @@ data:
loadbalance
reload
}
{{- end }}
---
apiVersion: apps/v1
kind: Deployment
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ metadata:
addonmanager.kubernetes.io/mode: EnsureExists
data:
Corefile: |
{{- if KubeDNS.ExternalCoreFile }}
{{ KubeDNS.ExternalCoreFile }}
{{- else }}
.:53 {
errors
health
Expand All @@ -74,6 +77,7 @@ data:
loadbalance
reload
}
{{- end }}
---
apiVersion: apps/v1
kind: Deployment
Expand Down
4 changes: 2 additions & 2 deletions upup/pkg/fi/cloudup/bootstrapchannelbuilder.go
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ func (b *BootstrapChannelBuilder) buildAddons() *channelsapi.Addons {
if kubeDNS.Provider == "CoreDNS" {
{
key := "coredns.addons.k8s.io"
version := "1.3.1-kops.3"
version := "1.3.1-kops.4"

{
location := key + "/k8s-1.6.yaml"
Expand All @@ -283,7 +283,7 @@ func (b *BootstrapChannelBuilder) buildAddons() *channelsapi.Addons {

{
key := "coredns.addons.k8s.io"
version := "1.3.1"
version := "1.3.1-kops.4"

{
location := key + "/k8s-1.12.yaml"
Expand Down

0 comments on commit 8087994

Please sign in to comment.