From ea54ace989e8aceac80d1bb683b1039e916bf5c7 Mon Sep 17 00:00:00 2001 From: dlorenc Date: Tue, 13 Nov 2018 08:13:39 -0800 Subject: [PATCH] Remove both the CoreDNS and KubeDNS addons. Let Kubeadm install the correct DNS addon. --- cmd/minikube/cmd/config/config.go | 12 -- .../addons/coredns/coreDNS-clusterrole.yaml | 18 -- deploy/addons/coredns/coreDNS-configmap.yaml | 25 --- deploy/addons/coredns/coreDNS-controller.yaml | 79 --------- deploy/addons/coredns/coreDNS-crbinding.yaml | 15 -- deploy/addons/coredns/coreDNS-sa.yaml | 7 - deploy/addons/coredns/coreDNS-svc.yaml | 22 --- deploy/addons/kube-dns/kube-dns-cm.yaml | 21 --- .../addons/kube-dns/kube-dns-controller.yaml | 162 ------------------ deploy/addons/kube-dns/kube-dns-svc.yaml | 34 ---- docs/addons.md | 4 - pkg/minikube/assets/addons.go | 49 ------ pkg/minikube/bootstrapper/kubeadm/kubeadm.go | 12 +- .../bootstrapper/kubeadm/templates.go | 3 +- 14 files changed, 2 insertions(+), 461 deletions(-) delete mode 100644 deploy/addons/coredns/coreDNS-clusterrole.yaml delete mode 100644 deploy/addons/coredns/coreDNS-configmap.yaml delete mode 100644 deploy/addons/coredns/coreDNS-controller.yaml delete mode 100644 deploy/addons/coredns/coreDNS-crbinding.yaml delete mode 100644 deploy/addons/coredns/coreDNS-sa.yaml delete mode 100644 deploy/addons/coredns/coreDNS-svc.yaml delete mode 100644 deploy/addons/kube-dns/kube-dns-cm.yaml delete mode 100644 deploy/addons/kube-dns/kube-dns-controller.yaml delete mode 100644 deploy/addons/kube-dns/kube-dns-svc.yaml diff --git a/cmd/minikube/cmd/config/config.go b/cmd/minikube/cmd/config/config.go index ab9e33b00d49..2ebcbd470791 100644 --- a/cmd/minikube/cmd/config/config.go +++ b/cmd/minikube/cmd/config/config.go @@ -146,18 +146,6 @@ var settings = []Setting{ validations: []setFn{IsValidAddon}, callbacks: []setFn{EnableOrDisableAddon}, }, - { - name: "coredns", - set: SetBool, - validations: []setFn{IsValidAddon}, - callbacks: []setFn{EnableOrDisableAddon}, - }, - { - name: "kube-dns", - set: SetBool, - validations: []setFn{IsValidAddon}, - callbacks: []setFn{EnableOrDisableAddon}, - }, { name: "heapster", set: SetBool, diff --git a/deploy/addons/coredns/coreDNS-clusterrole.yaml b/deploy/addons/coredns/coreDNS-clusterrole.yaml deleted file mode 100644 index e40e3926b1bc..000000000000 --- a/deploy/addons/coredns/coreDNS-clusterrole.yaml +++ /dev/null @@ -1,18 +0,0 @@ -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - labels: - kubernetes.io/bootstrapping: rbac-defaults - addonmanager.kubernetes.io/mode: Reconcile - name: system:coredns -rules: -- apiGroups: - - "" - resources: - - endpoints - - services - - pods - - namespaces - verbs: - - list - - watch diff --git a/deploy/addons/coredns/coreDNS-configmap.yaml b/deploy/addons/coredns/coreDNS-configmap.yaml deleted file mode 100644 index a665590d64bc..000000000000 --- a/deploy/addons/coredns/coreDNS-configmap.yaml +++ /dev/null @@ -1,25 +0,0 @@ -apiVersion: v1 -kind: ConfigMap -metadata: - name: coredns - namespace: kube-system - labels: - addonmanager.kubernetes.io/mode: EnsureExists -data: - Corefile: | - .:53 { - errors - log - health - kubernetes cluster.local in-addr.arpa ip6.arpa { - pods insecure - upstream - fallthrough in-addr.arpa ip6.arpa - } - prometheus :9153 - proxy . /etc/resolv.conf - loop - cache 30 - loadbalance - reload - } diff --git a/deploy/addons/coredns/coreDNS-controller.yaml b/deploy/addons/coredns/coreDNS-controller.yaml deleted file mode 100644 index fb486eb554cb..000000000000 --- a/deploy/addons/coredns/coreDNS-controller.yaml +++ /dev/null @@ -1,79 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: coredns - namespace: kube-system - labels: - k8s-app: kube-dns - kubernetes.io/name: "CoreDNS" - addonmanager.kubernetes.io/mode: Reconcile -spec: - replicas: 1 - strategy: - type: RollingUpdate - rollingUpdate: - maxUnavailable: 1 - selector: - matchLabels: - k8s-app: kube-dns - template: - metadata: - labels: - k8s-app: kube-dns - spec: - serviceAccountName: coredns - tolerations: - - key: CriticalAddonsOnly - operator: Exists - - key: node-role.kubernetes.io/master - effect: NoSchedule - containers: - - name: coredns - image: k8s.gcr.io/coredns:1.2.2 - imagePullPolicy: IfNotPresent - resources: - limits: - memory: 170Mi - requests: - cpu: 100m - memory: 70Mi - args: [ "-conf", "/etc/coredns/Corefile" ] - volumeMounts: - - name: config-volume - mountPath: /etc/coredns - readOnly: true - ports: - - containerPort: 53 - name: dns - protocol: UDP - - containerPort: 53 - name: dns-tcp - protocol: TCP - - containerPort: 9153 - name: metrics - protocol: TCP - securityContext: - allowPrivilegeEscalation: false - capabilities: - add: - - NET_BIND_SERVICE - drop: - - all - readOnlyRootFilesystem: true - livenessProbe: - httpGet: - path: /health - port: 8080 - scheme: HTTP - initialDelaySeconds: 60 - timeoutSeconds: 5 - successThreshold: 1 - failureThreshold: 5 - dnsPolicy: Default - volumes: - - name: config-volume - configMap: - name: coredns - items: - - key: Corefile - path: Corefile diff --git a/deploy/addons/coredns/coreDNS-crbinding.yaml b/deploy/addons/coredns/coreDNS-crbinding.yaml deleted file mode 100644 index 5b8258ddfa8e..000000000000 --- a/deploy/addons/coredns/coreDNS-crbinding.yaml +++ /dev/null @@ -1,15 +0,0 @@ -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRoleBinding -metadata: - labels: - kubernetes.io/bootstrapping: rbac-defaults - addonmanager.kubernetes.io/mode: EnsureExists - name: system:coredns -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: ClusterRole - name: system:coredns -subjects: -- kind: ServiceAccount - name: coredns - namespace: kube-system diff --git a/deploy/addons/coredns/coreDNS-sa.yaml b/deploy/addons/coredns/coreDNS-sa.yaml deleted file mode 100644 index 3b61f44af497..000000000000 --- a/deploy/addons/coredns/coreDNS-sa.yaml +++ /dev/null @@ -1,7 +0,0 @@ -apiVersion: v1 -kind: ServiceAccount -metadata: - name: coredns - namespace: kube-system - labels: - addonmanager.kubernetes.io/mode: Reconcile diff --git a/deploy/addons/coredns/coreDNS-svc.yaml b/deploy/addons/coredns/coreDNS-svc.yaml deleted file mode 100644 index 187a28b09e61..000000000000 --- a/deploy/addons/coredns/coreDNS-svc.yaml +++ /dev/null @@ -1,22 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: kube-dns - namespace: kube-system - annotations: - prometheus.io/scrape: "true" - labels: - k8s-app: kube-dns - addonmanager.kubernetes.io/mode: Reconcile - kubernetes.io/name: "CoreDNS" -spec: - selector: - k8s-app: kube-dns - clusterIP: 10.96.0.10 - ports: - - name: dns - port: 53 - protocol: UDP - - name: dns-tcp - port: 53 - protocol: TCP diff --git a/deploy/addons/kube-dns/kube-dns-cm.yaml b/deploy/addons/kube-dns/kube-dns-cm.yaml deleted file mode 100644 index 057857527a71..000000000000 --- a/deploy/addons/kube-dns/kube-dns-cm.yaml +++ /dev/null @@ -1,21 +0,0 @@ -# Copyright 2016 The Kubernetes Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -apiVersion: v1 -kind: ConfigMap -metadata: - name: kube-dns - namespace: kube-system - labels: - addonmanager.kubernetes.io/mode: EnsureExists diff --git a/deploy/addons/kube-dns/kube-dns-controller.yaml b/deploy/addons/kube-dns/kube-dns-controller.yaml deleted file mode 100644 index aa625ecd5d15..000000000000 --- a/deploy/addons/kube-dns/kube-dns-controller.yaml +++ /dev/null @@ -1,162 +0,0 @@ -# Copyright 2016 The Kubernetes Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - - -apiVersion: extensions/v1beta1 -kind: Deployment -metadata: - name: kube-dns - namespace: kube-system - labels: - k8s-app: kube-dns - version: v20 - addonmanager.kubernetes.io/mode: Reconcile -spec: - replicas: 1 - selector: - matchLabels: - k8s-app: kube-dns - template: - metadata: - labels: - k8s-app: kube-dns - annotations: - scheduler.alpha.kubernetes.io/critical-pod: '' - spec: - tolerations: - - key: "CriticalAddonsOnly" - operator: "Exists" - volumes: - - name: kube-dns-config - configMap: - name: kube-dns - optional: true - containers: - - name: kubedns - image: k8s.gcr.io/k8s-dns-kube-dns-amd64:1.14.5 - imagePullPolicy: IfNotPresent - resources: - # TODO: Set memory limits when we've profiled the container for large - # clusters, then set request = limit to keep this container in - # guaranteed class. Currently, this container falls into the - # "burstable" category so the kubelet doesn't backoff from restarting it. - limits: - memory: 170Mi - requests: - cpu: 100m - memory: 70Mi - livenessProbe: - httpGet: - path: /healthcheck/kubedns - port: 10054 - scheme: HTTP - initialDelaySeconds: 60 - timeoutSeconds: 5 - successThreshold: 1 - failureThreshold: 5 - readinessProbe: - httpGet: - path: /readiness - port: 8081 - scheme: HTTP - # we poll on pod startup for the Kubernetes master service and - # only setup the /readiness HTTP server once that's available. - initialDelaySeconds: 3 - timeoutSeconds: 5 - args: - - --domain=cluster.local. - - --dns-port=10053 - - --config-map=kube-dns - - --v=2 - env: - - name: PROMETHEUS_PORT - value: "10055" - ports: - - containerPort: 10053 - name: dns-local - protocol: UDP - - containerPort: 10053 - name: dns-tcp-local - protocol: TCP - - containerPort: 10055 - name: metrics - protocol: TCP - volumeMounts: - - name: kube-dns-config - mountPath: /kube-dns-config - - name: dnsmasq - image: k8s.gcr.io/k8s-dns-dnsmasq-nanny-amd64:1.14.5 - imagePullPolicy: IfNotPresent - livenessProbe: - httpGet: - path: /healthcheck/dnsmasq - port: 10054 - scheme: HTTP - initialDelaySeconds: 60 - timeoutSeconds: 5 - successThreshold: 1 - failureThreshold: 5 - args: - - -v=2 - - -logtostderr - - -configDir=/etc/k8s/dns/dnsmasq-nanny - - -restartDnsmasq=true - - -- - - -k - - --cache-size=1000 - - --log-facility=- - - --server=/cluster.local/127.0.0.1#10053 - - --server=/in-addr.arpa/127.0.0.1#10053 - - --server=/ip6.arpa/127.0.0.1#10053 - ports: - - containerPort: 53 - name: dns - protocol: UDP - - containerPort: 53 - name: dns-tcp - protocol: TCP - # see: https://github.com/kubernetes/kubernetes/issues/29055 for details - resources: - requests: - cpu: 150m - memory: 20Mi - volumeMounts: - - name: kube-dns-config - mountPath: /etc/k8s/dns/dnsmasq-nanny - - name: sidecar - image: k8s.gcr.io/k8s-dns-sidecar-amd64:1.14.5 - imagePullPolicy: IfNotPresent - livenessProbe: - httpGet: - path: /metrics - port: 10054 - scheme: HTTP - initialDelaySeconds: 60 - timeoutSeconds: 5 - successThreshold: 1 - failureThreshold: 5 - args: - - --v=2 - - --logtostderr - - --probe=kubedns,127.0.0.1:10053,kubernetes.default.svc.cluster.local.,5,A - - --probe=dnsmasq,127.0.0.1:53,kubernetes.default.svc.cluster.local.,5,A - ports: - - containerPort: 10054 - name: metrics - protocol: TCP - resources: - requests: - memory: 20Mi - cpu: 10m - dnsPolicy: Default # Don't use cluster DNS. diff --git a/deploy/addons/kube-dns/kube-dns-svc.yaml b/deploy/addons/kube-dns/kube-dns-svc.yaml deleted file mode 100644 index 03ea5c491a55..000000000000 --- a/deploy/addons/kube-dns/kube-dns-svc.yaml +++ /dev/null @@ -1,34 +0,0 @@ -# Copyright 2016 The Kubernetes Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -apiVersion: v1 -kind: Service -metadata: - name: kube-dns - namespace: kube-system - labels: - k8s-app: kube-dns - addonmanager.kubernetes.io/mode: Reconcile - kubernetes.io/name: "KubeDNS" -spec: - selector: - k8s-app: kube-dns - clusterIP: 10.96.0.10 - ports: - - name: dns - port: 53 - protocol: UDP - - name: dns-tcp - port: 53 - protocol: TCP diff --git a/docs/addons.md b/docs/addons.md index ea38dc9995f1..b737409e1570 100644 --- a/docs/addons.md +++ b/docs/addons.md @@ -3,13 +3,11 @@ Minikube has a set of built in addons that can be used enabled, disabled, and opened inside of the local k8s environment. Below is an example of this functionality for the `heapster` addon: ```shell $ minikube addons list -- kube-dns: enabled - registry: disabled - registry-creds: disabled - freshpod: disabled - addon-manager: enabled - dashboard: enabled -- coredns: disabled - heapster: disabled - efk: disabled - ingress: disabled @@ -30,12 +28,10 @@ Created new window in existing browser session. The currently supported addons include: * [Kubernetes Dashboard](https://github.com/kubernetes/kubernetes/tree/master/cluster/addons/dashboard) -* [Kube-dns](https://github.com/kubernetes/kubernetes/tree/master/cluster/addons/dns) * [Heapster](https://github.com/kubernetes/heapster): [Troubleshooting Guide](https://github.com/kubernetes/heapster/blob/master/docs/influxdb.md) Note:You will need to login to Grafana as admin/admin in order to access the console * [EFK](https://github.com/kubernetes/kubernetes/tree/master/cluster/addons/fluentd-elasticsearch) * [Registry](https://github.com/kubernetes/minikube/tree/master/deploy/addons/registry) * [Registry Credentials](https://github.com/upmc-enterprises/registry-creds) -* [CoreDNS](https://github.com/coredns/deployment/tree/master/kubernetes) * [Ingress](https://github.com/kubernetes/ingress-nginx) * [Freshpod](https://github.com/GoogleCloudPlatform/freshpod) * [nvidia-driver-installer](https://github.com/GoogleCloudPlatform/container-engine-accelerators/tree/master/nvidia-driver-installer/minikube) diff --git a/pkg/minikube/assets/addons.go b/pkg/minikube/assets/addons.go index e4c7357bfb2b..329cef3b5662 100644 --- a/pkg/minikube/assets/addons.go +++ b/pkg/minikube/assets/addons.go @@ -89,55 +89,6 @@ var Addons = map[string]*Addon{ "storage-provisioner.yaml", "0640"), }, true, "storage-provisioner"), - "coredns": NewAddon([]*BinDataAsset{ - NewBinDataAsset( - "deploy/addons/coredns/coreDNS-controller.yaml", - constants.AddonsPath, - "coreDNS-controller.yaml", - "0640"), - NewBinDataAsset( - "deploy/addons/coredns/coreDNS-configmap.yaml", - constants.AddonsPath, - "coreDNS-configmap.yaml", - "0640"), - NewBinDataAsset( - "deploy/addons/coredns/coreDNS-svc.yaml", - constants.AddonsPath, - "coreDNS-svc.yaml", - "0640"), - NewBinDataAsset( - "deploy/addons/coredns/coreDNS-crbinding.yaml", - constants.AddonsPath, - "coreDNS-crbinding.yaml", - "0640"), - NewBinDataAsset( - "deploy/addons/coredns/coreDNS-sa.yaml", - constants.AddonsPath, - "coreDNS-sa.yaml", - "0640"), - NewBinDataAsset( - "deploy/addons/coredns/coreDNS-clusterrole.yaml", - constants.AddonsPath, - "coreDNS-clusterrole.yaml", - "0640"), - }, true, "coredns"), - "kube-dns": NewAddon([]*BinDataAsset{ - NewBinDataAsset( - "deploy/addons/kube-dns/kube-dns-controller.yaml", - constants.AddonsPath, - "kube-dns-controller.yaml", - "0640"), - NewBinDataAsset( - "deploy/addons/kube-dns/kube-dns-cm.yaml", - constants.AddonsPath, - "kube-dns-cm.yaml", - "0640"), - NewBinDataAsset( - "deploy/addons/kube-dns/kube-dns-svc.yaml", - constants.AddonsPath, - "kube-dns-svc.yaml", - "0640"), - }, false, "kube-dns"), "heapster": NewAddon([]*BinDataAsset{ NewBinDataAsset( "deploy/addons/heapster/influx-grafana-rc.yaml", diff --git a/pkg/minikube/bootstrapper/kubeadm/kubeadm.go b/pkg/minikube/bootstrapper/kubeadm/kubeadm.go index dce9a368a96e..0e789738cdb6 100644 --- a/pkg/minikube/bootstrapper/kubeadm/kubeadm.go +++ b/pkg/minikube/bootstrapper/kubeadm/kubeadm.go @@ -119,17 +119,12 @@ func (k *KubeadmBootstrapper) StartCluster(k8s config.KubernetesConfig) error { KubeadmConfigFile string SkipPreflightChecks bool Preflights []string - DNSAddon string }{ KubeadmConfigFile: constants.KubeadmConfigFile, SkipPreflightChecks: !VersionIsBetween(version, semver.MustParse("1.9.0-alpha.0"), semver.Version{}), Preflights: constants.Preflights, - DNSAddon: "kube-dns", - } - if version.GTE(semver.MustParse("1.12.0")) { - templateContext.DNSAddon = "coredns" } if err := kubeadmInitTemplate.Execute(&b, templateContext); err != nil { return err @@ -162,12 +157,7 @@ func addAddons(files *[]assets.CopyableFile) error { return errors.Wrap(err, "adding minikube dir assets") } // bundled addons - for addonName, addonBundle := range assets.Addons { - // TODO(r2d4): Kubeadm ignores the kube-dns addon and uses its own. - // expose this in a better way - if addonName == "kube-dns" { - continue - } + for _, addonBundle := range assets.Addons { if isEnabled, err := addonBundle.IsEnabled(); err == nil && isEnabled { for _, addon := range addonBundle.Assets { *files = append(*files, addon) diff --git a/pkg/minikube/bootstrapper/kubeadm/templates.go b/pkg/minikube/bootstrapper/kubeadm/templates.go index 12e3687505e1..22a08af722ee 100644 --- a/pkg/minikube/bootstrapper/kubeadm/templates.go +++ b/pkg/minikube/bootstrapper/kubeadm/templates.go @@ -116,8 +116,7 @@ sudo /usr/bin/kubeadm alpha phase etcd local --config {{.KubeadmConfigFile}} `)) var kubeadmInitTemplate = template.Must(template.New("kubeadmInitTemplate").Parse(` -sudo /usr/bin/kubeadm init --config {{.KubeadmConfigFile}} {{if .SkipPreflightChecks}}--skip-preflight-checks{{else}}{{range .Preflights}}--ignore-preflight-errors={{.}} {{end}}{{end}} && -sudo /usr/bin/kubeadm alpha phase addon {{ .DNSAddon }} +sudo /usr/bin/kubeadm init --config {{.KubeadmConfigFile}} {{if .SkipPreflightChecks}}--skip-preflight-checks{{else}}{{range .Preflights}}--ignore-preflight-errors={{.}} {{end}}{{end}} `)) // printMapInOrder sorts the keys and prints the map in order, combining key