build: update k8s origin deploys.

pull/2919/head
Monet Lee 10 months ago
parent dc48098585
commit 201f1f009e

@ -0,0 +1,73 @@
# Kubernetes Deployment
## Origin Deploy
## First, Deployment All config and services
1. Enter the target dir
`cd ./deployments/deploy/`
2. Deploy configs and dependencies
Apply all config and dependencies
`kubectl apply -f ./openim-config.yml -f ./notification-config.yml -f ./kafka-service.yml`
Run infrasturcture components.
`kubectl apply -f minio-service.yml -f minio-statefulset.yml -f mongo-service.yml -f mongo-statefulset.yml -f redis-service.yml -f redis-statefulset.yml -f kafka-service.yml -f kafka-statefulset.yml`
>Note: Ensure that infrastructure services like MinIO, Redis, and Kafka are running before deploying the main applications.
Final, run all deployments and services
```bash
kubectl apply \
-f openim-api-deployment.yml \
-f openim-api-service.yml \
-f openim-crontask-deployment.yml \
-f openim-rpc-user-deployment.yml \
-f openim-rpc-user-service.yml \
-f openim-msggateway-deployment.yml \
-f openim-msggateway-service.yml \
-f openim-push-deployment.yml \
-f openim-push-service.yml \
-f openim-msgtransfer-service.yml \
-f openim-msgtransfer-deployment.yml \
-f openim-rpc-conversation-deployment.yml \
-f openim-rpc-conversation-service.yml \
-f openim-rpc-auth-deployment.yml \
-f openim-rpc-auth-service.yml \
-f openim-rpc-group-deployment.yml \
-f openim-rpc-group-service.yml \
-f openim-rpc-friend-deployment.yml \
-f openim-rpc-friend-service.yml \
-f openim-rpc-msg-deployment.yml \
-f openim-rpc-msg-service.yml \
-f openim-rpc-third-deployment.yml \
-f openim-rpc-third-service.yml
```
4. Verification
After deploying the services, verify that everything is running smoothly:
```bash
# Check the status of all pods
kubectl get pods
# Check the status of services
kubectl get svc
# Check the status of deployments
kubectl get deployments
# View all resources
kubectl get all
```
5. clean all
`kubectl delete -f ./`
### Notes:
- If you use a specific namespace for your deployment, be sure to append the -n <namespace> flag to your kubectl commands.

@ -0,0 +1,25 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: openim-ingress
annotations:
nginx.ingress.kubernetes.io/rewrite-target: /
spec:
ingressClassName: openim-nginx
rules:
- http:
paths:
- path: /openim-api
pathType: Prefix
backend:
service:
name: openim-api-service
port:
number: 10002
- path: /openim-msggateway
pathType: Prefix
backend:
service:
name: openim-msggateway-service
port:
number: 10001

@ -0,0 +1,20 @@
apiVersion: v1
kind: Service
metadata:
name: kafka-service
labels:
app: kafka
spec:
ports:
- name: plaintext
port: 9092
targetPort: 9092
- name: controller
port: 9093
targetPort: 9093
- name: external
port: 19094
targetPort: 9094
selector:
app: kafka
type: ClusterIP

