monkeybox.yaml 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. apiVersion: v1
  2. kind: Service
  3. metadata:
  4. name: monkeybox
  5. labels:
  6. run: monkeybox
  7. spec:
  8. ports:
  9. - name: http
  10. port: 80
  11. targetPort: 80
  12. selector:
  13. run: monkeybox
  14. # type: LoadBalancer
  15. # Uncomment the following if you wnat to expose an IP
  16. #status:
  17. # loadBalancer: {}
  18. ---
  19. apiVersion: v1
  20. kind: PersistentVolume
  21. metadata:
  22. name: monkeybox
  23. spec:
  24. capacity:
  25. storage: 5Mi
  26. volumeMode: Filesystem
  27. accessModes:
  28. - ReadWriteOnce
  29. persistentVolumeReclaimPolicy: Retain # Keep 4eva
  30. storageClassName: default
  31. mountOptions:
  32. - hard
  33. - nfsvers=3
  34. nfs:
  35. path: /mnt/DroboFS/Shares/Kubernetes/volumes/static/monkeybox
  36. server: 10.42.42.10
  37. claimRef:
  38. name: monkeybox
  39. namespace: default
  40. ---
  41. apiVersion: v1
  42. kind: PersistentVolumeClaim
  43. metadata:
  44. name: monkeybox
  45. annotations:
  46. nfs.io/storage-path: "monkeybox"
  47. spec:
  48. storageClassName: default
  49. accessModes:
  50. - ReadWriteOnce
  51. resources:
  52. requests:
  53. storage: 5Mi
  54. status: {}
  55. ---
  56. apiVersion: apps/v1
  57. kind: Deployment
  58. metadata:
  59. name: monkeybox
  60. spec:
  61. replicas: 1
  62. selector:
  63. matchLabels:
  64. run: monkeybox
  65. strategy:
  66. type: Recreate
  67. template:
  68. metadata:
  69. labels:
  70. run: monkeybox
  71. spec:
  72. terminationGracePeriodSeconds: 30
  73. containers:
  74. - image: nginx
  75. imagePullPolicy: "Always"
  76. name: monkeybox
  77. ports:
  78. - containerPort: 80
  79. resources: {}
  80. volumeMounts:
  81. - mountPath: /usr/share/nginx/html
  82. name: monkeybox
  83. restartPolicy: Always
  84. # This didn't seem to do what I want/need
  85. # affinity:
  86. # podAntiAffinity:
  87. # requiredDuringSchedulingIgnoredDuringExecution: #<---- hard requirement not to schedule "nginx" pod if already one scheduled.
  88. # - topologyKey: kubernetes.io/hostname # <---- Anti affinity scope is host
  89. # labelSelector:
  90. # matchLabels:
  91. # app: monkeybox
  92. topologySpreadConstraints:
  93. - maxSkew: 1
  94. topologyKey: kubernetes.io/hostname
  95. whenUnsatisfiable: DoNotSchedule
  96. labelSelector:
  97. matchLabels:
  98. app: monkeybox
  99. volumes:
  100. - name: monkeybox
  101. persistentVolumeClaim:
  102. claimName: monkeybox
  103. dnsConfig:
  104. # nameservers:
  105. # - 10.42.42.239
  106. # - 10.42.42.1
  107. searches:
  108. - default.svc.cluster.local
  109. - svc.cluster.local
  110. - cluster.local
  111. # options:
  112. # - name: ndots
  113. # value: "2"
  114. # - name: edns0
  115. # - name: trust-ad
  116. status: {}
  117. ---
  118. # Hosting
  119. apiVersion: networking.k8s.io/v1
  120. kind: Ingress
  121. metadata:
  122. name: monkeybox-ingress
  123. annotations:
  124. cert-manager.io/cluster-issuer: "letsencrypt-prod"
  125. ## basic auth for monkeybox
  126. # type of authentication
  127. #nginx.ingress.kubernetes.io/auth-type: basic
  128. # name of the secret that contains the user/password definitions
  129. #nginx.ingress.kubernetes.io/auth-secret: basic-auth
  130. ## message to display with an appropriate context why the authentication is required
  131. #nginx.ingress.kubernetes.io/auth-realm: 'Authentication Required - Octoprint'
  132. nginx.ingress.kubernetes.io/enable-cors: "true"
  133. nginx.ingress.kubernetes.io/cors-allow-origin: "*"
  134. nginx.ingress.kubernetes.io/cors-allow-methods: "GET, HEAD, OPTIONS"
  135. nginx.ingress.kubernetes.io/cors-allow-headers: "Origin, X-Requested-With, Content-Type, Accept, Authorization"
  136. spec:
  137. tls:
  138. - hosts:
  139. - monkeybox.org
  140. - www.monkeybox.org
  141. secretName: monkeybox-tls
  142. rules:
  143. - host: monkeybox.org
  144. http:
  145. paths:
  146. - path: /
  147. pathType: Prefix
  148. backend:
  149. service:
  150. name: monkeybox
  151. port:
  152. number: 80
  153. - host: www.monkeybox.org
  154. http:
  155. paths:
  156. - path: /
  157. pathType: Prefix
  158. backend:
  159. service:
  160. name: monkeybox
  161. port:
  162. number: 80