Skip to content
This repository was archived by the owner on Sep 30, 2020. It is now read-only.

Commit d9906df

Browse files
committed
Always create required dnsmasq resources
The dnsmasq-node ServiceAccount must exist whether or not CoreDNS-local has been enabled. Therefore, it is created alongside the DaemonSet rather than as part of the coredns-local manifest. Additionally, always create dnsmasq-node-coredns-local.yaml If this file does not exist (as would be the case if the CoreDNS local feature has not been enabled), controller nodes will fail to come up with the error: > error: the path "/srv/kubernetes/manifests/dnsmasq-node-coredns-local.yaml" does not exist This is caused when `kubectl delete` is called against the file because of the line `remove "${mfdir}/dnsmasq-node-coredns-local.yaml`. This manifest must always be generated because the CoreDNS-local feature cannot be enabled and then later disabled without otherwise requiring manual operator intervention.
1 parent 133ae0b commit d9906df

File tree

1 file changed

+42
-44
lines changed

1 file changed

+42
-44
lines changed

builtin/files/userdata/cloud-config-controller

+42-44
Original file line numberDiff line numberDiff line change
@@ -5479,51 +5479,8 @@ write_files:
54795479
- --v=2
54805480
- --logtostderr
54815481

5482-
{{ if and .KubeDns.NodeLocalResolver .KubeDns.DNSMasq.CoreDNSLocal.Enabled }}
54835482
- path: /srv/kubernetes/manifests/dnsmasq-node-coredns-local.yaml
54845483
content: |
5485-
apiVersion: v1
5486-
kind: ServiceAccount
5487-
metadata:
5488-
name: dnsmasq
5489-
namespace: kube-system
5490-
---
5491-
apiVersion: rbac.authorization.k8s.io/v1
5492-
kind: ClusterRole
5493-
metadata:
5494-
name: dnsmasq
5495-
rules:
5496-
- apiGroups: [""]
5497-
resources: ["endpoints", "services", "pods", "namespaces"]
5498-
verbs: ["list", "watch"]
5499-
---
5500-
apiVersion: rbac.authorization.k8s.io/v1
5501-
kind: ClusterRoleBinding
5502-
metadata:
5503-
name: dnsmasq
5504-
roleRef:
5505-
apiGroup: rbac.authorization.k8s.io
5506-
kind: ClusterRole
5507-
name: dnsmasq
5508-
subjects:
5509-
- kind: ServiceAccount
5510-
name: dnsmasq
5511-
namespace: kube-system
5512-
---
5513-
apiVersion: rbac.authorization.k8s.io/v1
5514-
kind: RoleBinding
5515-
metadata:
5516-
name: dnsmasq-privileged-psp
5517-
namespace: kube-system
5518-
roleRef:
5519-
apiGroup: rbac.authorization.k8s.io
5520-
kind: ClusterRole
5521-
name: privileged-psp
5522-
subjects:
5523-
- kind: ServiceAccount
5524-
name: dnsmasq
5525-
namespace: kube-system
5526-
---
55275484
apiVersion: v1
55285485
kind: ConfigMap
55295486
metadata:
@@ -5556,11 +5513,52 @@ write_files:
55565513
cache 30
55575514
reload
55585515
}
5559-
{{ end }}
55605516

55615517
{{ if .KubeDns.NodeLocalResolver }}
55625518
- path: /srv/kubernetes/manifests/dnsmasq-node-ds.yaml
55635519
content: |
5520+
apiVersion: v1
5521+
kind: ServiceAccount
5522+
metadata:
5523+
name: dnsmasq
5524+
namespace: kube-system
5525+
---
5526+
apiVersion: rbac.authorization.k8s.io/v1
5527+
kind: ClusterRole
5528+
metadata:
5529+
name: dnsmasq
5530+
rules:
5531+
- apiGroups: [""]
5532+
resources: ["endpoints", "services", "pods", "namespaces"]
5533+
verbs: ["list", "watch"]
5534+
---
5535+
apiVersion: rbac.authorization.k8s.io/v1
5536+
kind: ClusterRoleBinding
5537+
metadata:
5538+
name: dnsmasq
5539+
roleRef:
5540+
apiGroup: rbac.authorization.k8s.io
5541+
kind: ClusterRole
5542+
name: dnsmasq
5543+
subjects:
5544+
- kind: ServiceAccount
5545+
name: dnsmasq
5546+
namespace: kube-system
5547+
---
5548+
apiVersion: rbac.authorization.k8s.io/v1
5549+
kind: RoleBinding
5550+
metadata:
5551+
name: dnsmasq-privileged-psp
5552+
namespace: kube-system
5553+
roleRef:
5554+
apiGroup: rbac.authorization.k8s.io
5555+
kind: ClusterRole
5556+
name: privileged-psp
5557+
subjects:
5558+
- kind: ServiceAccount
5559+
name: dnsmasq
5560+
namespace: kube-system
5561+
---
55645562
apiVersion: apps/v1
55655563
kind: DaemonSet
55665564
metadata:

0 commit comments

Comments
 (0)