@ -0,0 +1,104 @@
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: kafka-statefulset
labels:
app: kafka
spec:
replicas: 1
selector:
matchLabels:
app: kafka
serviceName: "kafka-service"
template:
metadata:
labels:
app: kafka
spec:
containers:
- name: kafka
image: bitnami/kafka:3.5.1
imagePullPolicy: IfNotPresent
resources:
limits:
memory: "2Gi"
cpu: "1000m"
requests:
memory: "1Gi"
cpu: "500m"
ports:
- containerPort: 9092 # PLAINTEXT
- containerPort: 9093 # CONTROLLER
- containerPort: 9094 # EXTERNAL
# command:
# - /bin/bash
# - "-c"
# - |
# # /opt/bitnami/scripts/kafka/run.sh & /opt/bitnami/kafka/create-topic.sh; wait
# # /opt/bitnami/scripts/kafka/entrypoint.sh && /opt/bitnami/scripts/kafka/setup.sh && /opt/bitnami/scripts/kafka/run.sh
# & while ! echo > /dev/tcp/localhost/9092; do
# echo "Waiting for Kafka to start..."
# sleep 5
# done
# /opt/bitnami/kafka/create-topic.sh
# tail -f /dev/null
env:
- name: TZ
value: "Asia/Shanghai"
- name: KAFKA_CFG_NODE_ID
value: "0"
- name: KAFKA_CFG_PROCESS_ROLES
value: "controller,broker"
- name: KAFKA_CFG_CONTROLLER_QUORUM_VOTERS
value: "0@kafka-service:9093"
- name: KAFKA_CFG_LISTENERS
value: "PLAINTEXT://:9092,CONTROLLER://:9093,EXTERNAL://:9094"
- name: KAFKA_CFG_ADVERTISED_LISTENERS
value: "PLAINTEXT://kafka-service:9092,EXTERNAL://kafka-service:19094"
- name: KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP
value: "CONTROLLER:PLAINTEXT,EXTERNAL:PLAINTEXT,PLAINTEXT:PLAINTEXT"
- name: KAFKA_CFG_CONTROLLER_LISTENER_NAMES
value: "CONTROLLER"
volumeMounts:
- name: kafka-data
mountPath: /bitnami/kafka
- name: kafka-scripts
mountPath: /opt/bitnami/kafka/create-topic.sh
subPath: create-topic.sh
- name: create-topics
image: bitnami/kafka:3.5.1
command:
- /bin/bash
- "-c"
- |
/opt/bitnami/kafka/create-topic.sh && \
tail -f /dev/null
volumeMounts:
- name: kafka-scripts
mountPath: /opt/bitnami/kafka/create-topic.sh
subPath: create-topic.sh
- name: kafka-data
mountPath: /bitnami/kafka
volumes:
- name: kafka-scripts
configMap:
name: openim-config
defaultMode: 0755
items:
- key: create-topic.sh
path: create-topic.sh
- name: kafka-data
persistentVolumeClaim:
claimName: kafka-pvc
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: kafka-pvc
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 10Gi

@ -0,0 +1,18 @@
---
apiVersion: v1
kind: Service
metadata:
name: minio-service
spec:
selector:
app: minio
ports:
- name: minio
protocol: TCP
port: 10005 # External port for accessing MinIO service
targetPort: 9000 # Container port for MinIO service
- name: minio-console
protocol: TCP
port: 19090 # External port for accessing MinIO console
targetPort: 9090 # Container port for MinIO console
type: NodePort

@ -0,0 +1,89 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: minio
labels:
app: minio
spec:
replicas: 1
selector:
matchLabels:
app: minio
template:
metadata:
labels:
app: minio
spec:
containers:
- name: minio
image: minio/minio:RELEASE.2024-01-11T07-46-16Z
imagePullPolicy: IfNotPresent
ports:
- containerPort: 9000 # MinIO service port
- containerPort: 9090 # MinIO console port
volumeMounts:
- name: minio-data
mountPath: /data
- name: minio-config
mountPath: /root/.minio
env:
- name: TZ
value: "Asia/Shanghai"
- name: MINIO_ACCESS_KEY
valueFrom:
secretKeyRef:
name: minio-secret
key: minio-root-user
- name: MINIO_SECRET_KEY
valueFrom:
secretKeyRef:
name: minio-secret
key: minio-root-password
command:
- minio
- server
- /data
- "--console-address"
- ":9090"
volumes:
- name: minio-data
persistentVolumeClaim:
claimName: minio-pvc
- name: minio-config
persistentVolumeClaim:
claimName: minio-config-pvc
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: minio-pvc
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 10Gi
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: minio-config-pvc
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 2Gi
---
apiVersion: v1
kind: Secret
metadata:
name: minio-secret
type: Opaque
data:
minio-root-user: cm9vdA== # Base64 encoded "root"
minio-root-password: b3BlbklNMTIz # Base64 encoded "openIM123"

@ -0,0 +1,13 @@
apiVersion: v1
kind: Service
metadata:
name: mongo-service
spec:
selector:
app: mongo
ports:
- name: mongodb-port
protocol: TCP
port: 37017
targetPort: 27017
type: ClusterIP

