-
Notifications
You must be signed in to change notification settings - Fork 1
/
dhcp-daemonset.yaml
106 lines (103 loc) · 2.71 KB
/
dhcp-daemonset.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
kind: ConfigMap
apiVersion: v1
metadata:
name: kube-dhcp-cfg
namespace: kube-system
labels:
tier: node
app: dhcp
data:
# We require `br0` interface to be already created before bootstrapping
# the kubernetes cluster.
bridge.conf: |
{
"name": "bridgenet",
"type": "bridge",
"bridge": "br0",
"ipMasq": false,
"isDefaultGateway": false,
"hairpinMode": false,
"ipam": {
"type": "dhcp"
}
}
---
apiVersion: extensions/v1beta1
kind: DaemonSet
metadata:
name: kube-dhcp-daemon
namespace: kube-system
labels:
tier: node
app: dhcp
spec:
updateStrategy:
type: RollingUpdate
template:
metadata:
labels:
tier: node
app: dhcp
spec:
# Need to be hostNetwork: true for socket files to work
hostNetwork: true
# Need to be hostPID: true so that dhcp process can access all of the netns entries in /proc
# for all of the containers being spun up (otherwise dhcp would only see itslef in /proc)
hostPID: true
nodeSelector:
beta.kubernetes.io/arch: amd64
tolerations:
- key: node-role.kubernetes.io/master
operator: Exists
effect: NoSchedule
initContainers:
- name: install-cni
# This image can be any image with `cp` binary available
image: busybox
# Set up the bridge CNI config file on the host. Pre-requisite is that a br0 bridge interface
# was set up and bridged to the LAN
command:
- cp
args:
- -f
- /cfg/bridge.conf
- /etc/cni/net.d/10-bridge.conf
volumeMounts:
- name: cni
mountPath: /etc/cni/net.d
- name: dhcp-cfg
mountPath: /cfg
containers:
- name: kube-dhcp
# This can be any image with /bin/sh, rm, and the CGO_ENABLED=0 compiled
# dhcp daemon at /dhcp. Busybox is a perfectly fine base tiny image.
image: opensourcelan/dhcp-cni-plugin:20180718-194152
command:
- /bin/sh
args:
- -c
# Gotta rm the sock file first; this daemon doesn't clean up its own and
# it crashes if it already exists
- 'rm -f /run/cni/dhcp.sock; exec /dhcp daemon'
resources:
requests:
cpu: "10m"
memory: "50Mi"
limits:
cpu: "100m"
memory: "50Mi"
securityContext:
privileged: true
volumeMounts:
- name: run
mountPath: /run
volumes:
- name: run
hostPath:
path: /run
- name: cni
hostPath:
path: /etc/cni/net.d
- name: dhcp-cfg
configMap:
name: kube-dhcp-cfg