pihole.yaml 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. apiVersion: v1
  2. kind: Service
  3. metadata:
  4. name: pihole-tcp
  5. labels:
  6. run: pihole
  7. annotations:
  8. metallb.universe.tf/allow-shared-ip: "pihole"
  9. spec:
  10. ports:
  11. - name: tcpdns
  12. protocol: TCP
  13. port: 53
  14. targetPort: 53
  15. - name: http
  16. protocol: TCP
  17. port: 80
  18. targetPort: 80
  19. selector:
  20. run: pihole
  21. type: LoadBalancer
  22. #status:
  23. # loadBalancer: {}
  24. ---
  25. apiVersion: v1
  26. kind: Service
  27. metadata:
  28. name: pihole-udp
  29. labels:
  30. run: pihole
  31. annotations:
  32. metallb.universe.tf/allow-shared-ip: "pihole"
  33. spec:
  34. ports:
  35. - name: udpdns
  36. protocol: UDP
  37. port: 53
  38. targetPort: 53
  39. # - name: bootps
  40. # protocol: UDP
  41. # port: 67
  42. # targetPort: 53
  43. selector:
  44. run: pihole
  45. type: LoadBalancer
  46. #status:
  47. # loadBalancer: {}
  48. ---
  49. apiVersion: v1
  50. kind: PersistentVolumeClaim
  51. metadata:
  52. name: pihole-config
  53. annotations:
  54. nfs.io/storage-path: "pihole-config"
  55. spec:
  56. storageClassName: managed-nfs-storage
  57. accessModes:
  58. - ReadWriteMany
  59. resources:
  60. requests:
  61. storage: 5Mi
  62. status: {}
  63. ---
  64. apiVersion: v1
  65. kind: PersistentVolumeClaim
  66. metadata:
  67. name: pihole-dnsmasq
  68. annotations:
  69. nfs.io/storage-path: "pihole-dnsmasq"
  70. spec:
  71. storageClassName: managed-nfs-storage
  72. accessModes:
  73. - ReadWriteMany
  74. resources:
  75. requests:
  76. storage: 5Mi
  77. status: {}
  78. ---
  79. apiVersion: apps/v1
  80. kind: Deployment
  81. metadata:
  82. name: pihole
  83. spec:
  84. replicas: 1
  85. selector:
  86. matchLabels:
  87. run: pihole
  88. strategy:
  89. type: Recreate
  90. template:
  91. metadata:
  92. labels:
  93. run: pihole
  94. spec:
  95. containers:
  96. - image: pihole/pihole
  97. name: pihole
  98. env:
  99. - name: TZ
  100. value: US/Michigan
  101. # - name: ADMIN_EMAIL
  102. # value: fred.damstra@gmail.com
  103. # - name: DNS1
  104. # value: 10.42.42.1
  105. # - name: DNS2
  106. # value: 8.8.8.8
  107. ports:
  108. - containerPort: 53
  109. protocol: UDP
  110. - containerPort: 53
  111. protocol: TCP
  112. # - containerPort: 67
  113. # protocol: UDP
  114. - containerPort: 80
  115. protocol: TCP
  116. resources: {}
  117. volumeMounts:
  118. - mountPath: /etc/pihole/
  119. name: pihole-config
  120. - mountPath: /etc/dnsmasq.d/
  121. name: pihole-dnsmasq
  122. securityContext:
  123. capabilities:
  124. add:
  125. - CAP_NET_BIND_SERVICE
  126. restartPolicy: Always
  127. volumes:
  128. - name: pihole-config
  129. persistentVolumeClaim:
  130. claimName: pihole-config
  131. - name: pihole-dnsmasq
  132. persistentVolumeClaim:
  133. claimName: pihole-dnsmasq
  134. status: {}
  135. ---
  136. # Hosting
  137. apiVersion: networking.k8s.io/v1
  138. kind: Ingress
  139. metadata:
  140. name: pihole-ingress
  141. annotations:
  142. cert-manager.io/cluster-issuer: "letsencrypt-prod"
  143. ## No basic auth for pihole
  144. ## type of authentication
  145. #nginx.ingress.kubernetes.io/auth-type: basic
  146. ## name of the secret that contains the user/password definitions
  147. #nginx.ingress.kubernetes.io/auth-secret: basic-auth
  148. ## message to display with an appropriate context why the authentication is required
  149. #nginx.ingress.kubernetes.io/auth-realm: 'Authentication Required - Octoprint'
  150. spec:
  151. tls:
  152. - hosts:
  153. - pihole.monkeybox.org
  154. - dns.monkeybox.org
  155. secretName: pihole-tls
  156. rules:
  157. - host: pihole.monkeybox.org
  158. http:
  159. paths:
  160. - path: /
  161. pathType: Prefix
  162. backend:
  163. service:
  164. name: pihole-tcp
  165. port:
  166. number: 80
  167. - host: dns.monkeybox.org
  168. http:
  169. paths:
  170. - path: /
  171. pathType: Prefix
  172. backend:
  173. service:
  174. name: pihole-tcp
  175. port:
  176. number: 80