@ -0,0 +1,82 @@
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: mongo-statefulset
spec:
serviceName: "mongo"
replicas: 1
selector:
matchLabels:
app: mongo
template:
metadata:
labels:
app: mongo
spec:
containers:
- name: mongo
image: mongo:6.0.2
command:
[
"/bin/bash",
"-c",
"docker-entrypoint.sh mongod --wiredTigerCacheSizeGB 1 --auth & sleep 15; /scripts/mongo-init.sh; wait",
]
ports:
- containerPort: 27017
env:
- name: MONGO_INITDB_ROOT_USERNAME
valueFrom:
secretKeyRef:
name: mongo-secret
key: mongo_initdb_root_username
- name: MONGO_INITDB_ROOT_PASSWORD
valueFrom:
secretKeyRef:
name: mongo-secret
key: mongo_initdb_root_password
- name: MONGO_INITDB_DATABASE
valueFrom:
secretKeyRef:
name: mongo-secret
key: mongo_initdb_database
- name: MONGO_OPENIM_USERNAME
valueFrom:
secretKeyRef:
name: mongo-secret
key: mongo_openim_username
- name: MONGO_OPENIM_PASSWORD
valueFrom:
secretKeyRef:
name: mongo-secret
key: mongo_openim_password
volumeMounts:
- name: mongo-storage
mountPath: /data/db
- name: script-volume
mountPath: /scripts
# subPath: mongo-init.sh
volumes:
- name: script-volume
configMap:
name: openim-config
items:
- key: mongo-init.sh
path: mongo-init.sh
mode: 0755
- name: mongo-storage
persistentVolumeClaim:
claimName: mongo-pvc
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: mongo-pvc
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 5Gi

