apiVersion: apps/v1
kind: Deployment
metadata:
  name: glb-fileserver
  labels:
    app: glb-fileserver
spec:
  replicas: 1
  selector:
    matchLabels:
      app: glb-fileserver
  template:
    metadata:
      labels:
        app: glb-fileserver
    spec:
      hostname: fileserver
      containers:
        - name: glb-fileserver
          image: nginx:1.21.3
          volumeMounts:
            - name: config
              mountPath: /etc/nginx/conf.d
            - name: log
              mountPath: /var/log/nginx
            - name: www
              mountPath: /usr/share/nginx/html
              readOnly: true
            - name: localtime
              mountPath: /etc/localtime
              readOnly: true
          ports:
            - containerPort: 80
              name: "http"
      volumes:
        - name: config
          nfs:
            server: 369df4abd8-qmf27.cn-shanghai.nas.aliyuncs.com
            path: "/home/NFSData/FileServer/nginx/config"
        - name: log
          nfs:
            server: 369df4abd8-qmf27.cn-shanghai.nas.aliyuncs.com
            path: "/home/NFSData/FileServer/nginx/log"
        - name: www
          nfs:
            server: 369df4abd8-qmf27.cn-shanghai.nas.aliyuncs.com
            path: "/home/NFSData/FileServer/files"
        - name: localtime
          hostPath:
            path: "/etc/localtime"

---
apiVersion: v1
kind: Service
metadata:
  labels:
    app: glb-fileserver
  name: glb-fileserver
spec:
  ports:
    - port: 80
      targetPort: 80
      name: "http"
  selector:
    app: glb-fileserver

---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: filerserver
  annotations:
    nginx.ingress.kubernetes.io/rewrite-target: /
    nginx.ingress.kubernetes.io/proxy-body-size: 0m
spec:
  ingressClassName: nginx
  rules:
  - host: store-new.westfutu.com
    http:
      paths:
      - path: /
        pathType: Prefix
        backend:
          service:
            name: glb-fileserver
            port:
              number: 80