Skip to main content

k8s Deployment

OpenIM Application Containerization Deployment Guide

OpenIM supports various cluster deployment methods, including but not limited to helm, sealos, and kustomize.

Several contributors and previous official versions have provided some reference solutions:

Dependency Check

Kubernetes: >= 1.16.0-0
Helm: >= 3.0

Minimum Configuration

The recommended minimum configuration for a production environment is as follows:

CPU: 4
Memory: 8G
Disk: 100G

Configuration File Generation

We have automated all the files, making generating configuration files for OpenIM optional. However, if you wish to customize the configuration, you can follow these steps:

# Or use the script:
# ./scripts/

At this point, the configuration file will be generated under deployments/openim/config, and you can modify it as needed.

Installing Helm

Helm simplifies the deployment and management of Kubernetes applications by offering version control and release management through packaging.

Using script:

$ curl | bash

Adding repository:

$ helm repo add brigade

OpenIM Image Strategy

The automated provision includes aliyun, ghcr, docker hub: Image documentation

Local testing build method:

$ make image

This command helps to quickly build the required images locally. For detailed building strategies, please refer to Build Documentation.


Browse our Helm-Charts repository and read carefully: Helm-Charts Repository

Using the helm charts repository, you can ignore the following configuration, but if you only want to use the server and expand on it, you can continue:

Using Helmfile:

GO111MODULE=on go get
export MYSQL_ADDRESS=im-mysql
export MYSQL_PORT=3306
export MONGO_ADDRESS=im-mongo
export MONGO_PORT=27017
export REDIS_ADDRESS=im-redis-master
export REDIS_PORT=6379
export KAFKA_ADDRESS=im-kafka
export KAFKA_PORT=9092
export MINIO_ENDPOINT="http://im-minio:9000"

mkdir ./charts/generated-configs
../scripts/ ../scripts/install/ ./templates/openim.yaml > ./charts/generated-configs/config.yaml
cp ../config/notification.yaml ./charts/generated-configs/notification.yaml

Cluster Setup Reference

If you already have a kubernetes cluster, or if you want to build a kubernetes cluster from scratch, you can skip this step.

For a quick start, I use sealos to quickly establish a cluster, with sealos also being a wrapper for kubeadm at its core:

``bash$ SEALOS_VERSION=curl -s | grep -oE '"tag_name": ""+"' | head -n1 | cut -d'"' -f4` && \ curl -sfL${SEALOS_VERSION}/scripts/ | sh -s ${SEALOS_VERSION} labring/sealos

**Supported versions:**

+ docker: `labring/kubernetes-docker`:(v1.24.0~v1.27.0)
+ containerd: `labring/kubernetes`:(v1.24.0~v1.27.0)

#### Cluster Installation:

The details of the cluster are as follows:

| Hostname | IP Address | System Information |
| --------- | ---------- | ------------------------------------------------------------ |
| master01 | | `Linux VM-0-9-

ubuntu 5.15.0-76-generic #83-Ubuntu SMP Thu Jun 15 19:16:32 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux` |
| node01 | | Similar to master01 |
| node02 | | Similar to master01 |

```bash$ export CLUSTER_USERNAME=ubuntu
$ export CLUSTER_PASSWORD=123456
$ sudo sealos run labring/kubernetes:v1.25.0 labring/helm:v3.8.2 labring/calico:v3.24.1 \
--masters \
--nodes, \

Note Uninstall method: Uninstalling with kubeadm does not delete etcd and cni related configurations. You need to manually clear them or use sealos for uninstallation.

$ sealos reset

If you are local, you can also test with Kind and Minikube, for example using Kind:

$ kind create cluster