apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx
  labels:
    app: nginx
spec:
  replicas: 1
  selector:
    matchLabels:
      app: nginx
  template:
    metadata:
      labels:
        app: nginx
    spec:
      hostname: nginx
      hostAliases:
        - ip: "172.35.10.4"
          hostnames:
            - "api-htz.gjqh.com.cn"
        - ip: "172.35.10.4"
          hostnames:
            - "store-htz.gjqh.com.cn"
        - ip: "172.35.10.4"
          hostnames:
            - "dashboard-htz.gjqh.com.cn"
      containers:
        - name: nginx
          image: nginx:1.21.3
          volumeMounts:
            - name: config
              mountPath: /etc/nginx/conf.d
            - name: log
              mountPath: /var/log/nginx
            - name: www
              mountPath: /home
            - name: localtime
              mountPath: /etc/localtime
              readOnly: true
          ports:
            - containerPort: 80
              name: "http"
      volumes:
        - name: config
          nfs:
            server: nfs.daline.com.cn
            path: "/home/NFSData/dev/nginx/config"
        - name: log
          nfs:
            server: nfs.daline.com.cn
            path: "/home/NFSData/dev/nginx/log"
        - name: www
          nfs:
            server: nfs.daline.com.cn
            path: "/home/NFSData/dev/nginx/www"
        - name: localtime
          hostPath:
            path: "/etc/localtime"
      nodeSelector:
        kubernetes.io/hostname: i-zdoncu0w

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

---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: gjqh
  annotations:
    nginx.ingress.kubernetes.io/rewrite-target: /
    nginx.ingress.kubernetes.io/proxy-body-size: 0m
spec:
  ingressClassName: nginx
  rules:
  - host: htz.gjqh.com.cn
    http:
      paths:
      - path: /
        pathType: Prefix
        backend:
          service:
            name: nginx
            port:
              number: 80
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: gjqhadmin
  annotations:
    nginx.ingress.kubernetes.io/rewrite-target: /
    nginx.ingress.kubernetes.io/proxy-body-size: 0m
spec:
  ingressClassName: nginx
  rules:
  - host: admin-htz.gjqh.com.cn
    http:
      paths:
      - path: /
        pathType: Prefix
        backend:
          service:
            name: nginx
            port:
              number: 80
