Skip to content

Commit

Permalink
Add Kubernetes deployment support (#38)
Browse files Browse the repository at this point in the history
Provide Kubernetes Deployment for anyone who need to use it.
  • Loading branch information
pichuang committed Aug 18, 2023
1 parent fca1cbe commit 34c484d
Show file tree
Hide file tree
Showing 3 changed files with 108 additions and 0 deletions.
20 changes: 20 additions & 0 deletions k8s/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Kubernetes Deployment

```bash
# Deploy the service
$ kubectl apply -f chatgpt-lite-deployment.yaml -f env-secret.yaml
namespace/chatgpt-lite created
deployment.apps/chatgpt-lite created
service/chatgpt-lite created
secret/env created

# Get the service
$ kubectl -n chatgpt-lite get svc
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
chatgpt-lite ClusterIP 10.0.199.26 <none> 3000/TCP 7m8s

# Use port-forward to access the service
$ kubectl -n chatgpt-lite port-forward svc/chatgpt-lite 5566:3000
Forwarding from 127.0.0.1:5566 -> 3000
Forwarding from [::1]:5566 -> 3000
```
73 changes: 73 additions & 0 deletions k8s/chatgpt-lite-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
---
apiVersion: v1
kind: Namespace
metadata:
name: chatgpt-lite
---
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: chatgpt-lite
name: chatgpt-lite
namespace: chatgpt-lite
spec:
replicas: 1
selector:
matchLabels:
app: chatgpt-lite
strategy: {}
template:
metadata:
labels:
app: chatgpt-lite
spec:
containers:
- env:
- name: AZURE_OPENAI_API_BASE_URL
valueFrom:
secretKeyRef:
key: AZURE_OPENAI_API_BASE_URL
name: env
- name: AZURE_OPENAI_API_KEY
valueFrom:
secretKeyRef:
key: AZURE_OPENAI_API_KEY
name: env
- name: AZURE_OPENAI_DEPLOYMENT
valueFrom:
secretKeyRef:
key: AZURE_OPENAI_DEPLOYMENT
name: env
- name: OPENAI_API_BASE_URL
valueFrom:
secretKeyRef:
key: OPENAI_API_BASE_URL
name: env
- name: OPENAI_API_KEY
valueFrom:
secretKeyRef:
key: OPENAI_API_KEY
name: env
image: docker.io/blrchen/chatgpt-lite:main
name: chatgpt-lite
ports:
- containerPort: 3000
resources: {}
restartPolicy: Always
---
apiVersion: v1
kind: Service
metadata:
creationTimestamp: null
labels:
app: chatgpt-lite
name: chatgpt-lite
namespace: chatgpt-lite
spec:
ports:
- name: "3000"
port: 3000
targetPort: 3000
selector:
app: chatgpt-lite
15 changes: 15 additions & 0 deletions k8s/env-secret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
apiVersion: v1
kind: Secret
metadata:
name: env
namespace: chatgpt-lite
type: Opaque
data:
# echo -n 'Hello chatgpi-lite' | base64
# SGVsbG8gY2hhdGdwaS1saXRl
OPENAI_API_BASE_URL: ""
OPENAI_API_KEY: ""
AZURE_OPENAI_API_BASE_URL: ""
AZURE_OPENAI_API_KEY: ""
AZURE_OPENAI_DEPLOYMENT: ""

1 comment on commit 34c484d

@vercel
Copy link

@vercel vercel bot commented on 34c484d Aug 18, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

gptlite – ./

gptlite.vercel.app
gptlite-git-main-blrchen.vercel.app
gptlite-blrchen.vercel.app

Please sign in to comment.