From 45948bfe7feda90f30b6817cc9861b6e78e4a88f Mon Sep 17 00:00:00 2001 From: Jose Henrique Date: Thu, 20 Aug 2026 20:58:17 -0300 Subject: [PATCH] adding small nginx server --- infra/file-nginx.yaml | 129 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 129 insertions(+) create mode 100644 infra/file-nginx.yaml diff --git a/infra/file-nginx.yaml b/infra/file-nginx.yaml new file mode 100644 index 0000000..bb9cd10 --- /dev/null +++ b/infra/file-nginx.yaml @@ -0,0 +1,129 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: file-nginx + namespace: infra + labels: + app: file-nginx +spec: + replicas: 1 + strategy: + type: RollingUpdate + rollingUpdate: + maxSurge: 1 + maxUnavailable: 1 + selector: + matchLabels: + app: file-nginx + template: + metadata: + labels: + app: file-nginx + spec: + containers: + - name: nginx + image: nginx:alpine + imagePullPolicy: IfNotPresent + ports: + - containerPort: 80 + securityContext: + allowPrivilegeEscalation: false + runAsUser: 0 + volumeMounts: + - name: html + mountPath: /usr/share/nginx/data + - name: nginx-conf + mountPath: /etc/nginx/conf.d/default.conf + subPath: default.conf + startupProbe: + httpGet: + path: / + port: 80 + failureThreshold: 30 + periodSeconds: 5 + readinessProbe: + httpGet: + path: / + port: 80 + initialDelaySeconds: 5 + periodSeconds: 10 + livenessProbe: + httpGet: + path: / + port: 80 + initialDelaySeconds: 5 + periodSeconds: 10 + resources: + requests: + cpu: 50m + memory: 64Mi + limits: + cpu: 200m + memory: 128Mi + volumes: + - name: html + nfs: + server: vega.haven + path: /export/Fast + - name: nginx-conf + configMap: + name: file-nginx-conf + +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: file-nginx-conf + namespace: infra +data: + default.conf: | + server { + listen 80; + listen [::]:80; + server_name _; + + root /usr/share/nginx/data/file-nginx; + index index.html; + + autoindex on; + + location / { + try_files $uri $uri/ =404; + } + } +--- +apiVersion: v1 +kind: Service +metadata: + name: file-nginx + namespace: infra +spec: + selector: + app: file-nginx + ports: + - protocol: TCP + port: 80 + targetPort: 80 + +--- +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: file-nginx + namespace: infra + annotations: + nginx.ingress.kubernetes.io/enable-cors: "true" + nginx.ingress.kubernetes.io/cors-allow-origin: "*" +spec: + ingressClassName: nginx + rules: + - host: file-nginx.haven + http: + paths: + - path: / + pathType: Prefix + backend: + service: + name: file-nginx + port: + number: 80