netmaker-server.yaml 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  1. apiVersion: apps/v1
  2. kind: StatefulSet
  3. metadata:
  4. labels:
  5. app: netmaker
  6. name: netmaker
  7. spec:
  8. replicas: 3
  9. serviceName: netmaker-headless
  10. selector:
  11. matchLabels:
  12. app: netmaker
  13. template:
  14. metadata:
  15. labels:
  16. app: netmaker
  17. spec:
  18. initContainers:
  19. - name: init-sysctl
  20. image: busybox
  21. imagePullPolicy: IfNotPresent
  22. command: ["/bin/sh", "-c"]
  23. args: ["sysctl -w net.ipv4.ip_forward=1 && sysctl -w net.ipv4.conf.all.src_valid_mark=1 && sysctl -w net.ipv6.conf.all.disable_ipv6=0 && sysctl -w net.ipv6.conf.all.forwarding=1"]
  24. securityContext:
  25. privileged: true
  26. dnsPolicy: ClusterFirstWithHostNet
  27. affinity:
  28. podAntiAffinity:
  29. requiredDuringSchedulingIgnoredDuringExecution:
  30. - labelSelector:
  31. matchExpressions:
  32. - key: app
  33. operator: In
  34. values:
  35. - netmaker
  36. topologyKey: "kubernetes.io/hostname"
  37. containers:
  38. - env:
  39. - name: NODE_ID
  40. valueFrom:
  41. fieldRef:
  42. apiVersion: v1
  43. fieldPath: metadata.name
  44. - name: SERVER_NAME
  45. value: broker.NETMAKER_SUBDOMAIN
  46. - name: SERVER_API_CONN_STRING
  47. value: api.NETMAKER_SUBDOMAIN:443
  48. - name: SERVER_HTTP_HOST
  49. value: api.NETMAKER_SUBDOMAIN
  50. - name: API_PORT
  51. value: "8081"
  52. - name: WG_QUICK_USERSPACE_IMPLEMENTATION
  53. value: wireguard-go
  54. - name: DNS_MODE
  55. value: "off"
  56. - name: CLIENT_MODE
  57. value: "on"
  58. - name: DISPLAY_KEYS
  59. value: "on"
  60. - name: DATABASE
  61. value: postgres
  62. - name: SQL_HOST
  63. value: "DB_NAME-postgresql"
  64. - name: SQL_PORT
  65. value: "5432"
  66. - name: SQL_DB
  67. value: "postgres"
  68. - name: SQL_USER
  69. value: "postgres"
  70. - name: SQL_PASS
  71. value: "DB_PASS"
  72. - name: MASTER_KEY
  73. value: REPLACE_MASTER_KEY
  74. - name: CORS_ALLOWED_ORIGIN
  75. value: '*'
  76. - name: MQ_HOST
  77. value: "mq"
  78. - name: MQ_PORT
  79. value: "443"
  80. - name: MQ_SERVER_PORT
  81. value: "1883"
  82. - name: PLATFORM
  83. value: "Kubernetes"
  84. - name: VERBOSITY
  85. value: "3"
  86. image: gravitl/netmaker:v0.17.1
  87. imagePullPolicy: Always
  88. name: netmaker
  89. ports:
  90. - containerPort: 8081
  91. protocol: TCP
  92. - containerPort: 31821
  93. protocol: UDP
  94. - containerPort: 31822
  95. protocol: UDP
  96. - containerPort: 31823
  97. protocol: UDP
  98. - containerPort: 31824
  99. protocol: UDP
  100. - containerPort: 31825
  101. protocol: UDP
  102. - containerPort: 31826
  103. protocol: UDP
  104. - containerPort: 31827
  105. protocol: UDP
  106. - containerPort: 31828
  107. protocol: UDP
  108. - containerPort: 31829
  109. protocol: UDP
  110. - containerPort: 31830
  111. protocol: UDP
  112. resources: {}
  113. securityContext:
  114. capabilities:
  115. add:
  116. - NET_ADMIN
  117. - NET_RAW
  118. - SYS_MODULE
  119. volumeMounts:
  120. - mountPath: /etc/netmaker/
  121. name: shared-certs
  122. volumes:
  123. - name: shared-certs
  124. persistentVolumeClaim:
  125. claimName: shared-certs-pvc
  126. ---
  127. apiVersion: v1
  128. kind: Service
  129. metadata:
  130. labels:
  131. name: 'netmaker-wireguard'
  132. spec:
  133. externalTrafficPolicy: Local
  134. type: NodePort
  135. ports:
  136. - port: 31821
  137. nodePort: 31821
  138. protocol: UDP
  139. targetPort: 31821
  140. name: wg-iface-31821
  141. - port: 31822
  142. nodePort: 31822
  143. protocol: UDP
  144. targetPort: 31822
  145. name: wg-iface-31822
  146. - port: 31823
  147. nodePort: 31823
  148. protocol: UDP
  149. targetPort: 31823
  150. name: wg-iface-31823
  151. - port: 31824
  152. nodePort: 31824
  153. protocol: UDP
  154. targetPort: 31824
  155. name: wg-iface-31824
  156. - port: 31825
  157. nodePort: 31825
  158. protocol: UDP
  159. targetPort: 31825
  160. name: wg-iface-31825
  161. - port: 31826
  162. nodePort: 31826
  163. protocol: UDP
  164. targetPort: 31826
  165. name: wg-iface-31826
  166. - port: 31827
  167. nodePort: 31827
  168. protocol: UDP
  169. targetPort: 31827
  170. name: wg-iface-31827
  171. - port: 31828
  172. nodePort: 31828
  173. protocol: UDP
  174. targetPort: 31828
  175. name: wg-iface-31828
  176. - port: 31829
  177. nodePort: 31829
  178. protocol: UDP
  179. targetPort: 31829
  180. name: wg-iface-31829
  181. - port: 31830
  182. nodePort: 31830
  183. protocol: UDP
  184. targetPort: 31830
  185. name: wg-iface-31830
  186. selector:
  187. app: 'netmaker'
  188. ---
  189. apiVersion: v1
  190. kind: Service
  191. metadata:
  192. name: 'netmaker-rest'
  193. spec:
  194. ports:
  195. - name: rest
  196. port: 8081
  197. protocol: TCP
  198. targetPort: 8081
  199. selector:
  200. app: 'netmaker'
  201. sessionAffinity: None
  202. type: ClusterIP
  203. # ---
  204. # apiVersion: networking.k8s.io/v1
  205. # kind: Ingress
  206. # metadata:
  207. # name: nm-api-ingress-nginx
  208. # annotations:
  209. # nginx.ingress.kubernetes.io/rewrite-target: /
  210. # cert-manager.io/cluster-issuer: "letsencrypt-nginx"
  211. # nginx.ingress.kubernetes.io/ssl-redirect: 'true'
  212. # spec:
  213. # ingressClassName: nginx
  214. # tls:
  215. # - hosts:
  216. # - api.NETMAKER_SUBDOMAIN
  217. # secretName: nm-api-tls
  218. # rules:
  219. # - host: api.NETMAKER_SUBDOMAIN
  220. # http:
  221. # paths:
  222. # - path: /
  223. # pathType: Prefix
  224. # backend:
  225. # service:
  226. # name: netmaker-rest
  227. # port:
  228. # number: 8081