-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy path.kubernetes.yml
151 lines (151 loc) · 4.05 KB
/
.kubernetes.yml
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
141
142
143
144
145
146
147
148
149
150
151
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: $log_volume_pvc
spec:
storageClassName: $k8s_storageclass
accessModes:
- ReadWriteMany
resources:
requests:
storage: $log_volume_size
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: $app_name
labels:
app: $app_name
spec:
replicas: $k8s_replicas
revisionHistoryLimit: 1
selector:
matchLabels:
app: $app_name
strategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 1
maxUnavailable: 25%
template:
metadata:
labels:
app: $app_name
spec:
imagePullSecrets:
- name: $DOCKER_PULL_SECRET
volumes:
- name: logvolume
persistentVolumeClaim:
claimName: $log_volume_pvc
- name: application-config
configMap:
name: $SPRING_CONFIG_MAP
items:
- key: application.yml
path: application.yml
containers:
- name: $app_name
image: $IMAGE
imagePullPolicy: Always
ports:
- containerPort: $port
env:
# - name: JAVA_OPTS
# value: "-Dhttp.proxyHost=$http_proxy_host -Dhttp.proxyPort=$http_proxy_port -Dhttps.proxyHost=$http_proxy_host -Dhttps.proxyPort=$http_proxy_port -Dhttp.nonProxyHosts=$non_proxy_hosts"
# - name: HTTP_PROXY
# value: "http://$http_proxy_host:$http_proxy_port"
# - name: HTTPS_PROXY
# value: "http://$http_proxy_host:$http_proxy_port"
# - name: http_proxy
# value: "http://$http_proxy_host:$http_proxy_port"
# - name: https_proxy
# value: "http://$http_proxy_host:$http_proxy_port"
- name: APM_AGENT_OPTS
value: "-javaagent:${APM_AGENT_JAR} -Delastic.apm.service_name=${app_name} -Delastic.apm.application_packages=${APM_PACKAGE} -Delastic.apm.server_urls=${APM_SERVER}"
volumeMounts:
- name: application-config
mountPath: "/app/config/"
readOnly: true
- name: logvolume
mountPath: $logspath
livenessProbe:
httpGet:
path: $contextPath/actuator/health
port: $port
initialDelaySeconds: 60
periodSeconds: 10
timeoutSeconds: 120
readinessProbe:
httpGet:
path: $contextPath/actuator/health
port: $port
initialDelaySeconds: 60
periodSeconds: 10
timeoutSeconds: 120
---
apiVersion: v1
kind: Service
metadata:
name: $app_name-service
spec:
selector:
app: $app_name
ports:
- protocol: TCP
port: $port
targetPort: $port
type: NodePort
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: $app_name-filebeat
labels:
app: $app_name-filebeat
spec:
replicas: 1
revisionHistoryLimit: 0
selector:
matchLabels:
app: $app_name-filebeat
strategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 1
maxUnavailable: 25%
template:
metadata:
labels:
app: $app_name-filebeat
spec:
volumes:
- name: logvolume
persistentVolumeClaim:
claimName: $log_volume_pvc
- name: filebeat-config
configMap:
name: $FILEBEAT_CONFIG_MAP
items:
- key: filebeat.yml
path: filebeat.yml
containers:
- name: $app_name-filebeat
image: docker.elastic.co/beats/filebeat:7.8.0
env:
- name: POD_NAMESPACE
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: metadata.namespace
- name: NODE_NAME
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: spec.nodeName
volumeMounts:
- name: logvolume
mountPath: $logspath
- name: filebeat-config
mountPath: /usr/share/filebeat/filebeat.yml
subPath: filebeat.yml