@ -0,0 +1,334 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: notification-config
data:
notification.yml: |
groupCreated:
isSendMsg: true
# Reliability level of the message sending.
# Set to 1 to send only when online, 2 for guaranteed delivery.
reliabilityLevel: 1
# This setting is effective only when 'isSendMsg' is true.
# It controls whether to count unread messages.
unreadCount: false
# Configuration for offline push notifications.
offlinePush:
# Enables or disables offline push notifications.
enable: false
# Title for the notification when a group is created.
title: create group title
# Description for the notification.
desc: create group desc
# Additional information for the notification.
ext: create group ext
groupInfoSet:
isSendMsg: false
reliabilityLevel: 1
unreadCount: false
offlinePush:
enable: false
title: groupInfoSet title
desc: groupInfoSet desc
ext: groupInfoSet ext
joinGroupApplication:
isSendMsg: false
reliabilityLevel: 1
unreadCount: false
offlinePush:
enable: false
title: joinGroupApplication title
desc: joinGroupApplication desc
ext: joinGroupApplication ext
memberQuit:
isSendMsg: true
reliabilityLevel: 1
unreadCount: false
offlinePush:
enable: false
title: memberQuit title
desc: memberQuit desc
ext: memberQuit ext
groupApplicationAccepted:
isSendMsg: false
reliabilityLevel: 1
unreadCount: false
offlinePush:
enable: false
title: groupApplicationAccepted title
desc: groupApplicationAccepted desc
ext: groupApplicationAccepted ext
groupApplicationRejected:
isSendMsg: false
reliabilityLevel: 1
unreadCount: false
offlinePush:
enable: false
title: groupApplicationRejected title
desc: groupApplicationRejected desc
ext: groupApplicationRejected ext
groupOwnerTransferred:
isSendMsg: true
reliabilityLevel: 1
unreadCount: false
offlinePush:
enable: false
title: groupOwnerTransferred title
desc: groupOwnerTransferred desc
ext: groupOwnerTransferred ext
memberKicked:
isSendMsg: true
reliabilityLevel: 1
unreadCount: false
offlinePush:
enable: false
title: memberKicked title
desc: memberKicked desc
ext: memberKicked ext
memberInvited:
isSendMsg: true
reliabilityLevel: 1
unreadCount: false
offlinePush:
enable: false
title: memberInvited title
desc: memberInvited desc
ext: memberInvited ext
memberEnter:
isSendMsg: true
reliabilityLevel: 1
unreadCount: false
offlinePush:
enable: false
title: memberEnter title
desc: memberEnter desc
ext: memberEnter ext
groupDismissed:
isSendMsg: true
reliabilityLevel: 1
unreadCount: false
offlinePush:
enable: false
title: groupDismissed title
desc: groupDismissed desc
ext: groupDismissed ext
groupMuted:
isSendMsg: true
reliabilityLevel: 1
unreadCount: false
offlinePush:
enable: false
title: groupMuted title
desc: groupMuted desc
ext: groupMuted ext
groupCancelMuted:
isSendMsg: true
reliabilityLevel: 1
unreadCount: false
offlinePush:
enable: false
title: groupCancelMuted title
desc: groupCancelMuted desc
ext: groupCancelMuted ext
defaultTips:
tips: group Cancel Muted
groupMemberMuted:
isSendMsg: true
reliabilityLevel: 1
unreadCount: false
offlinePush:
enable: false
title: groupMemberMuted title
desc: groupMemberMuted desc
ext: groupMemberMuted ext
groupMemberCancelMuted:
isSendMsg: true
reliabilityLevel: 1
unreadCount: false
offlinePush:
enable: false
title: groupMemberCancelMuted title
desc: groupMemberCancelMuted desc
ext: groupMemberCancelMuted ext
groupMemberInfoSet:
isSendMsg: false
reliabilityLevel: 1
unreadCount: false
offlinePush:
enable: false
title: groupMemberInfoSet title
desc: groupMemberInfoSet desc
ext: groupMemberInfoSet ext
groupInfoSetAnnouncement:
isSendMsg: true
reliabilityLevel: 1
unreadCount: false
offlinePush:
enable: false
title: groupInfoSetAnnouncement title
desc: groupInfoSetAnnouncement desc
ext: groupInfoSetAnnouncement ext
groupInfoSetName:
isSendMsg: true
reliabilityLevel: 1
unreadCount: false
offlinePush:
enable: false
title: groupInfoSetName title
desc: groupInfoSetName desc
ext: groupInfoSetName ext
#############################friend#################################
friendApplicationAdded:
isSendMsg: false
reliabilityLevel: 1
unreadCount: false
offlinePush:
enable: false
title: Somebody applies to add you as a friend
desc: Somebody applies to add you as a friend
ext: Somebody applies to add you as a friend
friendApplicationApproved:
isSendMsg: true
reliabilityLevel: 1
unreadCount: false
offlinePush:
enable: true
title: Someone applies to add your friend application
desc: Someone applies to add your friend application
ext: Someone applies to add your friend application
friendApplicationRejected:
isSendMsg: false
reliabilityLevel: 1
unreadCount: false
offlinePush:
enable: true
title: Someone rejected your friend application
desc: Someone rejected your friend application
ext: Someone rejected your friend application
friendAdded:
isSendMsg: false
reliabilityLevel: 1
unreadCount: false
offlinePush:
enable: true
title: We have become friends
desc: We have become friends
ext: We have become friends
friendDeleted:
isSendMsg: false
reliabilityLevel: 1
unreadCount: false
offlinePush:
enable: true
title: deleted a friend
desc: deleted a friend
ext: deleted a friend
friendRemarkSet:
isSendMsg: false
reliabilityLevel: 1
unreadCount: false
offlinePush:
enable: true
title: Your friend's profile has been changed
desc: Your friend's profile has been changed
ext: Your friend's profile has been changed
blackAdded:
isSendMsg: false
reliabilityLevel: 1
unreadCount: false
offlinePush:
enable: true
title: blocked a user
desc: blocked a user
ext: blocked a user
blackDeleted:
isSendMsg: false
reliabilityLevel: 1
unreadCount: false
offlinePush:
enable: true
title: Remove a blocked user
desc: Remove a blocked user
ext: Remove a blocked user
friendInfoUpdated:
isSendMsg: false
reliabilityLevel: 1
unreadCount: false
offlinePush:
enable: true
title: friend info updated
desc: friend info updated
ext: friend info updated
#####################user#########################
userInfoUpdated:
isSendMsg: false
reliabilityLevel: 1
unreadCount: false
offlinePush:
enable: true
title: userInfo updated
desc: userInfo updated
ext: userInfo updated
userStatusChanged:
isSendMsg: false
reliabilityLevel: 1
unreadCount: false
offlinePush:
enable: false
title: user status changed
desc: user status changed
ext: user status changed
#####################conversation#########################
conversationChanged:
isSendMsg: false
reliabilityLevel: 1
unreadCount: false
offlinePush:
enable: true
title: conversation changed
desc: conversation changed
ext: conversation changed
conversationSetPrivate:
isSendMsg: true
reliabilityLevel: 1
unreadCount: false
offlinePush:
enable: true
title: burn after reading
desc: burn after reading
ext: burn after reading

@ -0,0 +1,34 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: openim-api
spec:
replicas: 1
selector:
matchLabels:
app: openim-api
template:
metadata:
labels:
app: openim-api
spec:
containers:
- name: openim-api-container
image: op-api:v3.90
# imagePullPolicy: Never
env:
- name: CONFIG_PATH
value: "/config"
- name: DEPLOYMENT_TYPE
value: "kubernetes"
volumeMounts:
- name: openim-config
mountPath: "/config"
readOnly: true
ports:
- containerPort: 10002
- containerPort: 12002
volumes:
- name: openim-config
configMap:
name: openim-config

