index.yaml 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. apiVersion: v1
  2. kind: Service
  3. metadata:
  4. name: index
  5. labels:
  6. run: index
  7. spec:
  8. ports:
  9. - name: http
  10. port: 80
  11. targetPort: 80
  12. selector:
  13. run: index
  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: index
  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/index
  36. server: 10.42.42.10
  37. claimRef:
  38. name: index
  39. namespace: default
  40. ---
  41. apiVersion: v1
  42. kind: PersistentVolumeClaim
  43. metadata:
  44. name: index
  45. annotations:
  46. nfs.io/storage-path: "index"
  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: index
  60. spec:
  61. replicas: 2
  62. selector:
  63. matchLabels:
  64. run: index
  65. strategy:
  66. type: Recreate
  67. template:
  68. metadata:
  69. labels:
  70. run: index
  71. spec:
  72. containers:
  73. - image: nginx
  74. imagePullPolicy: "Always"
  75. name: index
  76. ports:
  77. - containerPort: 80
  78. resources: {}
  79. volumeMounts:
  80. - mountPath: /usr/share/nginx/html
  81. name: index
  82. restartPolicy: Always
  83. # This didn't seem to do what I want/need
  84. # affinity:
  85. # podAntiAffinity:
  86. # requiredDuringSchedulingIgnoredDuringExecution: #<---- hard requirement not to schedule "nginx" pod if already one scheduled.
  87. # - topologyKey: kubernetes.io/hostname # <---- Anti affinity scope is host
  88. # labelSelector:
  89. # matchLabels:
  90. # app: index
  91. topologySpreadConstraints:
  92. - maxSkew: 1
  93. topologyKey: kubernetes.io/hostname
  94. whenUnsatisfiable: DoNotSchedule
  95. labelSelector:
  96. matchLabels:
  97. app: index
  98. volumes:
  99. - name: index
  100. persistentVolumeClaim:
  101. claimName: index
  102. # dnsPolicy: "None"
  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: index-ingress
  123. annotations:
  124. cert-manager.io/cluster-issuer: "letsencrypt-prod"
  125. ## basic auth for index
  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 - IO'
  132. spec:
  133. tls:
  134. - hosts:
  135. - io.monkeybox.org
  136. secretName: index-tls
  137. rules:
  138. - host: io.monkeybox.org
  139. http:
  140. paths:
  141. - path: /
  142. pathType: Prefix
  143. backend:
  144. service:
  145. name: index
  146. port:
  147. number: 80