kilo-kind-userspace.yaml 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  1. apiVersion: v1
  2. kind: ConfigMap
  3. metadata:
  4. name: kilo
  5. namespace: kube-system
  6. labels:
  7. app.kubernetes.io/name: kilo
  8. data:
  9. cni-conf.json: |
  10. {
  11. "cniVersion":"0.4.0",
  12. "name":"kilo",
  13. "plugins":[
  14. {
  15. "name":"kubernetes",
  16. "type":"bridge",
  17. "bridge":"kube-bridge",
  18. "isDefaultGateway":true,
  19. "forceAddress":true,
  20. "mtu": 1420,
  21. "ipam":{
  22. "type":"host-local"
  23. }
  24. },
  25. {
  26. "type":"portmap",
  27. "snat":true,
  28. "capabilities":{
  29. "portMappings":true
  30. }
  31. }
  32. ]
  33. }
  34. ---
  35. apiVersion: v1
  36. kind: ServiceAccount
  37. metadata:
  38. name: kilo
  39. namespace: kube-system
  40. ---
  41. apiVersion: rbac.authorization.k8s.io/v1
  42. kind: ClusterRole
  43. metadata:
  44. name: kilo
  45. rules:
  46. - apiGroups:
  47. - ""
  48. resources:
  49. - nodes
  50. verbs:
  51. - list
  52. - patch
  53. - watch
  54. - apiGroups:
  55. - kilo.squat.ai
  56. resources:
  57. - peers
  58. verbs:
  59. - list
  60. - watch
  61. - apiGroups:
  62. - apiextensions.k8s.io
  63. resources:
  64. - customresourcedefinitions
  65. verbs:
  66. - get
  67. ---
  68. apiVersion: rbac.authorization.k8s.io/v1
  69. kind: ClusterRoleBinding
  70. metadata:
  71. name: kilo
  72. roleRef:
  73. apiGroup: rbac.authorization.k8s.io
  74. kind: ClusterRole
  75. name: kilo
  76. subjects:
  77. - kind: ServiceAccount
  78. name: kilo
  79. namespace: kube-system
  80. ---
  81. apiVersion: apps/v1
  82. kind: DaemonSet
  83. metadata:
  84. name: kilo
  85. namespace: kube-system
  86. labels:
  87. app.kubernetes.io/name: kilo-userspace
  88. app.kubernetes.io/part-of: kilo
  89. spec:
  90. selector:
  91. matchLabels:
  92. app.kubernetes.io/name: kilo-userspace
  93. app.kubernetes.io/part-of: kilo
  94. template:
  95. metadata:
  96. labels:
  97. app.kubernetes.io/name: kilo-userspace
  98. app.kubernetes.io/part-of: kilo
  99. spec:
  100. serviceAccountName: kilo
  101. hostNetwork: true
  102. containers:
  103. - name: kilo
  104. image: squat/kilo:test
  105. imagePullPolicy: Never
  106. args:
  107. - --hostname=$(NODE_NAME)
  108. - --create-interface=false
  109. - --mesh-granularity=full
  110. - --kubeconfig=/etc/kubernetes/kubeconfig
  111. - --internal-cidr=$(NODE_IP)/32
  112. env:
  113. - name: NODE_NAME
  114. valueFrom:
  115. fieldRef:
  116. fieldPath: spec.nodeName
  117. - name: NODE_IP
  118. valueFrom:
  119. fieldRef:
  120. fieldPath: status.hostIP
  121. ports:
  122. - containerPort: 1107
  123. name: metrics
  124. securityContext:
  125. privileged: true
  126. volumeMounts:
  127. - name: cni-conf-dir
  128. mountPath: /etc/cni/net.d
  129. - name: kilo-dir
  130. mountPath: /var/lib/kilo
  131. - name: lib-modules
  132. mountPath: /lib/modules
  133. readOnly: true
  134. - name: xtables-lock
  135. mountPath: /run/xtables.lock
  136. readOnly: false
  137. - name: wireguard
  138. mountPath: /var/run/wireguard
  139. readOnly: false
  140. - name: kubeconfig
  141. mountPath: /etc/kubernetes
  142. readOnly: true
  143. - name: wireguard
  144. image: ghcr.io/masipcat/wireguard-go-docker:0.0.20230223
  145. args:
  146. - wireguard-go
  147. - --foreground
  148. - kilo0
  149. securityContext:
  150. privileged: true
  151. volumeMounts:
  152. - name: wireguard
  153. mountPath: /var/run/wireguard
  154. readOnly: false
  155. initContainers:
  156. - name: install-cni
  157. image: squat/kilo:test
  158. imagePullPolicy: Never
  159. command:
  160. - /bin/sh
  161. - -c
  162. - |
  163. set -e -x;
  164. cp /opt/cni/bin/* /host/opt/cni/bin/;
  165. TMP_CONF="$CNI_CONF_NAME".tmp;
  166. echo "$CNI_NETWORK_CONFIG" > $TMP_CONF;
  167. rm -f /host/etc/cni/net.d/*;
  168. mv $TMP_CONF /host/etc/cni/net.d/$CNI_CONF_NAME
  169. env:
  170. - name: CNI_CONF_NAME
  171. value: 10-kilo.conflist
  172. - name: CNI_NETWORK_CONFIG
  173. valueFrom:
  174. configMapKeyRef:
  175. name: kilo
  176. key: cni-conf.json
  177. volumeMounts:
  178. - name: cni-bin-dir
  179. mountPath: /host/opt/cni/bin
  180. - name: cni-conf-dir
  181. mountPath: /host/etc/cni/net.d
  182. tolerations:
  183. - effect: NoSchedule
  184. operator: Exists
  185. - effect: NoExecute
  186. operator: Exists
  187. volumes:
  188. - name: cni-bin-dir
  189. hostPath:
  190. path: /opt/cni/bin
  191. - name: cni-conf-dir
  192. hostPath:
  193. path: /etc/cni/net.d
  194. - name: kilo-dir
  195. hostPath:
  196. path: /var/lib/kilo
  197. - name: lib-modules
  198. hostPath:
  199. path: /lib/modules
  200. - name: xtables-lock
  201. hostPath:
  202. path: /run/xtables.lock
  203. type: FileOrCreate
  204. - name: wireguard
  205. hostPath:
  206. path: /var/run/wireguard
  207. - name: kubeconfig
  208. secret:
  209. secretName: kubeconfig