A Spoon-Fed Tutorial (Bonus Edition) — Deploying Dify on K8s

Background

A while back, OceanBase teamed up with Dify[1] to complete MySQL compatibility in the v1.10.1 release. In this same version, Dify also began experimenting with using an all-in-one database to address the scaling complexity brought by a multi-component architecture, and chose OceanBase seekdb[2] as its first practice target. For details, see: “Dify x OceanBase seekdb User Guide”.

In that article, we already covered how to configure seekdb as Dify’s metadata database / vector database, and how to build AI applications with Dify.

Recently, we’ve noticed another trend: more and more enterprises are choosing to deploy Dify on K8s. Whether for high availability, elastic scaling, or integration with the enterprise’s internal DevOps system, K8s has become the preferred platform for taking Dify into production.

A Spoon-Fed Tutorial (Bonus Edition) — Deploying Dify on K8s

And across technical forums and chat groups like v2ex and linux.do, you can always find questions about “how to deploy Dify on K8s.”

A Spoon-Fed Tutorial (Bonus Edition) — Deploying Dify on K8s

So this time, we’ve put together another bonus installment of “Dify x OceanBase seekdb” to walk you through how to deploy and use Dify on K8s.

Welcome to follow the OceanBase community’s official account “Lao Ji’s Tech Talk,” where we keep publishing technical content related to #databases, #AI, and #OceanBase!

Deploying and Using Dify on K8s

This tutorial walks you through using Helm (the K8s package manager) to deploy, in three commands, a Dify instance on K8s configured with seekdb as both the vector database and the metadata database.

Note:

If you haven’t installed helm / kubectl yet, install them first. The installation steps may differ slightly across operating systems.

  1. You first need a K8s cluster you can connect to and test against. Then, in the kubeconfig file (usually at ~/.kube/config), you should have already configured how to connect to and operate this K8s cluster.
1
2
3
Desktop-of-Zlatan .kube % pwd && ls
/Users/liboyang/.kube
cache config
  1. With the first command, add a Helm repository that holds the chart for the Dify application (a Helm Chart is the packaging format for K8s applications, containing the templates and configuration needed for deployment).
1
helm repo add dify https://chris-sun-star.github.io/dify-helm
  1. With the second command, update the local Helm repository index to ensure you get the latest chart list and version information.
1
helm repo update
  1. With the third command, install the Dify application into the K8s cluster. This command creates resources in K8s according to the templates defined in the chart and deploys the Dify application.
1
helm install dify -n dify --create-namespace dify/dify

Note:

The chart’s default configuration in this Helm repository sets the Service type to NodePort.

You can also create a LoadBalancer-type Service by specifying --set service.type=LoadBalancer in the helm install command above.

  1. This outputs NOTES. Copy and run the commands in the NOTES, and you’ll see the web link you can use to access the Dify service in a browser (you’ll need to wait until all Pods have started).
1
2
3
4
5
6
7
8
9
10
NAME: dify
LAST DEPLOYED: Thu Dec 25 11:33:45 2025
NAMESPACE: dify
STATUS: deployed
REVISION: 1
NOTES:
1. Get the application URL by running these commands:
export NODE_PORT=$(kubectl get --namespace dify -o jsonpath="{.spec.ports[0].nodePort}" services dify)
export NODE_IP=$(kubectl get nodes --namespace dify -o jsonpath="{.items[0].status.addresses[0].address}")
echo http://$NODE_IP:$NODE_PORT
  1. You can use the kubectl command to list all running Pods in the namespace named dify.
1
kubectl get pods -n dify
  1. You may need to wait a few minutes here until all Pods are in the Running state. Any Pod with an abnormal STATUS will restart automatically until it succeeds.
1
2
3
4
5
6
7
8
9
10
11
12
13
liboyang@Desktop-of-Zlatan .kube % kubectl get pods -n dify
NAME READY STATUS RESTARTS AGE
dify-api-6f7647c56f-wqp8g 0/1 Running 4 (70s ago) 7m46s
dify-plugin-daemon-74894f6f58-xlpsp 0/1 CrashLoopBackOff 6 (96s ago) 7m46s
dify-proxy-55cf79f668-4srmb 1/1 Running 0 7m46s
dify-redis-master-0 1/1 Running 0 7m46s
dify-redis-replicas-0 1/1 Running 0 7m46s
dify-redis-replicas-1 1/1 Running 0 7m6s
dify-redis-replicas-2 1/1 Running 0 6m40s
dify-sandbox-56f4df9558-zdvtf 1/1 Running 0 7m46s
dify-seekdb-0 1/1 Running 0 7m46s
dify-web-849c44cf64-csjwb 1/1 Running 0 7m46s
dify-worker-5ddfcd95d7-22fjp 0/1 Init:0/1 0 7m46s
  1. If a Pod responds slowly and restarts many times, the interval between restarts will increase each time; you can manually restart the abnormal Pod.
1
kubectl delete pod -n dify dify-plugin-daemon-74894f6f58-xlpsp
  1. The expected final result should be:
1
2
3
4
5
6
7
8
9
10
11
12
13
liboyang@Desktop-of-Zlatan .kube % kubectl get pods -n dify
NAME READY STATUS RESTARTS AGE
dify-api-6f7647c56f-ndmnb 1/1 Running 1 (5h15m ago) 5h17m
dify-plugin-daemon-74894f6f58-2rgf4 1/1 Running 0 5h18m
dify-proxy-55cf79f668-4srmb 1/1 Running 0 5h29m
dify-redis-master-0 1/1 Running 0 5h29m
dify-redis-replicas-0 1/1 Running 0 5h29m
dify-redis-replicas-1 1/1 Running 0 5h29m
dify-redis-replicas-2 1/1 Running 0 5h28m
dify-sandbox-56f4df9558-zdvtf 1/1 Running 0 5h29m
dify-seekdb-0 1/1 Running 0 5h29m
dify-web-849c44cf64-csjwb 1/1 Running 0 5h29m
dify-worker-5ddfcd95d7-22fjp 1/1 Running 0 5h29m
  1. Finally, copy and run the commands in the NOTES to get the web link, and you can start building applications with Dify on K8s~
1
2
3
export NODE_PORT=$(kubectl get --namespace dify -o jsonpath="{.spec.ports[0].nodePort}" services dify)
export NODE_IP=$(kubectl get nodes --namespace dify -o jsonpath="{.items[0].status.addresses[0].address}")
echo http://$NODE_IP:$NODE_PORT
A Spoon-Fed Tutorial (Bonus Edition) — Deploying Dify on K8s

Building AI Applications with Dify

As for how to build AI applications with Dify next, that’s not the focus of this article. You can refer to several articles previously published on the OceanBase community’s official account:

Note:

  • In the Dify deployed on K8s above, seekdb is the vector database and metadata database that Dify depends on~
  • PowerMem[3] is an AI memory system that developers can quickly integrate into their projects. Feel free to give it a try~
A Spoon-Fed Tutorial (Bonus Edition) — Deploying Dify on K8s

References

[1] Dify: https://github.com/langgenius/dify

[2] seekdb: https://github.com/oceanbase/seekdb

[3] PowerMem: https://github.com/oceanbase/powermem/tree/main