# Deployment
apiVersion: apps/v1
kind: Deployment
metadata:
  name: ingress-demo
spec:
  selector:
    matchLabels:
      app: myapp
  replicas: 1
  template:
    metadata:
      labels:
        app: myapp
    spec:
      containers:
      - name: ingress-cont
        image: gcr.io/google-samples/hello-app:1.0
---
# expose this deployment - [$ kubectl expose deployment ingress-demo --type=NodePort --port=8080]
---
# Ingress
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: ingress-app
  annotations:
    nginx.ingress.kubernetes.io/rewrite-target: /
spec:
  rules:
    - host: hello-worldapp.com
      http:
        paths:
          - path: /
            pathType: Prefix
            backend:
              service:
                name: ingress-demo
                port:
                  number: 8080
