apiVersion: v1
data:
  nginx.conf: |
    events {}
    http {
      server {
        listen 80;
        location / {
          proxy_pass http://target-svc:80;
        }
      }
    }
kind: ConfigMap
metadata:
  name: gw-nginx-conf
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: gateway
spec:
  replicas: 1
  selector:
    matchLabels:
      app: gateway
  template:
    metadata:
      labels:
        app: gateway
    spec:
      containers:
        - image: nginx
          imagePullPolicy: IfNotPresent
          name: gateway
          ports:
            - containerPort: 80
              name: http
          volumeMounts:
            - mountPath: /etc/nginx
              name: gw-nginx-conf
      volumes:
        - configMap:
            name: gw-nginx-conf
          name: gw-nginx-conf
---
apiVersion: v1
kind: Service
metadata:
  name: gateway-svc
spec:
  ports:
    - name: http
      port: 80
      protocol: TCP
      targetPort: 80
  selector:
    app: gateway
  type: LoadBalancer
