eyyyyy, twerkt

This commit is contained in:
2020-03-11 14:56:22 +01:00
parent 17c2b429d3
commit e405966c38
2 changed files with 294 additions and 178 deletions

View File

@@ -2,31 +2,29 @@
apiVersion: v1 apiVersion: v1
kind: Namespace kind: Namespace
metadata: metadata:
name: istio-project-1 name: linkerd-project-1
labels: annotations:
istio-injection: enabled #zorgt voor auto sidecar injection linkerd.io/inject: enabled
--- ---
apiVersion: apps/v1 apiVersion: apps/v1
kind: Deployment kind: Deployment
metadata: metadata:
name: server-a name: server-a
namespace: istio-project-1 namespace: linkerd-project-1
spec: spec:
replicas: 1 replicas: 1
selector: selector:
matchLabels: matchLabels:
server: "http" app: frontend
app: "project-1" #app label bepaald groepering pods in kiali dashboard dus makkelijker te gebruiken
expose: "true"
template: template:
metadata: metadata:
namespace: linkerd-project-1
labels: labels:
server: "http" app: frontend
app: "project-1" group: frontend
expose: "true"
spec: spec:
containers: containers:
- name: front-end - name: frontend
image: beppev/server-a:master image: beppev/server-a:master
imagePullPolicy: "Always" imagePullPolicy: "Always"
ports: ports:
@@ -35,26 +33,23 @@ spec:
apiVersion: apps/v1 apiVersion: apps/v1
kind: Deployment kind: Deployment
metadata: metadata:
namespace: linkerd-project-1
name: server-b name: server-b
namespace: istio-project-1
spec: spec:
replicas: 1 replicas: 1
selector: selector:
matchLabels: matchLabels:
server: "http" app: backend-master
app: "project-1" group: backend
version: v1
backend: "true"
template: template:
metadata: metadata:
namespace: linkerd-project-1
labels: labels:
server: "http" app: backend-master
app: "project-1" group: backend
version: v1
backend: "true"
spec: spec:
containers: containers:
- name: front-end - name: backend
image: beppev/server-b:master image: beppev/server-b:master
imagePullPolicy: "Always" imagePullPolicy: "Always"
ports: ports:
@@ -63,26 +58,23 @@ spec:
apiVersion: apps/v1 apiVersion: apps/v1
kind: Deployment kind: Deployment
metadata: metadata:
namespace: linkerd-project-1
name: server-b-test name: server-b-test
namespace: istio-project-1
spec: spec:
replicas: 1 replicas: 1
selector: selector:
matchLabels: matchLabels:
server: "http" app: backend-experimental
app: "project-1" group: backend
version: v2
backend: "true"
template: template:
metadata: metadata:
namespace: linkerd-project-1
labels: labels:
server: "http" app: backend-experimental
app: "project-1" group: backend
version: v2
backend: "true"
spec: spec:
containers: containers:
- name: front-end - name: backend
image: beppev/server-b:experimental image: beppev/server-b:experimental
imagePullPolicy: "Always" imagePullPolicy: "Always"
ports: ports:
@@ -91,184 +83,103 @@ spec:
apiVersion: apps/v1 apiVersion: apps/v1
kind: Deployment kind: Deployment
metadata: metadata:
namespace: linkerd-project-1
name: server-d name: server-d
namespace: istio-project-1
spec: spec:
replicas: 1 replicas: 1
selector: selector:
matchLabels: matchLabels:
app: "project-1" app: mirror
mirror: "true"
template: template:
metadata: metadata:
namespace: linkerd-project-1
labels: labels:
app: "project-1" group: mirror
mirror: "true" app: mirror
spec: spec:
containers: containers:
- name: front-end - name: mirror
image: beppev/server-d:master image: beppev/server-d:master
ports: ports:
- containerPort: 6000 - containerPort: 6000
--- ---
apiVersion: v1 apiVersion: v1
kind: Service kind: Service
metadata:
name: mirror-service
namespace: istio-project-1
labels:
app: "project-1"
spec:
selector:
mirror: "true"
ports:
- name: http
protocol: TCP
port: 6000
---
apiVersion: v1
kind: Service
metadata: metadata:
name: server-check name: server-check
namespace: istio-project-1 namespace: linkerd-project-1
labels:
app: "project-1"
spec: spec:
selector:
backend: "true"
ports: ports:
- name: http - name: http
protocol: TCP
port: 6000 port: 6000
--- targetPort: 6000
apiVersion: networking.istio.io/v1alpha3
kind: DestinationRule
metadata:
name: server-check-destination
namespace: istio-project-1
labels:
app: "project-1"
spec:
host: server-check
subsets:
- name: v1
labels:
version: v1
- name: v2
labels:
version: v2
---
apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
name: expose-server-gateway
namespace: istio-project-1
labels:
app: "project-1"
spec:
selector:
istio: ingressgateway
servers:
- port:
number: 80
name: http
protocol: HTTP
hosts:
- "*"
--- ---
apiVersion: v1 apiVersion: v1
kind: Service kind: Service
metadata: metadata:
name: expose-server-service name: server-check-master
namespace: istio-project-1 namespace: linkerd-project-1
labels:
app: "project-1"
spec: spec:
selector:
app: backend-master
ports:
- name: http
port: 6000
targetPort: 6000
---
apiVersion: v1
kind: Service
metadata:
name: server-check-experimental
namespace: linkerd-project-1
spec:
selector:
app: backend-experimental
ports:
- name: http
port: 6000
targetPort: 6000
---
apiVersion: split.smi-spec.io/v1alpha1
kind: TrafficSplit
metadata:
name: splitter
namespace: linkerd-project-1
spec:
service: server-check
backends:
- service: server-check-experimental
weight: 90
- service: server-check-master
weight: 10
---
apiVersion: v1
kind: Service
metadata:
name: expose-server
namespace: linkerd-project-1
spec:
selector:
group: frontend
ports: ports:
- name: http - name: http
port: 5000
protocol: TCP protocol: TCP
selector: port: 5000
expose: "true" targetPort: 5000
nodePort: 30036
type: NodePort
--- ---
apiVersion: networking.istio.io/v1alpha3 apiVersion: v1
kind: VirtualService kind: Service
metadata: metadata:
name: expose-server-vservice name: mirror-service
namespace: istio-project-1 namespace: linkerd-project-1
labels:
app: "project-1"
spec:
hosts:
- "*"
gateways:
- expose-server-gateway
http:
- match:
- uri:
prefix: /server-a
route:
- destination:
port:
number: 5000
host: expose-server-service
- match:
- uri:
prefix: /server-d
route:
- destination:
port:
number: 7000
host: mirror-service
--- # TODO fix gateway zodat we ingress gateway kunnen gebruike ipv de fuken loadbalancer.
apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
name: server-check-gateway
namespace: istio-project-1
labels:
app: "project-1"
spec: spec:
selector: selector:
expose: "true" group: mirror
servers: ports:
- port: - name: http
number: 6000 protocol: TCP
name: http port: 7000
protocol: HTTP targetPort: 7000
hosts:
- "*"
---
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: server-check-service
namespace: istio-project-1
labels:
app: "project-1"
spec:
hosts:
- "*"
gateways:
- expose-server-gateway
tcp:
- match:
- port: 6000
route:
- destination:
host: server-check
port:
number: 6000
subset: v1
weight: 50
- destination:
host: server-check
port:
number: 6000
subset: v2
weight: 50
mirror:
host: mirror-service
port:
number: 6000
mirror_percent: 100

