Dubbo Microservice architecture in Kubernetes¶
Dubbo Microservice architecture in Kubernetes involves deploying the Alibaba Dubbo RPC framework within a Kubernetes cluster, utilizing Zookeeper as a registry, and integrating with a CI/CD pipeline (Jenkins) to automate the build, deployment, and scaling of containerized services.^[400-devops-06-kubernetes-k8s-paas-05k8scicd.md]
Architecture Overview¶
In this architecture, Dubbo services are deployed as stateless applications inside the Kubernetes cluster, while Zookeeper (the registry) operates as a stateful service outside of the cluster (or on specific nodes).^[400-devops-06-kubernetes-k8s-paas-05k8scicd.md] External traffic is routed via Ingress to the Dubbo consumer service (web frontend), which then communicates with the backend Dubbo provider services.^[400-devops-06-kubernetes-k8s-paas-05k8scicd.md]
Key infrastructure components include:
- Zookeeper: Acts as the service registration and configuration center.^[400-devops-06-kubernetes-k8s-paas-05k8scicd.md]
- Jenkins: Automates the process of pulling code from Git, compiling it with Maven, and building Docker images.^[400-devops-06-kubernetes-k8s-paas-05k8scicd.md]
- Harbor: Functions as the private Docker image registry where built images are stored.^[400-devops-06-kubernetes-k8s-paas-05k8scicd.md]
- Kubernetes: Orchestrates the microservice containers, manages scaling, and exposes services via Ingress.^[400-devops-06-kubernetes-k8s-paas-05k8scicd.md]
Service Delivery Workflow¶
The continuous delivery workflow for Dubbo services involves a standardized Jenkins pipeline consisting of four main stages^[400-devops-06-kubernetes-k8s-paas-05k8scicd.md]:
- Pull: Retrieve source code from the Git repository.
- Build: Compile the project using Maven (e.g.,
mvn clean package). - Package: Move the compiled JAR files into a specific
project_dirdirectory. - Image: Build a Docker image containing the application and push it to the Harbor registry^[400-devops-06-kubernetes-k8s-paas-05k8scicd.md].
Once the image is pushed to Harbor, it is deployed to Kubernetes using resource manifests (Deployment, Service, Ingress).^[400-devops-06-kubernetes-k8s-paas-05k8scicd.md]
Core Components¶
Base Images (JRE8)¶
Dubbo services rely on a custom base image (jre8:8u112) which includes the Java Runtime Environment, a specific timezone configuration, and a Java Agent (JMX) for monitoring collection^[400-devops-06-kubernetes-k8s-paas-05k8scicd.md]. This base image ensures consistency across all deployed microservices.
Dubbo Monitor¶
To visualize the registry and manage services, Dubbo Monitor is deployed.^[400-devops-06-kubernetes-k8s-paas-05k8scicd.md] This provides a graphical interface to view which services have registered with Zookeeper, replacing the need to manually query Zookeeper via the command line.^[400-devops-06-kubernetes-k8s-paas-05k8scicd.md]
Operations and Maintenance¶
Scaling¶
One of the primary advantages of this architecture is the ability to perform "seamless" scaling.^[400-devops-06-kubernetes-k8s-paas-05k8scicd.md] By adjusting the replicas count in the Kubernetes Deployment, operators can handle traffic spikes (scaling out) or save resources during low demand (scaling in).^[400-devops-06-kubernetes-k8s-paas-05k8scicd.md]
Continuous Updates¶
When code is updated and pushed to Git, the Jenkins pipeline is triggered with a new version tag.^[400-devops-06-kubernetes-k8s-paas-05k8scicd.md] After building and pushing the new image, the Kubernetes Deployment is updated to point to the new image tag, effectively rolling out the update.^[400-devops-06-kubernetes-k8s-paas-05k8scicd.md]
Disaster Recovery¶
The architecture supports high availability through redundancy. If a node fails, Kubernetes self-heals by rescheduling pods to other healthy nodes.^[400-devops-06-kubernetes-k8s-paas-05k8scicd.md] To facilitate this recovery, load balancers (such as Nginx or Traefik) must be configured to remove failed nodes from their upstream configurations to prevent connection errors.^[400-devops-06-kubernetes-k8s-paas-05k8scicd.md]
Related Concepts¶
Sources¶
- 400-devops-06-kubernetes-k8s-paas-05k8scicd.md