How to: Lab 9.2 Understanding ingress
1. Create a Deployment called `web` using a `httpd` image
2. Expose the deployment with a _Cluster-IP_ Service called `web-svc`
3. Create an Ingress called `web-ing` with a _Prefix_ rule to redirect `/` requests to the Service
4. List all created resources - what is the value of Ingress `CLASS`, `HOSTS` & `ADDRESS`?
   - think about why the `CLASS` and `HOSTS` have such values..
5. Access the app `web` via ingress `curl $(minikube ip)`
   - note that unlike Service, a _NodePort_ isn't specified
6. What if we want another application on `/test` path, will this work? Repeat steps 3-7 to confirm:
   - create a new deployment `web2` with image `httpd`
   - expose the new deployment `web2-svc`
   - add new _Prefix_ path to existing ingress rule to redirect `/test` to `web2-svc`
   - are you able to access the new `web2` app via `curl $(minikube ip)/test`?
   - are you still able to access the old `web` app via `curl $(minikube ip)`?
   - what's missing?
7. Let's fix this by adding the correct _Annotation_ to the Ingress config, `kubectl edit ingress web-ing`:
fix ingress
```yaml
   metadata:
     name: web-ing
     annotations:
       nginx.ingress.kubernetes.io/rewrite-target: /
   ```
8. Try to access both apps via URLs `curl $(minikube ip)/test` and `curl $(minikube ip)`
9. Can you access both apps using HTTPS?
10. Review the _ingress-nginx-controller_ by running: `kubectl get svc -n ingress-nginx`
    - what is the _ingress-nginx-controller_ Service type?
    - what are the ports related to HTTP `80` and HTTPS `443`?
11. Can you access both apps via the _ingress-nginx-controller_ NodePorts for HTTP and HTTPS?
12. Delete all created resources
lab9.2 solution
```sh
kubectl create deploy web --image=httpd --dry-run=client -oyaml > lab9-2.yml
kubectl apply -f lab9-2.yml
echo --- >> lab9-2.yml
kubectl expose deploy web --name=web-svc --port=80 --dry-run=client -oyaml >> lab9-2.yml
echo --- >> lab9-2.yml
kubectl create ingress web-ing --rule="/*=web-svc:80" --dry-run=client -oyaml >> lab9-2.yml
kubectl apply -f lab9-2.yml
kubectl get deploy,po,svc,ing,ingressclass # CLASS=nginx, HOSTS=*, ADDRESS starts empty then populated later
curl $(minikube ip) # it works
echo --- >> lab9-2.yml
kubectl create deploy web2 --image=httpd --dry-run=client -oyaml > lab9-2.yml
kubectl apply -f lab9-2.yml
echo --- >> lab9-2.yml
kubectl expose deploy web2 --name=web2-svc --port=80 --dry-run=client -oyaml >> lab9-2.yml
KUBE_EDITOR=nano kubectl edit ingress web-ing
```

```yaml
Kind: Ingress
spec:
  rules:
  - http:
      paths:
      - path: /
        pathType: Prefix
        ...
      - path: /test
        pathType: Prefix
        backend:
          service:
            name: web2-svc
            port:
              number: 80