205
example/example.yaml Normal file
View File

@@ -0,0 +1,205 @@
apiVersion: v1
kind: Namespace
metadata:
name: emojivoto
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: emoji
namespace: emojivoto
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: voting
namespace: emojivoto
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: web
namespace: emojivoto
---
apiVersion: v1
kind: Service
metadata:
name: emoji-svc
namespace: emojivoto
spec:
ports:
- name: grpc
port: 8080
targetPort: 8080
selector:
app: emoji-svc
---
apiVersion: v1
kind: Service
metadata:
name: voting-svc
namespace: emojivoto
spec:
ports:
- name: grpc
port: 8080
targetPort: 8080
- name: prom
port: 8801
targetPort: 8801
selector:
app: voting-svc
---
apiVersion: v1
kind: Service
metadata:
name: web-svc
namespace: emojivoto
spec:
ports:
- name: http
port: 80
targetPort: 8080
selector:
app: web-svc
type: LoadBalancer
---
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app.kubernetes.io/name: emoji
app.kubernetes.io/part-of: emojivoto
app.kubernetes.io/version: v9
name: emoji
namespace: emojivoto
spec:
replicas: 1
selector:
matchLabels:
app: emoji-svc
template:
metadata:
labels:
app: emoji-svc
spec:
containers:
- env:
- name: GRPC_PORT
value: "8080"
image: buoyantio/emojivoto-emoji-svc:v9
name: emoji-svc
ports:
- containerPort: 8080
name: grpc
resources:
requests:
cpu: 100m
serviceAccountName: emoji
---
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app.kubernetes.io/name: vote-bot
app.kubernetes.io/part-of: emojivoto
app.kubernetes.io/version: v9
name: vote-bot
namespace: emojivoto
spec:
replicas: 1
selector:
matchLabels:
app: vote-bot
template:
metadata:
labels:
app: vote-bot
spec:
containers:
- command:
- emojivoto-vote-bot
env:
- name: WEB_HOST
value: web-svc.emojivoto:80
image: buoyantio/emojivoto-web:v9
name: vote-bot
resources:
requests:
cpu: 10m
---
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app.kubernetes.io/name: voting
app.kubernetes.io/part-of: emojivoto
app.kubernetes.io/version: v9
name: voting
namespace: emojivoto
spec:
replicas: 1
selector:
matchLabels:
app: voting-svc
template:
metadata:
labels:
app: voting-svc
spec:
containers:
- env:
- name: GRPC_PORT
value: "8080"
- name: PROM_PORT
value: "8801"
image: buoyantio/emojivoto-voting-svc:v9
name: voting-svc
ports:
- containerPort: 8080
name: grpc
- containerPort: 8801
name: prom
resources:
requests:
cpu: 100m
serviceAccountName: voting
---
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app.kubernetes.io/name: web
app.kubernetes.io/part-of: emojivoto
app.kubernetes.io/version: v9
name: web
namespace: emojivoto
spec:
replicas: 1
selector:
matchLabels:
app: web-svc
template:
metadata:
labels:
app: web-svc
spec:
containers:
- env:
- name: WEB_PORT
value: "8080"
- name: EMOJISVC_HOST
value: emoji-svc.emojivoto:8080
- name: VOTINGSVC_HOST
value: voting-svc.emojivoto:8080
- name: INDEX_BUNDLE
value: dist/index_bundle.js
image: buoyantio/emojivoto-web:v9
name: web-svc
ports:
- containerPort: 8080
name: http
resources:
requests:
cpu: 100m
serviceAccountName: web