apiVersion: v1
kind: ReplicationController
metadata:
  name: glb-nginx
  labels:
    app: glb-nginx
spec:
  replicas: 1
  selector:
    app: glb-nginx
  template:
    metadata:
      labels:
        app: glb-nginx
    spec:
      hostname: nginx
      containers:
        - name: glb-nginx
          image: nginx:1.21.3
          volumeMounts:
            - name: config
              mountPath: /etc/nginx/conf.d
            - name: log
              mountPath: /var/log/nginx
            - name: certificate
              mountPath: /etc/nginx/cert
              readOnly: true
            - name: localtime
              mountPath: /etc/localtime
              readOnly: true
          ports:
            - containerPort: 80
              name: "http"
            - containerPort: 443
              name: "https"
      hostAliases:
        - ip: "172.35.10.4"
          hostnames:
            - "htz.gjqh.com.cn"
            - "admin-htz.gjqh.com.cn"
            - "store-htz.gjqh.com.cn"
            - "api-htz.gjqh.com.cn"
      volumes:
        - name: config
          hostPath:
            path: "/root/nginx/config"
        - name: log
          hostPath:
            path: "/root/nginx/log"
        - name: certificate
          hostPath:
            path: "/root/nginx/cert"
        - name: localtime
          hostPath:
            path: "/etc/localtime"

---
apiVersion: v1
kind: Service
metadata:
  labels:
    app: glb-nginx
  name: glb-nginx
spec:
  type: NodePort
  ports:
    - port: 80
      name: "http"
      nodePort: 80
    - port: 443
      name: "https"
      nodePort: 443
  selector:
    app: glb-nginx