@ -0,0 +1,17 @@
apiVersion: v1
kind: Service
metadata:
name: openim-api-service
spec:
selector:
app: openim-api
ports:
- name: http-10302
protocol: TCP
port: 10002
targetPort: 10002
- name: prometheus-20113
protocol: TCP
port: 12002
targetPort: 12002
type: NodePort

File diff suppressed because it is too large Load Diff

@ -0,0 +1,30 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: openim-crontask
spec:
replicas: 1
selector:
matchLabels:
app: crontask
template:
metadata:
labels:
app: crontask
spec:
containers:
- name: crontask-container
image: op-crontask:v3.9
env:
- name: CONFIG_PATH
value: "/config"
- name: DEPLOYMENT_TYPE
value: "kubernetes"
volumeMounts:
- name: openim-config
mountPath: "/config"
readOnly: true
volumes:
- name: openim-config
configMap:
name: openim-config

@ -0,0 +1,33 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: openim-msggateway-server
spec:
replicas: 1
selector:
matchLabels:
app: openim-msggateway-server
template:
metadata:
labels:
app: openim-msggateway-server
spec:
containers:
- name: openim-msggateway-container
image: op-msggateway:v3.9
env:
- name: CONFIG_PATH
value: "/config"
- name: DEPLOYMENT_TYPE
value: "kubernetes"
volumeMounts:
- name: openim-config
mountPath: "/config"
readOnly: true
ports:
- containerPort: 10001
- containerPort: 12001
volumes:
- name: openim-config
configMap:
name: openim-config

@ -0,0 +1,17 @@
apiVersion: v1
kind: Service
metadata:
name: openim-msggateway-service
spec:
selector:
app: openim-msggateway-server
ports:
- name: http-10001
protocol: TCP
port: 10001
targetPort: 10001
- name: prometheus-12001
protocol: TCP
port: 12001
targetPort: 12001
type: NodePort

@ -0,0 +1,33 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: openim-msgtransfer-server
spec:
replicas: 1
selector:
matchLabels:
app: openim-msgtransfer-server
template:
metadata:
labels:
app: openim-msgtransfer-server
spec:
containers:
- name: openim-msgtransfer-container
image: op-msgtransfer:v3.9
env:
- name: CONFIG_PATH
value: "/config"
- name: DEPLOYMENT_TYPE
value: "kubernetes"
volumeMounts:
- name: openim-config
mountPath: "/config"
readOnly: true
ports:
# - containerPort: 15200
- containerPort: 12020
volumes:
- name: openim-config
configMap:
name: openim-config

@ -0,0 +1,14 @@
apiVersion: v1
kind: Service
metadata:
name: openim-msgtransfer-service
spec:
selector:
app: openim-msgtransfer-server
ports:
# TODO Need check port!!!
- name: prometheus-12020
protocol: TCP
port: 12020
targetPort: 12020
type: ClusterIP

@ -0,0 +1,40 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: openim-push-server
spec:
replicas: 1
selector:
matchLabels:
app: openim-push-server
template:
metadata:
labels:
app: openim-push-server
spec:
containers:
- name: openim-push-container
image: op-push:v3.9
env:
- name: CONFIG_PATH
value: "/config"
- name: DEPLOYMENT_TYPE
value: "kubernetes"
volumeMounts:
- name: openim-config
mountPath: "/config"
readOnly: true
- name: notification-config
mountPath: "/config/notification.yml"
subPath: notification.yml
readOnly: true
ports:
- containerPort: 10170
- containerPort: 12170
volumes:
- name: openim-config
configMap:
name: openim-config
- name: notification-config
configMap:
name: notification-config

@ -0,0 +1,17 @@
apiVersion: v1
kind: Service
metadata:
name: openim-push-service
spec:
selector:
app: openim-push-server
ports:
- name: http-10170
protocol: TCP
port: 10170
targetPort: 10170
- name: prometheus-12170
protocol: TCP
port: 12170
targetPort: 12170
type: ClusterIP

