-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcni.yaml
159 lines (159 loc) · 5.17 KB
/
cni.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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
---
# The webmesh-node DaemonSet is used to install the webmesh-cni binaries
# and configuration on each node in the cluster. It also runs the
# webmesh-cni-node binary as a privileged container to manage the
# network interfaces on each node.
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: webmesh-node
namespace: kube-system
labels:
k8s-app: webmesh-cni
spec:
selector:
matchLabels:
k8s-app: webmesh-cni
updateStrategy:
type: RollingUpdate
rollingUpdate:
maxUnavailable: 1
template:
metadata:
labels:
k8s-app: webmesh-cni
spec:
serviceAccountName: webmesh-cni-sa
terminationGracePeriodSeconds: 0
priorityClassName: system-node-critical
nodeSelector:
kubernetes.io/os: linux
hostNetwork: true
tolerations:
- effect: NoSchedule
operator: Exists
- key: CriticalAddonsOnly
operator: Exists
- effect: NoExecute
operator: Exists
- key: node-role.kubernetes.io/master
effect: NoSchedule
initContainers:
- name: install-cni
image: ghcr.io/webmeshproj/webmesh-cni:latest
imagePullPolicy: IfNotPresent
command: ["/webmesh-cni-install"]
env:
# Paths to install the CNI binaries and config.
- name: WEBMESH_CNI_BIN_DIR
value: "/host/opt/cni/bin"
- name: WEBMESH_CNI_CONF_DIR
value: "/host/etc/cni/net.d"
# Name of the CNI config file to create.
- name: WEBMESH_CNI_CONF_NAME
value: "10-webmesh.conflist"
# The CNI network config to install on each node.
- name: WEBMESH_CNI_NETWORK_CONFIG
valueFrom:
configMapKeyRef:
name: webmesh-config
key: cni-network-config
# Set the hostname based on the k8s node name.
- name: KUBERNETES_NODE_NAME
valueFrom:
fieldRef:
fieldPath: spec.nodeName
# Set the namespace to use based on the one we are running.
- name: KUBERNETES_POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
volumeMounts:
- mountPath: /host/opt/cni/bin
name: cni-bin-dir
- mountPath: /host/etc/cni/net.d
name: cni-net-dir
securityContext:
privileged: true
containers:
- name: webmesh-node
image: ghcr.io/webmeshproj/webmesh-cni:latest
imagePullPolicy: IfNotPresent
command: ["/webmesh-cni-node"]
env:
# Use the kubernetes storage provider. This is the only
# supported storage provider at the moment for k8s.
- name: STORAGE_PROVIDER
value: "kubernetes"
# Set the hostname based on the k8s node name.
- name: KUBERNETES_NODE_NAME
valueFrom:
fieldRef:
fieldPath: spec.nodeName
# Set the namespace to use based on the one we are running.
- name: KUBERNETES_POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
# Set the pod cidr based on the one we are running.
- name: WEBMESH_CNI_POD_CIDR
valueFrom:
configMapKeyRef:
name: webmesh-config
key: pod-cidr
# Set the pod cidr based on the one we are running.
- name: WEBMESH_CNI_SERVICE_CIDR
valueFrom:
configMapKeyRef:
name: webmesh-config
key: service-cidr
# Set the cluster domain based on the one we are running.
- name: WEBMESH_CNI_CLUSTER_DOMAIN
valueFrom:
configMapKeyRef:
name: webmesh-config
key: cluster-domain
readinessProbe:
httpGet:
path: /healthz
port: 8081
initialDelaySeconds: 5
periodSeconds: 5
timeoutSeconds: 5
livenessProbe:
httpGet:
path: /healthz
port: 8081
initialDelaySeconds: 15
periodSeconds: 20
timeoutSeconds: 5
volumeMounts:
- mountPath: /lib/modules
name: lib-modules
readOnly: true
- mountPath: /dev/net/tun
name: dev-tun
- mountPath: /var/run/netns
name: host-netns
mountPropagation: Bidirectional
securityContext:
privileged: true
resources:
requests:
cpu: 250m
volumes:
- name: dev-tun
hostPath:
path: /dev/net/tun
- name: lib-modules
hostPath:
path: /lib/modules
- name: cni-bin-dir
hostPath:
path: /opt/cni/bin
- name: cni-net-dir
hostPath:
path: /etc/cni/net.d
- name: host-netns
hostPath:
path: /var/run/netns