-
Notifications
You must be signed in to change notification settings - Fork 0
/
service-with-akita.yaml
140 lines (140 loc) · 2.83 KB
/
service-with-akita.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
apiVersion: v1
kind: Service
metadata:
name: todo-service
spec:
type: NodePort
selector:
app: todo-service-deployment
ports:
- protocol: TCP
port: 5000
nodePort: 30123
---
apiVersion: v1
kind: ConfigMap
metadata:
name: todo-service-config
data:
REDIS_HOST: redis
REDIS_PORT: "6379"
STAT_SERVICE_URL: http://statistics-service:5001/stats
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: todo-service-deployment
labels:
app: todo-service-deployment
spec:
replicas: 1
selector:
matchLabels:
app: todo-service-deployment
template:
metadata:
labels:
app: todo-service-deployment
spec:
containers:
- name: app
image: bfwaterdog/todo-service-example
envFrom:
- configMapRef:
name: todo-service-config
ports:
- containerPort: 5000
- name: akita
image: akitasoftware/cli:latest
lifecycle:
# Pre-stop hooks: https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#hook-handler-execution
preStop:
exec:
command: ["/bin/sh", "-c", "AKITA_PID=$(pgrep akita) && kill -2 $AKITA_PID && tail -f /proc/$AKITA_PID/fd/1"]
env:
- name: AKITA_API_KEY_ID
valueFrom:
secretKeyRef:
name: akita-secrets
key: api-key-id
- name: AKITA_API_KEY_SECRET
valueFrom:
secretKeyRef:
name: akita-secrets
key: api-key-secret
args:
- learn
- --filter
- port 5000
- --service
- k8s-integration
---
apiVersion: v1
kind: Service
metadata:
name: statistics-service
spec:
type: NodePort
selector:
app: statistics-service-deployment
ports:
- protocol: TCP
port: 5001
nodePort: 30456
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: statistics-service-deployment
labels:
app: statistics-service-deployment
spec:
replicas: 1
selector:
matchLabels:
app: statistics-service-deployment
template:
metadata:
labels:
app: statistics-service-deployment
spec:
containers:
- name: app
image: bfwaterdog/statistics-service-example
ports:
- containerPort: 5001
---
apiVersion: v1
kind: Service
metadata:
name: redis
spec:
type: ClusterIP
ports:
- port: 6379
targetPort: 6379
name: client
selector:
app: redis
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: redis
spec:
serviceName: redis
replicas: 1
selector:
matchLabels:
app: redis
template:
metadata:
labels:
app: redis
spec:
containers:
- name: redis
image: redis:6.2.3-alpine
ports:
- containerPort: 6379
name: client