@ -0,0 +1,34 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: auth-rpc-server
spec:
replicas: 1
selector:
matchLabels:
app: auth-rpc-server
template:
metadata:
labels:
app: auth-rpc-server
spec:
containers:
- name: auth-rpc-server-container
image: op-auth:v3.9
imagePullPolicy: Never
env:
- name: DEPLOYMENT_TYPE
value: "kubernetes"
- name: CONFIG_PATH
value: "/config"
volumeMounts:
- name: openim-config
mountPath: "/config"
readOnly: true
ports:
- containerPort: 10200
- containerPort: 12200
volumes:
- name: openim-config
configMap:
name: openim-config

@ -0,0 +1,17 @@
apiVersion: v1
kind: Service
metadata:
name: auth-rpc-service
spec:
selector:
app: auth-rpc-server
ports:
- name: http-10200
protocol: TCP
port: 10200
targetPort: 10200
- name: prometheus-12200
protocol: TCP
port: 12200
targetPort: 12200
type: ClusterIP

@ -0,0 +1,41 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: conversation-rpc-server
spec:
replicas: 1
selector:
matchLabels:
app: conversation-rpc-server
template:
metadata:
labels:
app: conversation-rpc-server
spec:
containers:
- name: conversation-rpc-server-container
image: op-conversation:v3.9
imagePullPolicy: Never
env:
- name: DEPLOYMENT_TYPE
value: "kubernetes"
- name: CONFIG_PATH
value: "/config"
volumeMounts:
- name: openim-config
mountPath: "/config"
readOnly: true
- name: notification-config
mountPath: "/config/notification.yml"
subPath: notification.yml
readOnly: true
ports:
- containerPort: 10220
- containerPort: 12220
volumes:
- name: openim-config
configMap:
name: openim-config
- name: notification-config
configMap:
name: notification-config

@ -0,0 +1,17 @@
apiVersion: v1
kind: Service
metadata:
name: conversation-rpc-service
spec:
selector:
app: conversation-rpc-server
ports:
- name: http-10220
protocol: TCP
port: 10220
targetPort: 10220
- name: prometheus-12220
protocol: TCP
port: 12220
targetPort: 12220
type: ClusterIP

@ -0,0 +1,46 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: friend-rpc-server
spec:
replicas: 1
selector:
matchLabels:
app: friend-rpc-server
template:
metadata:
labels:
app: friend-rpc-server
spec:
containers:
- name: friend-rpc-server-container
image: op-friend:v3.9
# imagePullPolicy: Never
env:
- name: DEPLOYMENT_TYPE
value: "kubernetes"
- name: CONFIG_PATH
value: "/config"
- name: REDIS_PASSWORD
valueFrom:
secretKeyRef:
name: redis-secret
key: redis-password
volumeMounts:
- name: openim-config
mountPath: "/config"
readOnly: true
- name: notification-config
mountPath: "/config/notification.yml"
subPath: notification.yml
readOnly: true
ports:
- containerPort: 10240
- containerPort: 12240
volumes:
- name: openim-config
configMap:
name: openim-config
- name: notification-config
configMap:
name: notification-config

@ -0,0 +1,17 @@
apiVersion: v1
kind: Service
metadata:
name: friend-rpc-service
spec:
selector:
app: friend-rpc-server
ports:
- name: http-10240
protocol: TCP
port: 10240
targetPort: 10240
- name: prometheus-12240
protocol: TCP
port: 12240
targetPort: 12240
type: ClusterIP

@ -0,0 +1,41 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: group-rpc-server
spec:
replicas: 1
selector:
matchLabels:
app: group-rpc-server
template:
metadata:
labels:
app: group-rpc-server
spec:
containers:
- name: group-rpc-server-container
image: op-group:v3.9
# imagePullPolicy: Never
env:
- name: DEPLOYMENT_TYPE
value: "kubernetes"
- name: CONFIG_PATH
value: "/config"
volumeMounts:
- name: openim-config
mountPath: "/config"
readOnly: true
- name: notification-config
mountPath: "/config/notification.yml"
subPath: notification.yml
readOnly: true
ports:
- containerPort: 10260
- containerPort: 12260
volumes:
- name: openim-config
configMap:
name: openim-config
- name: notification-config
configMap:
name: notification-config

@ -0,0 +1,17 @@
apiVersion: v1
kind: Service
metadata:
name: group-rpc-service
spec:
selector:
app: group-rpc-server
ports:
- name: http-10260
protocol: TCP
port: 10260
targetPort: 10260
- name: prometheus-12260
protocol: TCP
port: 12260
targetPort: 12260
type: ClusterIP

