---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx-deployment
  namespace: default
spec:
  selector:
    matchLabels:
      app: nginx
  replicas: 2 
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
      - name: nginx
        image: nginx:latest
        ports:
        - containerPort: 80
        readinessProbe:
          httpGet:
            scheme: HTTP
            path: /index.html
            port: 80
          initialDelaySeconds: 10
          periodSeconds: 5
        volumeMounts:
            - name: nginx-public
              mountPath: /usr/share/nginx/html/
      volumes:
      - name: nginx-public
        configMap:
          name: nginx-index-html-configmap
---
apiVersion: v1
kind: ConfigMap
metadata:
  name: nginx-index-html-configmap
  namespace: default
data:
  index.html: |
    <html>
    <h1>Welcome To Webapp 01</h1>
    </br>
    <h1>Hi! You are Trying to Access Webapp Through GKE Ingress </h1>
    </html
---
apiVersion: v1
kind: Service
metadata:
  name: nginx-service
  namespace: default
spec:
  selector:
    app: nginx
  type: NodePort
  ports:
    - port: 80
      targetPort: 80
