(chore)demo: add a demo application for litmus (#1784)

Signed-off-by: ksatchit <karthik.s@mayadata.io>
This commit is contained in:
Karthik Satchitanand 2020-07-27 09:30:59 +05:30 committed by GitHub
parent ef33936d52
commit 9c8c1a4c50
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
31 changed files with 3633 additions and 0 deletions

View File

@ -0,0 +1,125 @@
# Monitor Chaos on Sock-Shop
Chaos experiments on sock-shop app with grafana dashboard to monitor it.
## Step-0: Obtain the demo artefacts
- Clone the litmus repo
```
git clone https://github.com/litmuschaos/litmus.git
cd litmus/demo/sample-applications/sock-shop
```
## Step-1: Setup Sock-Shop Microservices Application
- Create sock-shop namespace on the cluster
```
kubectl create ns sock-shop
```
- Apply the sock-shop microservices manifests
```
kubectl apply -f deploy/sock-shop/
```
- Wait until all services are up. Verify via `kubectl get pods -n sock-shop`
## Step-2: Setup the LitmusChaos Infrastructure
- Install the litmus chaos operator and CRDs
```
kubectl apply -f https://litmuschaos.github.io/litmus/litmus-operator-v1.6.1.yaml
```
- Install the litmus-admin serviceaccount for centralized/admin-mode of chaos execution
```
kubectl apply -f https://litmuschaos.github.io/litmus/litmus-admin-rbac.yaml
```
- Install the chaos experiments in admin(litmus) namespace
```
kubectl apply -f https://hub.litmuschaos.io/api/chaos/1.6.1?file=charts/generic/experiments.yaml -n litmus
```
- Install the chaos experiment metrics exporter and chaos event exporter
```
kubectl apply -f deploy/litmus-metrics/01-event-router-cm.yaml
kubectl apply -f deploy/litmus-metrics/02-event-router.yaml
kubectl apply -f deploy/litmus-metrics/03-chaos-exporter.yaml
```
## Step-3: Setup the Monitoring Infrastructure
- Apply the monitoring manifests in specified order
```
kubectl apply -f deploy/monitoring/01-monitoring-ns.yaml
kubectl apply -f deploy/monitoring/02-prometheus-rbac.yaml
kubectl apply -f deploy/monitoring/03-prometheus-configmap.yaml
kubectl apply -f deploy/monitoring/04-prometheus-alert-rules.yaml
kubectl apply -f deploy/monitoring/05-prometheus-deployment.yaml
kubectl apply -f deploy/monitoring/06-prometheus-svc.yaml
kubectl apply -f deploy/monitoring/07-grafana-deployment.yaml
kubectl apply -f deploy/monitoring/08-grafana-svc.yaml
```
- Access the grafana dashboard via the NodePort (or loadbalancer) service IP or via a port-forward operation on localhost
Note: To change the service type to Loadbalancer, perform a `kubectl edit svc prometheus -n monitoring` and replace
`type: NodePort` to `type: LoadBalancer`
```
kubectl get svc -n monitoring
```
Default username/password credentials: `admin/admin`
- Add the prometheus datasource for Grafana via the Grafana Settings menu
![image](https://user-images.githubusercontent.com/21166217/87426447-cbcf1c80-c5fc-11ea-976d-6a71ebac755a.png)
- Import the grafana dashboard "Sock-Shop Performance" provided [here](https://raw.githubusercontent.com/litmuschaos/litmus/master/demo/sample-applications/sock-shop/deploy/monitoring/10-grafana-dashboard.json)
![image](https://user-images.githubusercontent.com/21166217/87426547-f28d5300-c5fc-11ea-95da-e091fb07f1b5.png)
## Step-4: Execute the Chaos Experiments
- For the sake of illustration, let us execute a CPU hog experiment on the `catalogue` microservice & a Memory Hog experiment on
the `orders` microservice in a staggered manner
```
kubectl apply -f chaos/catalogue/catalogue-cpu-hog.yaml
```
Wait for ~60s
```
kubectl apply -f chaos/orders/orders-memory-hog.yaml
```
- Verify execution of chaos experiments
```
kubectl describe chaosengine catalogue-cpu-hog -n litmus
kubectl describe chaosengine orders-memory-hog -n litmus
```
## Step-5: Visualize Chaos Impact
- Observe the impact of chaos injection through increased Latency & reduced QPS (queries per second) on the microservices
under test.
![image](https://user-images.githubusercontent.com/21166217/87426747-4d26af00-c5fd-11ea-8d82-dabf6bc9048a.png)
![image](https://user-images.githubusercontent.com/21166217/87426820-6cbdd780-c5fd-11ea-88de-1fe8a1b5b503.png)

View File

@ -0,0 +1,30 @@
apiVersion: litmuschaos.io/v1alpha1
kind: ChaosEngine
metadata:
name: catalogue-cpu-hog
namespace: litmus
spec:
annotationCheck: 'false'
engineState: 'active'
auxiliaryAppInfo: ''
appinfo:
appns: 'sock-shop'
applabel: 'name=catalogue'
appkind: 'deployment'
chaosServiceAccount: litmus-admin
monitoring: true
jobCleanUpPolicy: 'retain'
experiments:
- name: pod-cpu-hog
spec:
components:
env:
- name: TARGET_CONTAINER
value: 'catalogue'
- name: CPU_CORES
value: '1'
- name: TOTAL_CHAOS_DURATION
value: '240' # in seconds

View File

@ -0,0 +1,30 @@
apiVersion: litmuschaos.io/v1alpha1
kind: ChaosEngine
metadata:
name: orders-memory-hog
namespace: litmus
spec:
annotationCheck: 'false'
engineState: 'active'
auxiliaryAppInfo: ''
appinfo:
appns: 'sock-shop'
applabel: 'name=orders'
appkind: 'deployment'
chaosServiceAccount: litmus-admin
monitoring: true
jobCleanUpPolicy: 'retain'
experiments:
- name: pod-memory-hog
spec:
components:
env:
- name: TARGET_CONTAINER
value: 'orders'
- name: MEMORY_CONSUMPTION
value: '500'
- name: TOTAL_CHAOS_DURATION
value: '240' # in seconds

View File

@ -0,0 +1,13 @@
apiVersion: v1
data:
config.json: |-
{
"sink": "http",
"httpSinkUrl": "http://localhost:8080",
"httpSinkBufferSize": 1500,
"httpSinkDiscardMessages": true
}
kind: ConfigMap
metadata:
name: litmus-eventrouter-http-cm
namespace: litmus

View File

@ -0,0 +1,50 @@
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: litmus-eventrouter
name: litmus-eventrouter
namespace: litmus
spec:
replicas: 1
selector:
matchLabels:
app: litmus-eventrouter
template:
metadata:
labels:
app: litmus-eventrouter
spec:
containers:
- image: containership/eventrouter
imagePullPolicy: IfNotPresent
name: litmus-eventrouter
volumeMounts:
- mountPath: /etc/eventrouter
name: config-volume
serviceAccount: litmus
serviceAccountName: litmus
volumes:
- configMap:
defaultMode: 420
name: litmus-eventrouter-http-cm
name: config-volume
---
apiVersion: v1
kind: Service
metadata:
labels:
app: litmus-eventrouter
name: litmus-eventrouter
namespace: litmus
spec:
ports:
- nodePort: 31399
port: 8080
protocol: TCP
targetPort: 8080
selector:
app: litmus-eventrouter
sessionAffinity: None
type: NodePort

View File

@ -0,0 +1,40 @@
---
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: chaos-monitor
name: chaos-monitor
namespace: litmus
spec:
replicas: 1
selector:
matchLabels:
app: chaos-monitor
template:
metadata:
labels:
app: chaos-monitor
spec:
containers:
- image: litmuschaos/chaos-exporter:ci
imagePullPolicy: Always
name: chaos-exporter
serviceAccount: litmus
serviceAccountName: litmus
---
apiVersion: v1
kind: Service
metadata:
labels:
app: chaos-monitor
name: chaos-monitor
namespace: litmus
spec:
ports:
- port: 8080
protocol: TCP
targetPort: 8080
selector:
app: chaos-monitor
type: ClusterIP

View File

@ -0,0 +1,4 @@
apiVersion: v1
kind: Namespace
metadata:
name: monitoring

View File

@ -0,0 +1,47 @@
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: prometheus
namespace: monitoring
labels:
app: prometheus
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRole
metadata:
name: prometheus
labels:
app: prometheus
rules:
- apiGroups: [""] # "" indicates the core API group
resources:
- nodes
- nodes/proxy
- services
- endpoints
- pods
verbs:
- get
- list
- watch
- nonResourceURLs:
- /metrics
verbs:
- get
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding
metadata:
name: prometheus
labels:
app: prometheus
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: prometheus
subjects:
- kind: ServiceAccount
name: prometheus
namespace: monitoring

View File

@ -0,0 +1,122 @@
apiVersion: v1
data:
prometheus.yml: |
global:
scrape_interval: 15s
rule_files:
- "/etc/prometheus-rules/alert.rules"
scrape_configs:
- job_name: 'chaos-monitor'
static_configs:
- targets: ['chaos-monitor.litmus.svc.cluster.local:8080']
- job_name: kubernetes-service-endpoints
kubernetes_sd_configs:
- role: endpoints
tls_config:
ca_file: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/token
relabel_configs:
- source_labels:
- __meta_kubernetes_service_label_component
regex: apiserver
action: replace
target_label: __scheme__
replacement: https
- source_labels:
- __meta_kubernetes_service_label_kubernetes_io_cluster_service
action: drop
regex: 'true'
- source_labels:
- __meta_kubernetes_service_annotation_prometheus_io_scrape
action: drop
regex: 'false'
- source_labels:
- __meta_kubernetes_pod_container_port_name
action: drop
regex: .*-noscrape
- source_labels:
- __meta_kubernetes_service_annotation_prometheus_io_scheme
action: replace
target_label: __scheme__
regex: ^(https?)$
replacement: $1
- source_labels:
- __meta_kubernetes_service_annotation_prometheus_io_path
action: replace
target_label: __metrics_path__
regex: ^(.+)$
replacement: $1
- source_labels:
- __address__
- __meta_kubernetes_service_annotation_prometheus_io_port
action: replace
target_label: __address__
regex: '^(.+)(?::\d+);(\d+)$'
replacement: '$1:$2'
- action: labelmap
regex: ^__meta_kubernetes_service_label_(.+)$
replacement: $1
- source_labels:
- __meta_kubernetes_namespace
- __meta_kubernetes_service_name
separator: /
target_label: job
- job_name: kubernetes-pods
kubernetes_sd_configs:
- role: pod
relabel_configs:
- source_labels:
- __meta_kubernetes_pod_annotation_prometheus_io_scrape
action: keep
regex: 'true'
- source_labels:
- __meta_kubernetes_namespace
- __meta_kubernetes_pod_label_name
separator: /
target_label: job
- source_labels:
- __meta_kubernetes_pod_node_name
target_label: node
- job_name: kubernetes-nodes
kubernetes_sd_configs:
- role: node
tls_config:
insecure_skip_verify: true
bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/token
relabel_configs:
- target_label: __scheme__
replacement: https
- source_labels:
- __meta_kubernetes_node_label_kubernetes_io_hostname
target_label: instance
- job_name: weave
kubernetes_sd_configs:
- role: pod
relabel_configs:
- source_labels:
- __meta_kubernetes_namespace
- __meta_kubernetes_pod_label_name
action: keep
regex: ^kube-system;weave-net$
- source_labels:
- __meta_kubernetes_pod_container_name
- __address__
action: replace
target_label: __address__
regex: '^weave;(.+?)(?::\d+)?$'
replacement: '$1:6782'
- source_labels:
- __meta_kubernetes_pod_container_name
- __address__
action: replace
target_label: __address__
regex: '^weave-npc;(.+?)(?::\d+)?$'
replacement: '$1:6781'
- source_labels:
- __meta_kubernetes_pod_container_name
action: replace
target_label: job
kind: ConfigMap
metadata:
name: prometheus-configmap
namespace: monitoring

View File

@ -0,0 +1,17 @@
apiVersion: v1
data:
alert.rules: |
# Alert for high error rate in the Sock Shop.
ALERT HighErrorRate
IF rate(request_duration_seconds_count{status_code="500"}[5m]) > 1
FOR 5m
LABELS { severity = "slack" }
ANNOTATIONS {
summary = "High HTTP 500 error rates",
description = "Rate of HTTP 500 errors per 5 minutes: {{ $value }}",
}
kind: ConfigMap
metadata:
name: prometheus-alertrules
namespace: monitoring

View File

@ -0,0 +1,46 @@
apiVersion: apps/v1
kind: Deployment
metadata:
annotations:
name: prometheus-deployment
namespace: monitoring
spec:
replicas: 1
selector:
matchLabels:
app: prometheus
template:
metadata:
labels:
app: prometheus
name: prometheus
spec:
containers:
- args:
- -storage.local.retention=360h
- -storage.local.memory-chunks=1048576
- -config.file=/etc/prometheus/prometheus.yml
- -alertmanager.url=http://alertmanager:9093
image: prom/prometheus:v1.5.2
imagePullPolicy: IfNotPresent
name: prometheus
ports:
- containerPort: 9090
name: web
protocol: TCP
volumeMounts:
- mountPath: /etc/prometheus
name: config-volume
- mountPath: /etc/prometheus-rules
name: alertrules-volume
serviceAccount: prometheus
serviceAccountName: prometheus
volumes:
- configMap:
defaultMode: 420
name: prometheus-configmap
name: config-volume
- configMap:
defaultMode: 420
name: prometheus-alertrules
name: alertrules-volume

View File

@ -0,0 +1,20 @@
apiVersion: v1
kind: Service
metadata:
annotations:
prometheus.io/scrape: 'true'
labels:
name: prometheus
name: prometheus
namespace: monitoring
spec:
selector:
app: prometheus
type: NodePort
ports:
- name: prometheus
protocol: TCP
port: 9090
targetPort: 9090
nodePort: 31090

View File

@ -0,0 +1,30 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: grafana
namespace: monitoring
spec:
replicas: 1
selector:
matchLabels:
app: grafana
template:
metadata:
labels:
app: grafana
name: grafana
spec:
containers:
- image: grafana/grafana:latest
imagePullPolicy: Always
name: grafana
ports:
- containerPort: 3000
name: grafana
protocol: TCP
volumeMounts:
- mountPath: /var/lib/grafana
name: grafana-storage
volumes:
- emptyDir: {}
name: grafana-storage

View File

@ -0,0 +1,16 @@
apiVersion: v1
kind: Service
metadata:
annotations:
name: grafana
namespace: monitoring
spec:
ports:
- nodePort: 31687
port: 3000
protocol: TCP
targetPort: 3000
selector:
app: grafana
sessionAffinity: None
type: NodePort

View File

@ -0,0 +1,14 @@
apiVersion: v1
data:
prometheus-datasource.json: |
{
"name": "prometheus",
"type": "prometheus",
"url": "http://prometheus:9090",
"access": "proxy",
"basicAuth": false
}
kind: ConfigMap
metadata:
name: grafana-import-dashboards
namespace: monitoring

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,4 @@
apiVersion: v1
kind: Namespace
metadata:
name: sock-shop

View File

@ -0,0 +1,67 @@
apiVersion: apps/v1
kind: Deployment
metadata:
annotations:
litmuschaos.io/chaos: "true"
labels:
app: sock-shop
name: carts-db
name: carts-db
namespace: sock-shop
spec:
replicas: 1
selector:
matchLabels:
app: sock-shop
name: carts-db
template:
metadata:
labels:
app: sock-shop
name: carts-db
spec:
containers:
- image: mongo
imagePullPolicy: Always
name: carts-db
ports:
- containerPort: 27017
name: mongo
protocol: TCP
resources:
limits:
ephemeral-storage: 2Gi
requests:
ephemeral-storage: 1Gi
securityContext:
capabilities:
add:
- CHOWN
- SETGID
- SETUID
drop:
- all
readOnlyRootFilesystem: true
volumeMounts:
- mountPath: /tmp
name: tmp-volume
volumes:
- emptyDir:
medium: Memory
name: tmp-volume
---
apiVersion: v1
kind: Service
metadata:
name: carts-db
labels:
name: carts-db
namespace: sock-shop
spec:
ports:
# the port that this service should serve on
- port: 27017
targetPort: 27017
selector:
name: carts-db

View File

@ -0,0 +1,79 @@
apiVersion: apps/v1
kind: Deployment
metadata:
annotations:
litmuschaos.io/chaos: "true"
labels:
app: sock-shop
name: carts
name: carts
namespace: sock-shop
spec:
replicas: 1
selector:
matchLabels:
app: sock-shop
name: carts
template:
metadata:
labels:
app: sock-shop
name: carts
spec:
containers:
- env:
- name: ZIPKIN
value: zipkin.jaeger.svc.cluster.local
- name: JAVA_OPTS
value: -Xms64m -Xmx128m -XX:PermSize=32m -XX:MaxPermSize=64m -XX:+UseG1GC
-Djava.security.egd=file:/dev/urandom
image: weaveworksdemos/carts:0.4.8
imagePullPolicy: IfNotPresent
name: carts
ports:
- containerPort: 80
protocol: TCP
securityContext:
capabilities:
add:
- NET_BIND_SERVICE
drop:
- all
readOnlyRootFilesystem: true
runAsNonRoot: true
runAsUser: 10001
livenessProbe:
httpGet:
path: /health
port: 80
initialDelaySeconds: 300
periodSeconds: 3
readinessProbe:
httpGet:
path: /health
port: 80
initialDelaySeconds: 180
periodSeconds: 3
volumeMounts:
- mountPath: /tmp
name: tmp-volume
volumes:
- emptyDir:
medium: Memory
name: tmp-volume
---
apiVersion: v1
kind: Service
metadata:
name: carts
labels:
name: carts
namespace: sock-shop
spec:
ports:
# the port that this service should serve on
- port: 80
targetPort: 80
selector:
name: carts

View File

@ -0,0 +1,51 @@
apiVersion: apps/v1
kind: Deployment
metadata:
annotations:
litmuschaos.io/chaos: "true"
labels:
app: sock-shop
name: catalogue-db
name: catalogue-db
namespace: sock-shop
spec:
replicas: 1
selector:
matchLabels:
app: sock-shop
name: catalogue-db
template:
metadata:
labels:
app: sock-shop
name: catalogue-db
spec:
containers:
- env:
- name: MYSQL_ROOT_PASSWORD
value: fake_password
- name: MYSQL_DATABASE
value: socksdb
image: weaveworksdemos/catalogue-db:0.3.0
imagePullPolicy: IfNotPresent
name: catalogue-db
ports:
- containerPort: 3306
name: mysql
protocol: TCP
---
apiVersion: v1
kind: Service
metadata:
name: catalogue-db
labels:
name: catalogue-db
namespace: sock-shop
spec:
ports:
# the port that this service should serve on
- port: 3306
targetPort: 3306
selector:
name: catalogue-db

View File

@ -0,0 +1,66 @@
apiVersion: apps/v1
kind: Deployment
metadata:
annotations:
litmuschaos.io/chaos: "true"
labels:
app: sock-shop
name: catalogue
name: catalogue
namespace: sock-shop
spec:
replicas: 1
selector:
matchLabels:
app: sock-shop
name: catalogue
template:
metadata:
labels:
app: sock-shop
name: catalogue
spec:
containers:
- image: weaveworksdemos/catalogue:0.3.5
imagePullPolicy: IfNotPresent
name: catalogue
ports:
- containerPort: 80
protocol: TCP
resources: {}
livenessProbe:
httpGet:
path: /health
port: 80
initialDelaySeconds: 300
periodSeconds: 3
readinessProbe:
httpGet:
path: /health
port: 80
initialDelaySeconds: 180
periodSeconds: 3
securityContext:
capabilities:
add:
- NET_BIND_SERVICE
drop:
- all
readOnlyRootFilesystem: true
runAsNonRoot: true
runAsUser: 10001
---
apiVersion: v1
kind: Service
metadata:
name: catalogue
labels:
name: catalogue
namespace: sock-shop
spec:
ports:
# the port that this service should serve on
- port: 80
targetPort: 80
selector:
name: catalogue

View File

@ -0,0 +1,69 @@
apiVersion: apps/v1
kind: Deployment
metadata:
annotations:
litmuschaos.io/chaos: "true"
labels:
app: sock-shop
name: front-end
name: front-end
namespace: sock-shop
spec:
replicas: 1
selector:
matchLabels:
app: sock-shop
name: front-end
template:
metadata:
labels:
app: sock-shop
name: front-end
spec:
containers:
- image: weaveworksdemos/front-end:0.3.12
imagePullPolicy: IfNotPresent
name: front-end
ports:
- containerPort: 8079
protocol: TCP
resources:
requests:
cpu: 100m
memory: 100Mi
livenessProbe:
httpGet:
path: /
port: 8079
initialDelaySeconds: 300
periodSeconds: 3
readinessProbe:
httpGet:
path: /
port: 8079
initialDelaySeconds: 30
periodSeconds: 3
securityContext:
capabilities:
drop:
- all
readOnlyRootFilesystem: true
runAsNonRoot: true
runAsUser: 10001
---
apiVersion: v1
kind: Service
metadata:
name: front-end
labels:
name: front-end
namespace: sock-shop
spec:
type: LoadBalancer
ports:
- port: 80
targetPort: 8079
nodePort: 30001
selector:
name: front-end

View File

@ -0,0 +1,63 @@
apiVersion: apps/v1
kind: Deployment
metadata:
annotations:
litmuschaos.io/chaos: "true"
labels:
app: sock-shop
name: orders-db
name: orders-db
namespace: sock-shop
spec:
replicas: 1
selector:
matchLabels:
app: sock-shop
name: orders-db
template:
metadata:
labels:
app: sock-shop
name: orders-db
spec:
containers:
- image: mongo
imagePullPolicy: Always
name: orders-db
ports:
- containerPort: 27017
name: mongo
protocol: TCP
resources: {}
securityContext:
capabilities:
add:
- CHOWN
- SETGID
- SETUID
drop:
- all
readOnlyRootFilesystem: true
volumeMounts:
- mountPath: /tmp
name: tmp-volume
volumes:
- emptyDir:
medium: Memory
name: tmp-volume
---
apiVersion: v1
kind: Service
metadata:
name: orders-db
labels:
name: orders-db
namespace: sock-shop
spec:
ports:
# the port that this service should serve on
- port: 27017
targetPort: 27017
selector:
name: orders-db

View File

@ -0,0 +1,81 @@
apiVersion: apps/v1
kind: Deployment
metadata:
annotations:
litmuschaos.io/chaos: "true"
labels:
app: sock-shop
name: orders
name: orders
namespace: sock-shop
spec:
replicas: 1
selector:
matchLabels:
app: sock-shop
name: orders
template:
metadata:
labels:
app: sock-shop
name: orders
spec:
containers:
- env:
- name: ZIPKIN
value: zipkin.jaeger.svc.cluster.local
- name: JAVA_OPTS
value: -Xms64m -Xmx128m -XX:PermSize=32m -XX:MaxPermSize=64m -XX:+UseG1GC
-Djava.security.egd=file:/dev/urandom
image: weaveworksdemos/orders:0.4.7
imagePullPolicy: IfNotPresent
name: orders
ports:
- containerPort: 80
protocol: TCP
resources: {}
securityContext:
capabilities:
add:
- NET_BIND_SERVICE
drop:
- all
readOnlyRootFilesystem: true
runAsNonRoot: true
runAsUser: 10001
volumeMounts:
- mountPath: /tmp
name: tmp-volume
livenessProbe:
httpGet:
path: /health
port: 80
initialDelaySeconds: 300
periodSeconds: 3
readinessProbe:
httpGet:
path: /health
port: 80
initialDelaySeconds: 180
periodSeconds: 3
volumes:
- emptyDir:
medium: Memory
name: tmp-volume
---
apiVersion: v1
kind: Service
metadata:
name: orders
labels:
name: orders
namespace: sock-shop
spec:
ports:
# the port that this service should serve on
- port: 80
targetPort: 80
selector:
name: orders

View File

@ -0,0 +1,66 @@
apiVersion: apps/v1
kind: Deployment
metadata:
annotations:
litmuschaos.io/chaos: "true"
labels:
app: sock-shop
name: payment
name: payment
namespace: sock-shop
spec:
replicas: 1
selector:
matchLabels:
app: sock-shop
name: payment
template:
metadata:
labels:
app: sock-shop
name: payment
spec:
containers:
- image: weaveworksdemos/payment:0.4.3
imagePullPolicy: IfNotPresent
name: payment
ports:
- containerPort: 80
protocol: TCP
securityContext:
capabilities:
add:
- NET_BIND_SERVICE
drop:
- all
readOnlyRootFilesystem: true
runAsNonRoot: true
runAsUser: 10001
livenessProbe:
httpGet:
path: /health
port: 80
initialDelaySeconds: 300
periodSeconds: 3
readinessProbe:
httpGet:
path: /health
port: 80
initialDelaySeconds: 180
periodSeconds: 3
---
apiVersion: v1
kind: Service
metadata:
name: payment
labels:
name: payment
namespace: sock-shop
spec:
ports:
# the port that this service should serve on
- port: 80
targetPort: 80
selector:
name: payment

View File

@ -0,0 +1,59 @@
apiVersion: apps/v1
kind: Deployment
metadata:
annotations:
litmuschaos.io/chaos: "true"
labels:
app: sock-shop
name: queue-master
name: queue-master
namespace: sock-shop
spec:
replicas: 1
selector:
matchLabels:
app: sock-shop
name: queue-master
template:
metadata:
labels:
app: sock-shop
name: queue-master
spec:
containers:
- image: weaveworksdemos/queue-master:0.3.1
imagePullPolicy: IfNotPresent
name: queue-master
ports:
- containerPort: 80
protocol: TCP
livenessProbe:
httpGet:
path: /health
port: 80
initialDelaySeconds: 300
periodSeconds: 3
readinessProbe:
httpGet:
path: /health
port: 80
initialDelaySeconds: 180
periodSeconds: 3
---
apiVersion: v1
kind: Service
metadata:
name: queue-master
labels:
name: queue-master
annotations:
prometheus.io/path: "/prometheus"
namespace: sock-shop
spec:
ports:
# the port that this service should serve on
- port: 80
targetPort: 80
selector:
name: queue-master

View File

@ -0,0 +1,61 @@
apiVersion: apps/v1
kind: Deployment
metadata:
annotations:
litmuschaos.io/chaos: "true"
labels:
app: sock-shop
name: rabbitmq
name: rabbitmq
namespace: sock-shop
spec:
replicas: 1
selector:
matchLabels:
app: sock-shop
name: rabbitmq
template:
metadata:
labels:
app: sock-shop
name: rabbitmq
spec:
containers:
- image: rabbitmq:3.6.8
imagePullPolicy: IfNotPresent
name: rabbitmq
ports:
- containerPort: 5672
protocol: TCP
resources: {}
securityContext:
capabilities:
add:
- CHOWN
- SETGID
- SETUID
- DAC_OVERRIDE
drop:
- all
readOnlyRootFilesystem: true
---
apiVersion: v1
kind: Service
metadata:
name: rabbitmq
labels:
name: rabbitmq
namespace: sock-shop
spec:
ports:
# the port that this service should serve on
- port: 5672
name: rabbitmq
targetPort: 5672
- port: 9090
name: exporter
targetPort: exporter
protocol: TCP
selector:
name: rabbitmq

View File

@ -0,0 +1,81 @@
apiVersion: apps/v1
kind: Deployment
metadata:
annotations:
litmuschaos.io/chaos: "true"
labels:
app: sock-shop
name: shipping
name: shipping
namespace: sock-shop
spec:
replicas: 1
selector:
matchLabels:
app: sock-shop
name: shipping
template:
metadata:
labels:
app: sock-shop
name: shipping
spec:
containers:
- env:
- name: ZIPKIN
value: zipkin.jaeger.svc.cluster.local
- name: JAVA_OPTS
value: -Xms64m -Xmx128m -XX:PermSize=32m -XX:MaxPermSize=64m -XX:+UseG1GC
-Djava.security.egd=file:/dev/urandom
image: weaveworksdemos/shipping:0.4.8
imagePullPolicy: IfNotPresent
name: shipping
ports:
- containerPort: 80
protocol: TCP
resources: {}
securityContext:
capabilities:
add:
- NET_BIND_SERVICE
drop:
- all
readOnlyRootFilesystem: true
runAsNonRoot: true
runAsUser: 10001
livenessProbe:
httpGet:
path: /health
port: 80
initialDelaySeconds: 300
periodSeconds: 3
readinessProbe:
httpGet:
path: /health
port: 80
initialDelaySeconds: 180
periodSeconds: 3
volumeMounts:
- mountPath: /tmp
name: tmp-volume
volumes:
- emptyDir:
medium: Memory
name: tmp-volume
---
apiVersion: v1
kind: Service
metadata:
name: shipping
labels:
name: shipping
namespace: sock-shop
spec:
ports:
# the port that this service should serve on
- port: 80
targetPort: 80
selector:
name: shipping

View File

@ -0,0 +1,62 @@
apiVersion: apps/v1
kind: Deployment
metadata:
annotations:
litmuschaos.io/chaos: "true"
labels:
app: sock-shop
name: user-db
name: user-db
namespace: sock-shop
spec:
replicas: 1
selector:
matchLabels:
app: sock-shop
name: user-db
template:
metadata:
labels:
app: sock-shop
name: user-db
spec:
containers:
- image: weaveworksdemos/user-db:0.4.0
imagePullPolicy: IfNotPresent
name: user-db
ports:
- containerPort: 27017
name: mongo
protocol: TCP
resources: {}
securityContext:
capabilities:
add:
- CHOWN
- SETGID
- SETUID
drop:
- all
readOnlyRootFilesystem: true
volumeMounts:
- mountPath: /tmp
name: tmp-volume
volumes:
- emptyDir:
medium: Memory
name: tmp-volume
---
apiVersion: v1
kind: Service
metadata:
name: user-db
labels:
name: user-db
namespace: sock-shop
spec:
ports:
# the port that this service should serve on
- port: 27017
targetPort: 27017
selector:
name: user-db

View File

@ -0,0 +1,27 @@
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
name: user-load
name: user-load
namespace: sock-shop
spec:
replicas: 1
selector:
matchLabels:
name: user-load
template:
metadata:
creationTimestamp: null
labels:
name: user-load
spec:
containers:
- args:
- -h
- front-end:80
- -r
- "9999999"
image: weaveworksdemos/load-test
imagePullPolicy: Always
name: user-load

View File

@ -0,0 +1,69 @@
apiVersion: apps/v1
kind: Deployment
metadata:
annotations:
litmuschaos.io/chaos: "true"
labels:
app: sock-shop
name: user
name: user
namespace: sock-shop
spec:
replicas: 1
selector:
matchLabels:
app: sock-shop
name: user
template:
metadata:
labels:
app: sock-shop
name: user
spec:
containers:
- env:
- name: MONGO_HOST
value: user-db:27017
image: weaveworksdemos/user:0.4.7
imagePullPolicy: IfNotPresent
name: user
ports:
- containerPort: 80
protocol: TCP
livenessProbe:
httpGet:
path: /health
port: 80
initialDelaySeconds: 300
periodSeconds: 3
readinessProbe:
httpGet:
path: /health
port: 80
initialDelaySeconds: 180
periodSeconds: 3
securityContext:
capabilities:
add:
- NET_BIND_SERVICE
drop:
- all
readOnlyRootFilesystem: true
runAsNonRoot: true
runAsUser: 10001
---
apiVersion: v1
kind: Service
metadata:
name: user
labels:
name: user
namespace: sock-shop
spec:
ports:
# the port that this service should serve on
- port: 80
targetPort: 80
selector:
name: user