# 3 Services for the 3 endpoints of the Ingress
apiVersion: v1
kind: Service
metadata:
  name: service1
  labels:
    app: whoami
spec:
  type: NodePort
  ports:
  - port: 80
    nodePort: 30283
    targetPort: 80
    protocol: TCP
    name: https
  selector:
    app: whoami
---
apiVersion: v1
kind: Service
metadata:
  name: service2
  labels:
    app: whoami
spec:
  type: NodePort
  ports:
  - port: 80
    nodePort: 30284
    targetPort: 80
    protocol: TCP
    name: http
  selector:
    app: whoami
---
apiVersion: v1
kind: Service
metadata:
  name: service3
  labels:
    app: whoami
spec:
  type: NodePort
  ports:
  - port: 80
    nodePort: 30285
    targetPort: 80
    protocol: TCP
    name: http
  selector:
    app: whoami
---
# A single RC matching all Services
apiVersion: v1
kind: ReplicationController
metadata:
  name: whoami
spec:
  replicas: 1
  template:
    metadata:
      labels:
        app: whoami
    spec:
      containers:
      - name: whoami
        image: emilevauge/whoami
        ports:
        - containerPort: 80
---
# An Ingress with 2 hosts and 3 endpoints
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: whoami-ingress
spec:
  rules:
  - host: foo.localhost
    http:
      paths:
      - path: /bar
        backend:
          serviceName: service1
          servicePort: 80
  - host: bar.localhost
    http:
      paths:
      - backend:
          serviceName: service2
          servicePort: 80
      - backend:
          serviceName: service3
          servicePort: 80
