#
# Since I have used environment variable, the deployment was created using the below command -
# (NGINX_HOST=mynginx1;NGINX_PORT=8080;kubectl apply -f nginx-deployment.yml)
#
apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx-deployment
  labels:
    app: nginx
spec:
  replicas: 2
  selector:
    matchLabels:
      app: nginx
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
        - name: nginx
          image: nginx:1.19.5
          resources:
            limits:
              memory: 512Mi
              cpu: "1"
            requests:
              memory: 256Mi
              cpu: "0.2"
          env:
            - name: NGINX_HOST
              value: $NGINX_HOST
            - name: NGINX_PORT
              value: $NGINX_PORT
          ports:
            - containerPort: 8080
