# Run yCrash in Kubernetes
# Deployment Documentation for yCrash Server in Kubernetes
This document outlines the deployment of the yCrash server (yc-server) in a Kubernetes cluster. The setup includes:
- A Secret for license management.
- A Deployment defining the yc-server application.
- A Service for network access.
- An Ingress for external routing.
- Persistent storage for logs and uploads.
# Prerequisites
- Kubernetes cluster with kubectl configured.
- Persistent storage provisioned for logs and uploads.
- Valid
license.licfor yc-server - NGINX Ingress Controller installed for routing.
- Namespace
yc-appsshould exist or be created before deployment:
kubectl create namespace yc-apps
1
# Step 1: Secret Creation
Create a Secret to store the yCrash server license file.
apiVersion: v1
kind: Secret
metadata:
name: ycrash-server-license
namespace: yc-apps
stringData:
license.lic: |
Licensor=********************
Licensee=********************
UserNo=********************
IPAddress=********************
Feature_1=********************
Feature_2=********************
Expiration=********************
Signature=********************
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
2
3
4
5
6
7
8
9
10
11
12
13
14
15
Apply the secret:
kubectl apply -f secret.yaml
1
# Step 2: Persistent Storage Configuration
Define PersistentVolumeClaims for logs and uploads.
Logs PVC
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: logs-pvc
namespace: yc-apps
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 2Gi
1
2
3
4
5
6
7
8
9
10
11
2
3
4
5
6
7
8
9
10
11
Uploads PVC
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: uploads-pvc
namespace: yc-apps
spec:
accessModes:
- ReadWriteMany
resources:
requests:
storage: 5Gi
1
2
3
4
5
6
7
8
9
10
11
2
3
4
5
6
7
8
9
10
11
Apply the PVCs:
kubectl apply -f pvc-logs.yaml
kubectl apply -f pvc-uploads.yaml
1
2
2
# Step 3: Deployment
Deploy the yCrash server application with the following Deployment configuration:
apiVersion: apps/v1
kind: Deployment
metadata:
name: yc-apps
namespace: yc-apps
spec:
replicas: 2
selector:
matchLabels:
app: yc-apps
template:
metadata:
labels:
app: yc-apps
spec:
terminationGracePeriodSeconds: 180
containers:
- name: yc-server
image: ycrash/ycrash:latest
resources:
requests:
memory: 2Gi
cpu: "200m"
limits:
memory: 4Gi
cpu: "500m"
volumeMounts:
- name: ycrash-server-license
mountPath: "/opt/workspace/yc/uploads/license.lic"
subPath: license.lic
- name: logs-pvc
mountPath: "/opt/workspace/yc/logs"
- name: uploads-pvc
mountPath: "/opt/workspace/yc/uploads"
- name: tmp
mountPath: "/tmp"
volumes:
- name: ycrash-server-license
secret:
secretName: ycrash-server-license
- name: logs-pvc
persistentVolumeClaim:
claimName: logs-pvc
- name: uploads-pvc
persistentVolumeClaim:
claimName: uploads-pvc
- name: tmp
emptyDir: {}
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
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
Apply the deployment:
kubectl apply -f deployment.yaml
1
# Step 4: Service
Expose the application within the cluster using a Service.
apiVersion: v1
kind: Service
metadata:
name: yc-server-service
namespace: yc-apps
spec:
selector:
app: yc-apps
ports:
- protocol: TCP
port: 8080
targetPort: 8080
type: LoadBalancer
1
2
3
4
5
6
7
8
9
10
11
12
13
2
3
4
5
6
7
8
9
10
11
12
13
Apply the service:
kubectl apply -f service.yaml
1
# Step 5: Ingress
Configure routing with an Ingress resource.
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: yc-server-ingress
namespace: yc-apps
annotations:
nginx.ingress.kubernetes.io/rewrite-target: /
spec:
rules:
- host: yc-server-app.local
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: yc-server-service
port:
number: 8080
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
Apply the ingress:
kubectl apply -f ingress.yaml
1
# Verification Steps
- Ensure all resources are created:
kubectl get all -n yc-apps
1
- Add
yc-server-app.localto your/etc/hostsfile pointing to the ingress IP and access the application:
Internal: yc-server-serviceExternal: http://yc-server-app.local (opens new window)
# Troubleshooting
- Check logs:
kubectl logs -f deployment/yc-apps -n yc-apps
1
- Verify Routes:
kubectl get svc -n yc-apps
1
# Combined Deployment YAML file
---
# Secret for yc-server license
apiVersion: v1
kind: Secret
metadata:
name: ycrash-server-license
namespace: yc-apps
stringData:
license.lic: |
Licensor=********************
Licensee=********************
UserNo=********************
IPAddress=********************
Feature_1=********************
Feature_2=********************
Expiration=********************
Signature=********************
---
# Deployment for yc-server
apiVersion: apps/v1
kind: Deployment
metadata:
name: yc-apps
namespace: yc-apps
labels:
app: yc-apps
spec:
replicas: 2
selector:
matchLabels:
app: yc-apps
template:
metadata:
labels:
app: yc-apps
spec:
terminationGracePeriodSeconds: 180
containers:
- name: yc-server
image: ycrash/ycrash:latest
imagePullPolicy: Always
args:
- "-Xms2g"
- "-Xmx4g"
- "-Xss40m"
- "-verbose:gc"
- "-Xlog:gc*:file=/opt/workspace/yc/logs/yc-gclog-%p.gc:time,uptime,level,tags"
- "-XX:+UnlockDiagnosticVMOptions"
- "-XX:+HeapDumpOnOutOfMemoryError"
- "-XX:HeapDumpPath=/opt/workspace/yc/logs/ba-heapdump-%p.hprof"
- "-XX:ErrorFile=/opt/workspace/yc/logs/ba-log-hs_err_pid-%p.log"
- "-Duser.language=en"
- "-Duser.country=en_US"
- "-Djava.awt.headless=true"
- "-DhprofStrictnessWarning=true"
- "-DonlyTroubleshootingReport=true"
- "-Dapp=yc"
- "-DlogDir=/opt/workspace/yc/logs"
- "-DuploadDir=/opt/workspace/yc/uploads"
- "-jar"
- "webapp-runner.jar"
- "-AconnectionTimeout=3600000"
- "--secure-error-report-valve"
- "--port"
- "8080"
- "yc.war"
ports:
- containerPort: 8080
resources:
requests:
memory: 2Gi
cpu: "200m"
limits:
memory: 4Gi
cpu: "500m"
volumeMounts:
- name: ycrash-server-license
mountPath: "/opt/workspace/yc/uploads/license.lic"
subPath: license.lic
- name: logs-pvc
mountPath: "/opt/workspace/yc/logs"
- name: uploads-pvc
mountPath: "/opt/workspace/yc/uploads"
- name: tmp
mountPath: "/tmp"
volumes:
- name: ycrash-server-license
secret:
secretName: ycrash-server-license
items:
- key: license.lic
path: license.lic
- name: logs-pvc
persistentVolumeClaim:
claimName: logs-pvc
- name: uploads-pvc
persistentVolumeClaim:
claimName: uploads-pvc
- name: tmp
emptyDir: {}
---
# Service for yc-server
apiVersion: v1
kind: Service
metadata:
name: yc-server-service
labels:
app: yc-apps
namespace: yc-apps
spec:
selector:
app: yc-apps
ports:
- protocol: TCP
port: 8080
targetPort: 8080
type: LoadBalancer
---
# Ingress for yc-server
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: yc-server-ingress
namespace: yc-apps
annotations:
nginx.ingress.kubernetes.io/rewrite-target: /
spec:
rules:
- host: yc-server-app.local
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: yc-server-service
port:
number: 8080
---
# PersistentVolumeClaim for Logs
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: logs-pvc
namespace: yc-apps
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 2Gi
---
# PersistentVolumeClaim for uploads
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: uploads-pvc
namespace: yc-apps
spec:
accessModes:
- ReadWriteMany
resources:
requests:
storage: 5Gi
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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
Apply the combined deployment:
kubectl apply -f combined-deployment.yaml
1