@ -0,0 +1,41 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: msg-rpc-server
spec:
replicas: 1
selector:
matchLabels:
app: msg-rpc-server
template:
metadata:
labels:
app: msg-rpc-server
spec:
containers:
- name: msg-rpc-server-container
image: op-msg:v3.9
# imagePullPolicy: Never
env:
- name: DEPLOYMENT_TYPE
value: "kubernetes"
- name: CONFIG_PATH
value: "/config"
volumeMounts:
- name: openim-config
mountPath: "/config"
readOnly: true
- name: notification-config
mountPath: "/config/notification.yml"
subPath: notification.yml
readOnly: true
ports:
- containerPort: 10280
- containerPort: 12280
volumes:
- name: openim-config
configMap:
name: openim-config
- name: notification-config
configMap:
name: notification-config

@ -0,0 +1,17 @@
apiVersion: v1
kind: Service
metadata:
name: msg-rpc-service
spec:
selector:
app: msg-rpc-server
ports:
- name: http-10280
protocol: TCP
port: 10280
targetPort: 10280
- name: prometheus-12280
protocol: TCP
port: 12280
targetPort: 12280
type: ClusterIP

@ -0,0 +1,51 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: third-rpc-server
spec:
replicas: 1
selector:
matchLabels:
app: third-rpc-server
template:
metadata:
labels:
app: third-rpc-server
spec:
containers:
- name: third-rpc-server-container
image: op-third:v3.9
# imagePullPolicy: Never
env:
- name: DEPLOYMENT_TYPE
value: "kubernetes"
- name: CONFIG_PATH
value: "/config"
- name: MINIO_ACCESS_KEY
valueFrom:
secretKeyRef:
name: minio-secret
key: minio-root-user
- name: MINIO_SECRET_KEY
valueFrom:
secretKeyRef:
name: minio-secret
key: minio-root-password
volumeMounts:
- name: openim-config
mountPath: "/config"
readOnly: true
- name: notification-config
mountPath: "/config/notification.yml"
subPath: notification.yml
readOnly: true
ports:
- containerPort: 10300
- containerPort: 12300
volumes:
- name: openim-config
configMap:
name: openim-config
- name: notification-config
configMap:
name: notification-config

@ -0,0 +1,17 @@
apiVersion: v1
kind: Service
metadata:
name: third-rpc-service
spec:
selector:
app: third-rpc-server
ports:
- name: http-10300
protocol: TCP
port: 10300
targetPort: 10300
- name: prometheus-12300
protocol: TCP
port: 12300
targetPort: 12300
type: ClusterIP

@ -0,0 +1,41 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: user-rpc-server
spec:
replicas: 1
selector:
matchLabels:
app: user-rpc-server
template:
metadata:
labels:
app: user-rpc-server
spec:
containers:
- name: user-rpc-server-container
image: op-user:v3.9
# imagePullPolicy: Never
env:
- name: DEPLOYMENT_TYPE
value: "kubernetes"
- name: CONFIG_PATH
value: "/config"
volumeMounts:
- name: openim-config
mountPath: "/config"
readOnly: true
- name: notification-config
mountPath: "/config/notification.yml"
subPath: notification.yml
readOnly: true
ports:
- containerPort: 10320
- containerPort: 12320
volumes:
- name: openim-config
configMap:
name: openim-config
- name: notification-config
configMap:
name: notification-config

@ -0,0 +1,17 @@
apiVersion: v1
kind: Service
metadata:
name: user-rpc-service
spec:
selector:
app: user-rpc-server
ports:
- name: http-10320
protocol: TCP
port: 10320
targetPort: 10320
- name: prometheus-12320
protocol: TCP
port: 12320
targetPort: 12320
type: ClusterIP

