This model is not much different from traditional non-Kubernetes deployments. As shown in the picture below, Nacos or Zookeeper is still used as the registry, but Kubernetes is used as the underlying platform for application lifecycle scheduling.
In Kubernetes mode, we recommend using dubboctl
to quickly install components like Nacos, dubbo-control-plane, prometheus, etc.:
$ dubboctl install --profile=demo
We still take the project in Quick Start as an example to demonstrate the specific steps for packaging and deploying the application.
First, clone the sample project locally:
$ git clone -b main --depth 1 https://github.com/apache/dubbo-samples
Switch to the example directory:
$ cd dubbo-samples/11-quickstart
$ dubboctl build
# Specifically push to docker repository
$ dubboctl deploy
Here are the generated complete Kubernetes manifests:
Run the following command to deploy the application to the Kubernetes cluster:
$ kubectl apply -f xxx.yml
If you have previously installed dubbo-control-plane using dubboctl
, you can check the service deployment status as follows:
$ kubectl port-forward
Access http://xxx
to view the service deployment details.
As shown in the architecture diagram above, we still use Nacos as the registry. Therefore, similar to traditional Linux deployment models, the timing of publishing instances to the registry and removing instances from the registry is key to achieving graceful online/offline:
prestop
to ensure instance registration information is removed from the registry first, before proceeding to the process destruction phase.Example configuration for gracefully offline removing instances:
preStop:
exec:
command: ["/bin/sh","-c","curl /offline; sleep 10"]