unifi.yaml 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. apiVersion: v1
  2. kind: Service
  3. metadata:
  4. name: unifi-tcp
  5. labels:
  6. run: unifi
  7. annotations:
  8. metallb.universe.tf/allow-shared-ip: "unifi"
  9. spec:
  10. ports:
  11. - name: unifi-device-communication
  12. protocol: TCP
  13. port: 8080
  14. targetPort: 8080
  15. - name: unifi-management
  16. protocol: TCP
  17. port: 8443
  18. targetPort: 8443
  19. - name: unifi-guest-https
  20. protocol: TCP
  21. port: 8843
  22. targetPort: 8843
  23. - name: unifi-guest-http
  24. protocol: TCP
  25. port: 8880
  26. targetPort: 8880
  27. - name: unifi-mobile-throughput
  28. protocol: TCP
  29. port: 6789
  30. targetPort: 6789
  31. selector:
  32. run: unifi
  33. type: LoadBalancer
  34. loadBalancerIP: 10.42.42.240
  35. ---
  36. apiVersion: v1
  37. kind: Service
  38. metadata:
  39. name: unifi-udp
  40. labels:
  41. run: unifi
  42. annotations:
  43. metallb.universe.tf/allow-shared-ip: "unifi"
  44. spec:
  45. ports:
  46. - name: stun
  47. protocol: UDP
  48. port: 3478
  49. targetPort: 3478
  50. - name: ap-discovery
  51. protocol: UDP
  52. port: 10001
  53. targetPort: 10001
  54. - name: unifi-make-controller-discoverable
  55. protocol: UDP
  56. port: 1900
  57. targetPort: 1900
  58. - name: unifi-syslog
  59. protocol: UDP
  60. port: 5514
  61. targetPort: 5514
  62. selector:
  63. run: unifi
  64. type: LoadBalancer
  65. loadBalancerIP: 10.42.42.240
  66. ---
  67. apiVersion: v1
  68. kind: PersistentVolume
  69. metadata:
  70. name: unifi
  71. spec:
  72. capacity:
  73. storage: 5Mi
  74. volumeMode: Filesystem
  75. accessModes:
  76. - ReadWriteMany
  77. persistentVolumeReclaimPolicy: Retain # Keep 4eva
  78. storageClassName: default
  79. mountOptions:
  80. - hard
  81. - nfsvers=3
  82. nfs:
  83. path: /mnt/DroboFS/Shares/Kubernetes/volumes/static/unifi
  84. server: 10.42.42.10
  85. claimRef:
  86. name: unifi
  87. namespace: default
  88. ---
  89. apiVersion: v1
  90. kind: PersistentVolumeClaim
  91. metadata:
  92. name: unifi
  93. annotations:
  94. nfs.io/storage-path: "unifi"
  95. spec:
  96. storageClassName: default
  97. accessModes:
  98. - ReadWriteMany
  99. resources:
  100. requests:
  101. storage: 5Mi
  102. status: {}
  103. ---
  104. apiVersion: apps/v1
  105. kind: Deployment
  106. metadata:
  107. name: unifi
  108. spec:
  109. replicas: 1
  110. selector:
  111. matchLabels:
  112. run: unifi
  113. strategy:
  114. type: Recreate
  115. template:
  116. metadata:
  117. labels:
  118. run: unifi
  119. spec:
  120. terminationGracePeriodSeconds: 30
  121. containers:
  122. - image: linuxserver/unifi-controller
  123. imagePullPolicy: "Always"
  124. name: unifi
  125. env:
  126. - name: TZ
  127. value: US/Michigan
  128. # PUID and PGID are for volume permissions
  129. # - name: PUID
  130. # value: "1000"
  131. # - name: PGID
  132. # value: "1000"
  133. - name: MEM_LIMIT
  134. value: "1024"
  135. ports:
  136. - containerPort: 3478
  137. protocol: UDP
  138. - containerPort: 10001
  139. protocol: UDP
  140. - containerPort: 8080
  141. protocol: TCP
  142. - containerPort: 8443
  143. protocol: TCP
  144. - containerPort: 1900
  145. protocol: UDP
  146. - containerPort: 8843
  147. protocol: TCP
  148. - containerPort: 8880
  149. protocol: TCP
  150. - containerPort: 6789
  151. protocol: TCP
  152. - containerPort: 5514
  153. protocol: UDP
  154. resources: {}
  155. volumeMounts:
  156. - mountPath: /config
  157. name: unifi
  158. restartPolicy: Always
  159. volumes:
  160. - name: unifi
  161. persistentVolumeClaim:
  162. claimName: unifi
  163. dnsPolicy: "None"
  164. dnsConfig:
  165. nameservers:
  166. - 10.42.42.239
  167. - 10.42.42.1
  168. searches:
  169. - default.svc.cluster.local
  170. - svc.cluster.local
  171. - cluster.local
  172. options:
  173. - name: ndots
  174. value: "2"
  175. - name: edns0
  176. - name: trust-ad
  177. status: {}
  178. ---
  179. # Hosting
  180. apiVersion: networking.k8s.io/v1
  181. kind: Ingress
  182. metadata:
  183. name: unifi-management
  184. annotations:
  185. nginx.ingress.kubernetes.io/backend-protocol: "HTTPS"
  186. nginx.ingress.kubernetes.io/proxy-ssl-verify: "off"
  187. cert-manager.io/cluster-issuer: "letsencrypt-prod"
  188. spec:
  189. tls:
  190. - hosts:
  191. - unifi.monkeybox.org
  192. secretName: unifi-tls
  193. rules:
  194. - host: unifi.monkeybox.org
  195. http:
  196. paths:
  197. - path: /
  198. pathType: Prefix
  199. backend:
  200. service:
  201. name: unifi-tcp
  202. port:
  203. number: 8443