@ -0,0 +1,112 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: prometheus-config
data:
prometheus.yml: |
# my global config
global:
scrape_interval: 15s # Set the scrape interval to every 15 seconds. Default is every 1 minute.
evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute.
# scrape_timeout is set to the global default (10s).
# Alertmanager configuration
alerting:
alertmanagers:
- static_configs:
- targets: [internal_ip:19093]
# Load rules once and periodically evaluate them according to the global evaluation_interval.
rule_files:
- instance-down-rules.yml
# - first_rules.yml
# - second_rules.yml
# A scrape configuration containing exactly one endpoint to scrape:
# Here it's Prometheus itself.
scrape_configs:
# The job name is added as a label "job=job_name" to any timeseries scraped from this config.
# Monitored information captured by prometheus
# prometheus fetches application services
- job_name: node_exporter
static_configs:
- targets: [internal_ip:20500]
- job_name: openimserver-openim-api
static_configs:
- targets: [internal_ip:12002]
labels:
namespace: default
- job_name: openimserver-openim-msggateway
static_configs:
- targets: [internal_ip:12140]
# - targets: [ internal_ip:12140, internal_ip:12141, internal_ip:12142, internal_ip:12143, internal_ip:12144, internal_ip:12145, internal_ip:12146, internal_ip:12147, internal_ip:12148, internal_ip:12149, internal_ip:12150, internal_ip:12151, internal_ip:12152, internal_ip:12153, internal_ip:12154, internal_ip:12155 ]
labels:
namespace: default
- job_name: openimserver-openim-msgtransfer
static_configs:
- targets:
[
internal_ip:12020,
internal_ip:12021,
internal_ip:12022,
internal_ip:12023,
internal_ip:12024,
internal_ip:12025,
internal_ip:12026,
internal_ip:12027,
]
# - targets: [ internal_ip:12020, internal_ip:12021, internal_ip:12022, internal_ip:12023, internal_ip:12024, internal_ip:12025, internal_ip:12026, internal_ip:12027, internal_ip:12028, internal_ip:12029, internal_ip:12030, internal_ip:12031, internal_ip:12032, internal_ip:12033, internal_ip:12034, internal_ip:12035 ]
labels:
namespace: default
- job_name: openimserver-openim-push
static_configs:
- targets:
[
internal_ip:12170,
internal_ip:12171,
internal_ip:12172,
internal_ip:12173,
internal_ip:12174,
internal_ip:12175,
internal_ip:12176,
internal_ip:12177,
]
# - targets: [ internal_ip:12170, internal_ip:12171, internal_ip:12172, internal_ip:12173, internal_ip:12174, internal_ip:12175, internal_ip:12176, internal_ip:12177, internal_ip:12178, internal_ip:12179, internal_ip:12180, internal_ip:12182, internal_ip:12183, internal_ip:12184, internal_ip:12185, internal_ip:12186 ]
labels:
namespace: default
- job_name: openimserver-openim-rpc-auth
static_configs:
- targets: [internal_ip:12200]
labels:
namespace: default
- job_name: openimserver-openim-rpc-conversation
static_configs:
- targets: [internal_ip:12220]
labels:
namespace: default
- job_name: openimserver-openim-rpc-friend
static_configs:
- targets: [internal_ip:12240]
labels:
namespace: default
- job_name: openimserver-openim-rpc-group
static_configs:
- targets: [internal_ip:12260]
labels:
namespace: default
- job_name: openimserver-openim-rpc-msg
static_configs:
- targets: [internal_ip:12280]
labels:
namespace: default
- job_name: openimserver-openim-rpc-third
static_configs:
- targets: [internal_ip:12300]
labels:
namespace: default
- job_name: openimserver-openim-rpc-user
static_configs:
- targets: [internal_ip:12320]
labels:
namespace: default

@ -0,0 +1,15 @@
apiVersion: v1
kind: Service
metadata:
name: redis-service
labels:
app: redis
spec:
type: ClusterIP
selector:
app: redis
ports:
- name: redis-port
protocol: TCP
port: 16379
targetPort: 6379

@ -0,0 +1,66 @@
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: redis-statefulset
spec:
serviceName: "redis"
replicas: 1
selector:
matchLabels:
app: redis
template:
metadata:
labels:
app: redis
spec:
containers:
- name: redis
image: redis:7.0.0
ports:
- containerPort: 6379
env:
- name: TZ
value: "Asia/Shanghai"
- name: REDIS_PASSWORD
valueFrom:
secretKeyRef:
name: redis-secret
key: redis-password
volumeMounts:
- name: redis-data
mountPath: /data
# - name: redis-config-volume
# mountPath: /usr/local/redis/config/redis.conf
# subPath: redis.conf
command:
[
"/bin/sh",
"-c",
'redis-server --requirepass "$REDIS_PASSWORD" --appendonly yes',
]
volumes:
- name: redis-config-volume
configMap:
name: openim-config
- name: redis-data
persistentVolumeClaim:
claimName: redis-pvc
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: redis-pvc
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 5Gi
---
apiVersion: v1
kind: Secret
metadata:
name: redis-secret
type: Opaque
data:
redis-password: b3BlbklNMTIz # "openIM123" in base64
Loading…
Cancel
Save