Files
cicdTest/deploy.yaml
2020-02-27 19:17:44 +01:00

179 lines
2.9 KiB
YAML

---
apiVersion: apps/v1
kind: Deployment
metadata:
name: server-a
spec:
replicas: 1
selector:
matchLabels:
server: "http"
expose: "true"
template:
metadata:
labels:
server: "http"
expose: "true"
spec:
containers:
- name: front-end
image: beppev/server-a:latest
ports:
- containerPort: 5000
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: server-b
spec:
replicas: 1
selector:
matchLabels:
server: "http"
app: "ja"
version: v1
template:
metadata:
labels:
server: "http"
app: "ja"
version: v1
spec:
containers:
- name: front-end
image: beppev/server-b:latest
ports:
- containerPort: 6000
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: server-c
spec:
replicas: 1
selector:
matchLabels:
server: "http"
app: "ja"
version: v2
template:
metadata:
labels:
server: "http"
app: "ja"
version: v2
spec:
containers:
- name: front-end
image: beppev/server-c:latest
ports:
- containerPort: 6000
---
apiVersion: v1
kind: Service
metadata:
name: server-b-c-service
spec:
selector:
app: "ja"
ports:
- name: http
protocol: TCP
port: 6000
---
kind: Service
apiVersion: v1
metadata:
name: expose-server
spec:
type: NodePort
selector:
expose: "true"
ports:
- name: http
protocol: TCP
targetPort: 5000
port: 5000
nodePort: 30036
---
kind: Service
apiVersion: v1
metadata:
name: example-loadbalancer
spec:
selector:
expose: "true"
ports:
- name: http
protocol: TCP
targetPort: 5000
port: 80
type: LoadBalancer
---
apiVersion: networking.istio.io/v1alpha3
kind: DestinationRule
metadata:
name: server-check-destination
spec:
host: server-check
subsets:
- name: v1
labels:
version: v1
- name: v2
labels:
version: v2
---
apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
name: server-check-gateway
spec:
selector:
expose: "true"
servers:
- port:
number: 6000
name: tcp
protocol: TCP
hosts:
- "*"
---
apiVersion: v1
kind: Service
metadata:
name: server-check
spec:
selector:
expose: "true"
ports:
- name: http
protocol: TCP
targetPort: 6000
port: 6000
---
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: server-check-service
spec:
hosts:
- "*"
gateways:
- server-check-gateway
tcp:
- match:
- port: 6000
route:
- destination:
host: server-b-c-service
port:
number: 6000
subset: v1
weight: 50
- destination:
host: server-b-c-service
port:
number: 6000
subset: v2
weight: 50