apiVersion: apps/v1
kind: Deployment                 # Type of Kubernetes resource
metadata:
  name: product-go-micro            # Unique name of the Deployment
spec:
  replicas: 3                    # Number of pods to run at any given time in the Node
  selector:
    matchLabels:
      app: product-go-micro         # This deployment applies to any Pods matching the specified label
  template:                      # This deployment will create a set of pods using the configurations in this template
    metadata:
      labels:                    # The labels that will be applied to all of the pods in this deployment
        app: product-go-micro 
    spec:
      containers:
      - name: product-go-micro  # Name of the containers which will be run as pods.
        image: shadowshotx/product-go-micro # We specify the image name in spec. This will be taken from docker hub
        imagePullPolicy: IfNotPresent # We only pull if the latest image is not present
        resources:
          requests:
            cpu: 50m  # You can even specify the resources for each container! If this exceeds, you can spin up another instance
            memory: 50Mi
        ports:  # This is the main port where the container will wait for requests inside the node.
        - containerPort: 9090  
        env:  # Specified Environment variables to connect to Redis.
        - name: REDIS_HOST
          value: redis-coupon-db
        - name: REDIS_PORT
          value: "6379" 