kind: Namespace
apiVersion: v1
metadata:
  name: hotel-namespace
---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: hotel-ingress
  namespace: hotel-namespace
spec:
  rules:
  - host: hotel.example.com
    http:
      paths:
      - path: /
        backend:
          serviceName: hotel-svc
          servicePort: 80
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: hotel-deployment
  namespace: hotel-namespace
spec:
  replicas: 2
  selector:
    matchLabels:
      app: hotel
  template:
    metadata:
      labels:
        app: hotel
    spec:
      containers:
      - name: hotel-container
        image: nginxdemos/hello:plain-text
        ports:
        - containerPort: 80
---
apiVersion: v1
kind: Service
metadata:
  name: hotel-svc
  namespace: hotel-namespace
spec:
  ports:
  - port: 80
    targetPort: 80
    protocol: TCP
    name: http
  selector:
    app: hotel
---
kind: Namespace
apiVersion: v1
metadata:
  name: cafe-namespace
---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: cafe-ingress
  namespace: cafe-namespace
spec:
  rules:
  - host: cafe.example.com
    http:
      paths:
      - path: /tea
        backend:
          serviceName: tea-svc
          servicePort: 80
      - path: /coffee
        backend:
          serviceName: coffee-svc
          servicePort: 80
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: coffee-deployment
  namespace: cafe-namespace
spec:
  replicas: 2
  selector:
    matchLabels:
      app: coffee
  template:
    metadata:
      labels:
        app: coffee
    spec:
      containers:
      - name: coffee-container
        image: nginxdemos/hello:plain-text
        ports:
        - containerPort: 80
---
apiVersion: v1
kind: Service
metadata:
  name: coffee-svc
  namespace: cafe-namespace
spec:
  ports:
  - port: 80
    targetPort: 80
    protocol: TCP
    name: http
  selector:
    app: coffee
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: tea-deployment
  namespace: cafe-namespace
spec:
  replicas: 3
  selector:
    matchLabels:
      app: tea
  template:
    metadata:
      labels:
        app: tea
    spec:
      containers:
      - name: tea-container
        image: nginxdemos/hello:plain-text
        ports:
        - containerPort: 80
---
apiVersion: v1
kind: Service
metadata:
  name: tea-svc
  namespace: cafe-namespace
spec:
  ports:
  - port: 80
    targetPort: 80
    protocol: TCP
    name: http
  selector:
    app: tea
