94 lines
1.5 KiB
YAML
94 lines
1.5 KiB
YAML
|
# 3 Services for the 3 endpoints of the Ingress
|
||
|
apiVersion: v1
|
||
|
kind: Service
|
||
|
metadata:
|
||
|
name: whoami-x
|
||
|
labels:
|
||
|
app: whoami
|
||
|
spec:
|
||
|
type: NodePort
|
||
|
ports:
|
||
|
- port: 80
|
||
|
nodePort: 30301
|
||
|
targetPort: 80
|
||
|
protocol: TCP
|
||
|
name: http
|
||
|
selector:
|
||
|
app: whoami
|
||
|
---
|
||
|
apiVersion: v1
|
||
|
kind: Service
|
||
|
metadata:
|
||
|
name: whoami-default
|
||
|
labels:
|
||
|
app: whoami
|
||
|
spec:
|
||
|
type: NodePort
|
||
|
ports:
|
||
|
- port: 80
|
||
|
nodePort: 30302
|
||
|
targetPort: 80
|
||
|
protocol: TCP
|
||
|
name: http
|
||
|
selector:
|
||
|
app: whoami
|
||
|
---
|
||
|
apiVersion: v1
|
||
|
kind: Service
|
||
|
metadata:
|
||
|
name: whoami-y
|
||
|
labels:
|
||
|
app: whoami
|
||
|
spec:
|
||
|
type: NodePort
|
||
|
ports:
|
||
|
- port: 80
|
||
|
nodePort: 30284
|
||
|
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: whoamimap
|
||
|
spec:
|
||
|
rules:
|
||
|
- host: foo.localhost
|
||
|
http:
|
||
|
paths:
|
||
|
- path: /bar
|
||
|
backend:
|
||
|
serviceName: whoami-x
|
||
|
servicePort: 80
|
||
|
- host: bar.localhost
|
||
|
http:
|
||
|
paths:
|
||
|
- backend:
|
||
|
serviceName: whoami-y
|
||
|
servicePort: 80
|
||
|
- backend:
|
||
|
serviceName: whoami-x
|
||
|
servicePort: 80
|