Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding CoreDNS as an addon #1995

Merged
merged 3 commits into from
Oct 9, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions cmd/minikube/cmd/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,12 @@ var settings = []Setting{
validations: []setFn{IsValidAddon},
callbacks: []setFn{EnableOrDisableAddon},
},
{
name: "coredns",
set: SetBool,
validations: []setFn{IsValidAddon},
callbacks: []setFn{EnableOrDisableAddon},
},
{
name: "kube-dns",
set: SetBool,
Expand Down
18 changes: 18 additions & 0 deletions deploy/addons/coredns/coreDNS-clusterrole.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
apiVersion: rbac.authorization.k8s.io/v1beta1
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
18 changes: 18 additions & 0 deletions deploy/addons/coredns/coreDNS-configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
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 10.0.0.0/24
prometheus
proxy . /etc/resolv.conf
cache 30
}
58 changes: 58 additions & 0 deletions deploy/addons/coredns/coreDNS-controller.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: coredns
namespace: kube-system
labels:
k8s-app: coredns
kubernetes.io/name: "CoreDNS"
addonmanager.kubernetes.io/mode: Reconcile
spec:
replicas: 1
selector:
matchLabels:
k8s-app: coredns
template:
metadata:
labels:
k8s-app: coredns
annotations:
scheduler.alpha.kubernetes.io/critical-pod: ''
scheduler.alpha.kubernetes.io/tolerations: '[{"key":"CriticalAddonsOnly", "operator":"Exists"}]'
spec:
serviceAccountName: coredns
containers:
- name: coredns
image: coredns/coredns:011
imagePullPolicy: Always
args: [ "-conf", "/etc/coredns/Corefile" ]
volumeMounts:
- name: config-volume
mountPath: /etc/coredns
ports:
- containerPort: 53
name: dns
protocol: UDP
- containerPort: 53
name: dns-tcp
protocol: TCP
- containerPort: 9153
name: metrics
protocol: TCP
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
17 changes: 17 additions & 0 deletions deploy/addons/coredns/coreDNS-crbinding.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding
metadata:
annotations:
rbac.authorization.kubernetes.io/autoupdate: "true"
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
7 changes: 7 additions & 0 deletions deploy/addons/coredns/coreDNS-sa.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: v1
kind: ServiceAccount
metadata:
name: coredns
namespace: kube-system
labels:
addonmanager.kubernetes.io/mode: Reconcile
23 changes: 23 additions & 0 deletions deploy/addons/coredns/coreDNS-svc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
apiVersion: v1
kind: Service
metadata:
name: coredns
namespace: kube-system
labels:
k8s-app: coredns
kubernetes.io/name: "CoreDNS"
addonmanager.kubernetes.io/mode: Reconcile
spec:
selector:
k8s-app: coredns
clusterIP: 10.0.0.10
ports:
- name: dns
port: 53
protocol: UDP
- name: dns-tcp
port: 53
protocol: TCP
- name: metrics
port: 9153
protocol: TCP
32 changes: 32 additions & 0 deletions pkg/minikube/assets/addons.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,38 @@ var Addons = map[string]*Addon{
"storageclass.yaml",
"0640"),
}, true, "default-storageclass"),
"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"),
}, false, "coredns"),
"kube-dns": NewAddon([]*BinDataAsset{
NewBinDataAsset(
"deploy/addons/kube-dns/kube-dns-controller.yaml",
Expand Down