Compare commits

...

2 Commits

Author SHA1 Message Date
30f836f04c n8n和chroma可以了 2025-02-05 04:35:01 +08:00
083ca14f37 n8n和chroma可以了 2025-02-05 04:33:13 +08:00
9 changed files with 135 additions and 3 deletions

View File

@ -1,5 +1,13 @@
## 如何重新创建整个namespace ## 如何重新创建整个namespace
```
./init.sh
```
```
```
下面都都不用看了, 直接执行上面的语句
先删了 namespace efk这样里面资源就都没了除了pv 先删了 namespace efk这样里面资源就都没了除了pv
然后 microk8s.kubectl create namespace efk 然后 microk8s.kubectl create namespace efk

View File

@ -33,13 +33,13 @@ spec:
name: elasticsearch-secret name: elasticsearch-secret
key: elastic_password key: elastic_password
- name: ES_JAVA_OPTS - name: ES_JAVA_OPTS
value: "-Xms2g -Xmx2g" # 设置 JVM 堆大小为 2GB value: "-Xms2g -Xmx4g" # 设置 JVM 堆大小为 2GB-4GB
resources: # 增加资源限制 resources: # 增加资源限制
requests: requests:
memory: "2Gi" memory: "4Gi"
cpu: "1" cpu: "1"
limits: limits:
memory: "4Gi" memory: "6Gi"
cpu: "2" cpu: "2"
volumeMounts: volumeMounts:
- name: data-volume - name: data-volume

22
n8n/chroma-configmap.yaml Normal file
View File

@ -0,0 +1,22 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: chroma-config
namespace: n8n
data:
log_config.yml: |
version: 1
disable_existing_loggers: False
formatters:
simple:
format: "%(asctime)s - %(name)s - %(levelname)s - %(message)s"
handlers:
console:
class: logging.StreamHandler
level: DEBUG
formatter: simple
stream: ext://sys.stdout
root:
level: DEBUG
handlers: [console]

View File

@ -0,0 +1,27 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: chroma-deployment
namespace: n8n
spec:
replicas: 1
selector:
matchLabels:
app: chroma
template:
metadata:
labels:
app: chroma
spec:
containers:
- name: chroma
image: localhost:32000/chromadb/chroma
ports:
- containerPort: 8000
volumeMounts:
- name: chroma-storage
mountPath: /home/node/.n8n/
volumes:
- name: chroma-storage
persistentVolumeClaim:
claimName: chroma-pvc

18
n8n/chroma-ingress.yaml Normal file
View File

@ -0,0 +1,18 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: chroma-ingress
namespace: n8n
spec:
ingressClassName: traefik
rules:
- host: chroma.k8s.xunlang.home
http:
paths:
- backend:
service:
name: chroma-service
port:
number: 80
path: /
pathType: Prefix

15
n8n/chroma-pv.yaml Normal file
View File

@ -0,0 +1,15 @@
apiVersion: v1
kind: PersistentVolume
metadata:
name: chroma-pv
namespace: n8n
spec:
capacity:
storage: 10Gi
volumeMode: Filesystem
accessModes:
- ReadWriteOnce
persistentVolumeReclaimPolicy: Retain
storageClassName: microk8s-hostpath
hostPath:
path: /var/snap/microk8s/common/mnt/data/chroma

12
n8n/chroma-pvc.yaml Normal file
View File

@ -0,0 +1,12 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: chroma-pvc
namespace: n8n
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 10Gi
storageClassName: microk8s-hostpath

13
n8n/chroma-service.yaml Normal file
View File

@ -0,0 +1,13 @@
apiVersion: v1
kind: Service
metadata:
name: chroma-service
namespace: n8n
spec:
selector:
app: chroma
ports:
- protocol: TCP
port: 80
targetPort: 8000
type: ClusterIP

17
n8n/inin_chroma.sh Executable file
View File

@ -0,0 +1,17 @@
# 创建命名空间(如果不存在)
microk8s.kubectl create namespace n8n
# 创建 PV
microk8s.kubectl apply -f chroma-pv.yaml
# 创建 PVC
microk8s.kubectl apply -f chroma-pvc.yaml
# 创建 Deployment
microk8s.kubectl apply -f chroma-deployment.yaml
# 创建 Service
microk8s.kubectl apply -f chroma-service.yaml
# 创建 Ingress
microk8s.kubectl apply -f chroma-ingress.yaml