unifi.yaml 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  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. ---
  35. apiVersion: v1
  36. kind: Service
  37. metadata:
  38. name: unifi-udp
  39. labels:
  40. run: unifi
  41. annotations:
  42. metallb.universe.tf/allow-shared-ip: "unifi"
  43. spec:
  44. ports:
  45. - name: stun
  46. protocol: UDP
  47. port: 3478
  48. targetPort: 3478
  49. - name: ap-discovery
  50. protocol: UDP
  51. port: 10001
  52. targetPort: 10001
  53. - name: unifi-make-controller-discoverable
  54. protocol: UDP
  55. port: 1900
  56. targetPort: 1900
  57. - name: unifi-syslog
  58. protocol: UDP
  59. port: 5514
  60. targetPort: 5514
  61. selector:
  62. run: unifi
  63. type: LoadBalancer
  64. ---
  65. apiVersion: v1
  66. kind: PersistentVolumeClaim
  67. metadata:
  68. name: unifi
  69. annotations:
  70. nfs.io/storage-path: "unifi"
  71. spec:
  72. storageClassName: managed-nfs-storage
  73. accessModes:
  74. - ReadOnlyMany
  75. resources:
  76. requests:
  77. storage: 5Mi
  78. status: {}
  79. ---
  80. apiVersion: apps/v1
  81. kind: Deployment
  82. metadata:
  83. name: unifi
  84. spec:
  85. replicas: 1
  86. selector:
  87. matchLabels:
  88. run: unifi
  89. strategy:
  90. type: Recreate
  91. template:
  92. metadata:
  93. labels:
  94. run: unifi
  95. spec:
  96. containers:
  97. - image: linuxserver/unifi-controller
  98. name: unifi
  99. env:
  100. - name: TZ
  101. value: US/Michigan
  102. # PUID and PGID are for volume permissions
  103. # - name: PUID
  104. # value: "1000"
  105. # - name: PGID
  106. # value: "1000"
  107. - name: MEM_LIMIT
  108. value: "1024M"
  109. ports:
  110. - containerPort: 3478
  111. protocol: UDP
  112. - containerPort: 10001
  113. protocol: UDP
  114. - containerPort: 8080
  115. protocol: TCP
  116. - containerPort: 8443
  117. protocol: TCP
  118. - containerPort: 1900
  119. protocol: UDP
  120. - containerPort: 8843
  121. protocol: TCP
  122. - containerPort: 8880
  123. protocol: TCP
  124. - containerPort: 6789
  125. protocol: TCP
  126. - containerPort: 5514
  127. protocol: UDP
  128. resources: {}
  129. volumeMounts:
  130. - mountPath: /config
  131. name: unifi
  132. restartPolicy: Always
  133. volumes:
  134. - name: unifi
  135. persistentVolumeClaim:
  136. claimName: unifi
  137. status: {}
  138. ---
  139. # Hosting
  140. apiVersion: networking.k8s.io/v1
  141. kind: Ingress
  142. metadata:
  143. name: unifi-management
  144. annotations:
  145. nginx.ingress.kubernetes.io/backend-protocol: "HTTPS"
  146. nginx.ingress.kubernetes.io/proxy-ssl-verify: "off"
  147. cert-manager.io/cluster-issuer: "letsencrypt-prod"
  148. spec:
  149. tls:
  150. - hosts:
  151. - unifi.monkeybox.org
  152. secretName: unifi-tls
  153. rules:
  154. - host: unifi.monkeybox.org
  155. http:
  156. paths:
  157. - path: /
  158. pathType: Prefix
  159. backend:
  160. service:
  161. name: unifi-tcp
  162. port:
  163. number: 8443