KubeGems is a versatile open source PaaS cloud management platform built around Kubernetes through self-developed and integrated cloud-native projects. After nearly a year of continuous iteration within us, the core functions of KubeGems have initially been unified management in multi-cloud and multi-tenant scenarios. And through the plug-in way, in the user interface flexible control of the monitoring system, log system, microservice governance and many other plug-ins enabled and off.
Nacos is an open source service platform for handling application configuration release management and service registration management in the microservice scenario. It mainly provides the following features:
Service discovery and service health monitoring
DNS and RPC-based service discovery. After a service provider registers a service using a native SDK, OpenAPI, or a standalone Agent TODO, service consumers can use DNS TODO or the HTTP & API to find and discover services.
Dynamically configure the service
Dynamic configuration services allow you to centralize, externalize, and dynamically manage application and service configurations for all environments.
Dynamic DNS service
Dynamic DNS services support weight routing, making it easier for you to implement middle-tier load balancing, more flexible routing policies, traffic control, and simple DNS resolution services for data center intranets.
Services and their metadata management
Nacos manages all services and metadata in the data center from the perspective of a microservices platform building, including the description of the management service, lifecycle, static dependency analysis of the service, the health status of the service, the traffic management of the service, routing and security policies, the SLA of the service, and the most important metrics statistics.
KubeGems has enabled support for Nacos Configuration Center since v1.21 and leverages the built-in Plugins CRD to enable a quick startup of Nacos.
The Nacos installation source in KubeGems comes from the official community to provide https://github.com/nacos-group/nacos-k8s and manages the deployed versions in plugin crd. Students who have used Nacos may know that its internal data model mainly revolves around dataid, group and namespace. Since KubeGems is designed to be a platform that supports multi-tenancy, internal namespaces are distinguished by tenant + project when applying the nacos data model.
KubeGems Enables Nacos to operate with the privileges of a system administrator. The administrator enters the “Plugin Management” in the management background and clicks the “Enable” button to open Nacos.
Until the following status appears, it means that the plug-in is running normally
At this point, we can start using the Nacos service in the tenant’s environment
The configuration of the Nacos plugin is stored in the nacos namespace in the form of a CRD, and we can personalize the plugin by commanding kubectl edit plugin nacos -n nacos.
Tip: KubeGems’ plugin CRD is powered by https://github.com/kubegems/bundle-controller, and we can also use bundle-controller directly to manage plugins in non-kubegems clusters.
Nacos clusters are supported by the community for deployment, kubegems defaults to the global running mode of nacos set to “cluster”, if you need to expand into multiple clusters, just modify the replicaCount number of copies to 3.
The Nacos plugin runs inside Kubernetes by default, and if you need to access Nacos outside the cluster, you need to implement it with a gateway. Administrators can create an ingress based on the default gateway in the background to proxy nacos APIs. The process is as follows:
Step 1: Go to the Routing Function page and select the nacos namespace
Step 2: Create and submit a routing rule for the proxy for nacos
Step 3: Get the access address
Tip: Nacos 2.0 version compared to 1.X adds a new gRPC communication mode, so it needs to add 2 ports. The new port is automatically generated on the basis of the configured primary port (server.port) with a certain offset
To enter the “Application Configuration” in the application environment, you can click “Get Access Information” in the upper right corner to view the configuration information required by the nacos sdk in the current environment
Click “Create Configuration Item” to create a configuration history and rollback
We use nacos-sdk-go/v1 to do a simple authentication
Here’s what it looks like
This article focuses on the basic management features of enabling and using the Nacos plugin as the configuration center for your application in KubeGems. Nacos is a great application configuration management platform, and the KubeGems team will continue to focus on this project and provide more user-friendly support in Kubernetes clusters.
▲ Click the card above to pay attention to the K8s technology circle and master the cutting-edge cloud-native technology