Skip to content

Commit da20aed

Browse files
authored
feat: add kubernetes deploy (Chanzhaoyu#1001)
1 parent c0f4af0 commit da20aed

File tree

3 files changed

+96
-0
lines changed

3 files changed

+96
-0
lines changed

kubernetes/README.md

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
## 增加一个Kubernetes的部署方式
2+
```
3+
kubectl apply -f deploy.yaml
4+
```
5+
6+
### 如果需要Ingress域名接入
7+
```
8+
kubectl apply -f ingress.yaml
9+
```

kubernetes/deploy.yaml

+66
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: chatgpt-web
5+
labels:
6+
app: chatgpt-web
7+
spec:
8+
replicas: 1
9+
selector:
10+
matchLabels:
11+
app: chatgpt-web
12+
strategy:
13+
type: RollingUpdate
14+
template:
15+
metadata:
16+
labels:
17+
app: chatgpt-web
18+
spec:
19+
containers:
20+
- image: chenzhaoyu94/chatgpt-web
21+
name: chatgpt-web
22+
imagePullPolicy: Always
23+
ports:
24+
- containerPort: 3002
25+
env:
26+
- name: OPENAI_API_KEY
27+
value: sk-xxx
28+
- name: OPENAI_API_BASE_URL
29+
value: "https://api.openai.com"
30+
- name: OPENAI_API_MODEL
31+
value: gpt-3.5-turbo
32+
- name: API_REVERSE_PROXY
33+
value: https://bypass.duti.tech/api/conversation
34+
- name: AUTH_SECRET_KEY
35+
value: '123456'
36+
- name: TIMEOUT_MS
37+
value: '60000'
38+
- name: SOCKS_PROXY_HOST
39+
value: ''
40+
- name: SOCKS_PROXY_PORT
41+
value: ''
42+
- name: HTTPS_PROXY
43+
value: ''
44+
resources:
45+
limits:
46+
cpu: 500m
47+
memory: 500Mi
48+
requests:
49+
cpu: 300m
50+
memory: 300Mi
51+
---
52+
apiVersion: v1
53+
kind: Service
54+
metadata:
55+
labels:
56+
app: chatgpt-web
57+
name: chatgpt-web
58+
spec:
59+
ports:
60+
- name: chatgpt-web
61+
port: 3002
62+
protocol: TCP
63+
targetPort: 3002
64+
selector:
65+
app: chatgpt-web
66+
type: ClusterIP

kubernetes/ingress.yaml

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
apiVersion: networking.k8s.io/v1
2+
kind: Ingress
3+
metadata:
4+
annotations:
5+
kubernetes.io/ingress.class: nginx
6+
nginx.ingress.kubernetes.io/proxy-connect-timeout: "5"
7+
name: chatgpt-web
8+
spec:
9+
rules:
10+
- host: chatgpt.example.com
11+
http:
12+
paths:
13+
- backend:
14+
service:
15+
name: chatgpt-web
16+
port:
17+
number: 3002
18+
path: /
19+
pathType: ImplementationSpecific
20+
tls:
21+
- secretName: chatgpt-web-tls

0 commit comments

Comments
 (0)