netmaker-server.yaml 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  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: DISPLAY_KEYS
  57. value: "on"
  58. - name: DATABASE
  59. value: postgres
  60. - name: SQL_HOST
  61. value: "DB_NAME-postgresql"
  62. - name: SQL_PORT
  63. value: "5432"
  64. - name: SQL_DB
  65. value: "postgres"
  66. - name: SQL_USER
  67. value: "postgres"
  68. - name: SQL_PASS
  69. value: "DB_PASS"
  70. - name: MASTER_KEY
  71. value: REPLACE_MASTER_KEY
  72. - name: CORS_ALLOWED_ORIGIN
  73. value: '*'
  74. - name: SERVER_BROKER_ENDPOINT
  75. value: "ws://mq:1883"
  76. - name: BROKER_ENDPOINT
  77. value: "wss://broker.NETMAKER_BASE_DOMAIN"
  78. - name: PLATFORM
  79. value: "Kubernetes"
  80. - name: VERBOSITY
  81. value: "3"
  82. image: gravitl/netmaker:v0.18.1
  83. imagePullPolicy: Always
  84. name: netmaker
  85. ports:
  86. - containerPort: 8081
  87. protocol: TCP
  88. - containerPort: 31821
  89. protocol: UDP
  90. - containerPort: 31822
  91. protocol: UDP
  92. - containerPort: 31823
  93. protocol: UDP
  94. - containerPort: 31824
  95. protocol: UDP
  96. - containerPort: 31825
  97. protocol: UDP
  98. - containerPort: 31826
  99. protocol: UDP
  100. - containerPort: 31827
  101. protocol: UDP
  102. - containerPort: 31828
  103. protocol: UDP
  104. - containerPort: 31829
  105. protocol: UDP
  106. - containerPort: 31830
  107. protocol: UDP
  108. resources: {}
  109. securityContext:
  110. capabilities:
  111. add:
  112. - NET_ADMIN
  113. - NET_RAW
  114. - SYS_MODULE
  115. volumeMounts:
  116. - mountPath: /etc/netmaker/
  117. name: shared-certs
  118. volumes:
  119. - name: shared-certs
  120. persistentVolumeClaim:
  121. claimName: shared-certs-pvc
  122. ---
  123. apiVersion: v1
  124. kind: Service
  125. metadata:
  126. labels:
  127. name: 'netmaker-wireguard'
  128. spec:
  129. externalTrafficPolicy: Local
  130. type: NodePort
  131. ports:
  132. - port: 31821
  133. nodePort: 31821
  134. protocol: UDP
  135. targetPort: 31821
  136. name: wg-iface-31821
  137. - port: 31822
  138. nodePort: 31822
  139. protocol: UDP
  140. targetPort: 31822
  141. name: wg-iface-31822
  142. - port: 31823
  143. nodePort: 31823
  144. protocol: UDP
  145. targetPort: 31823
  146. name: wg-iface-31823
  147. - port: 31824
  148. nodePort: 31824
  149. protocol: UDP
  150. targetPort: 31824
  151. name: wg-iface-31824
  152. - port: 31825
  153. nodePort: 31825
  154. protocol: UDP
  155. targetPort: 31825
  156. name: wg-iface-31825
  157. - port: 31826
  158. nodePort: 31826
  159. protocol: UDP
  160. targetPort: 31826
  161. name: wg-iface-31826
  162. - port: 31827
  163. nodePort: 31827
  164. protocol: UDP
  165. targetPort: 31827
  166. name: wg-iface-31827
  167. - port: 31828
  168. nodePort: 31828
  169. protocol: UDP
  170. targetPort: 31828
  171. name: wg-iface-31828
  172. - port: 31829
  173. nodePort: 31829
  174. protocol: UDP
  175. targetPort: 31829
  176. name: wg-iface-31829
  177. - port: 31830
  178. nodePort: 31830
  179. protocol: UDP
  180. targetPort: 31830
  181. name: wg-iface-31830
  182. selector:
  183. app: 'netmaker'
  184. ---
  185. apiVersion: v1
  186. kind: Service
  187. metadata:
  188. name: 'netmaker-rest'
  189. spec:
  190. ports:
  191. - name: rest
  192. port: 8081
  193. protocol: TCP
  194. targetPort: 8081
  195. selector:
  196. app: 'netmaker'
  197. sessionAffinity: None
  198. type: ClusterIP
  199. # ---
  200. # apiVersion: networking.k8s.io/v1
  201. # kind: Ingress
  202. # metadata:
  203. # name: nm-api-ingress-nginx
  204. # annotations:
  205. # nginx.ingress.kubernetes.io/rewrite-target: /
  206. # cert-manager.io/cluster-issuer: "letsencrypt-nginx"
  207. # nginx.ingress.kubernetes.io/ssl-redirect: 'true'
  208. # spec:
  209. # ingressClassName: nginx
  210. # tls:
  211. # - hosts:
  212. # - api.NETMAKER_SUBDOMAIN
  213. # secretName: nm-api-tls
  214. # rules:
  215. # - host: api.NETMAKER_SUBDOMAIN
  216. # http:
  217. # paths:
  218. # - path: /
  219. # pathType: Prefix
  220. # backend:
  221. # service:
  222. # name: netmaker-rest
  223. # port:
  224. # number: 8081