nacos

by KubeSphere

Helm chartv0.1.1App 1.4.1Verified publisher

A Helm chart for Nacos

About this chart

Forked from https://github.com/nacos-group/nacos-k8s/tree/master/helm.

Nacos Helm Chart

Nacos is committed to help you discover, configure, and manage your microservices. It provides a set of simple and useful features enabling you to realize dynamic service discovery, service configuration, service metadata and traffic management.

Introduction

This project is based on the Helm Chart packaged by nacos-k8s.

Prerequisites

  • Kubernetes 1.10+
  • Helm v3
  • PV provisioner support in the underlying infrastructure

Installing the Chart

To install the chart with release name:

$ helm install `release name` ./nacos

The command deploys Nacos on the Kubernetes cluster in the default configuration. It will run without a mysql chart and persistent volume. The configuration section lists the parameters that can be configured during installation.

Service & Configuration Management

Service registration

curl -X POST 'http://$NODE_IP:$NODE_PORT/nacos/v1/ns/instance?serviceName=nacos.naming.serviceName&ip=20.18.7.10&port=8080'

Service discovery

curl -X GET 'http://$NODE_IP:$NODE_PORT/nacos/v1/ns/instance/list?serviceName=nacos.naming.serviceName'

Publish config

curl -X POST "http://$NODE_IP:$NODE_PORT/nacos/v1/cs/configs?dataId=nacos.cfg.dataId&group=test&content=helloWorld"

Get config

curl -X GET "http://$NODE_IP:$NODE_PORT/nacos/v1/cs/configs?dataId=nacos.cfg.dataId&group=test"

Tip: List all releases using helm list

Uninstalling the Chart

To uninstall/delete release name:

$ helm uninstall `release name`

The command removes all the Kubernetes components associated with the chart and deletes the release.

Configuration

The following table lists the configurable parameters of the Skywalking chart and their default values.

ParameterDescriptionDefault
global.modeRun Mode (quickstart, standalone, cluster; quickstart: without mysql and pv)quickstart
global.storageClass.provisionerGlobal storage class provisionernil
mysql.resourcesThe [resources] to allocate for mysql container{}
mysql.nodeSelectorMysql labels for mysql{}
mysql.affinityMysql affinity policy{}
mysql.tolerationsMysql tolerations{}
mysql.image.pullPolicyMysql container image pull policyIfNotPresent
mysql.annotationsMysql annotations{}
mysql.image.repositoryMysql container image namenacos/nacos-mysql
mysql.image.tagMysql container image tag5.7
mysql.rootPasswordMysql root passwordroot
mysql.databaseNacos database namenacos_devtest
mysql.userNacos database usernacos
mysql.passwordNacos database passwordnacos
mysql.classParametersMysql storageclass parameters{}
mysql.persistence.enabledEnable the data persistence or notfalse
mysql.persistence.existingClaimUse the existing PVC which must be created manually before bound, and specify the subPath if the PVC is shared with other componentsmysql-data
mysql.persistence.claim.nameMysql pvc namemysql-data
mysql.persistence.claim.spec.accessModesMysql pvc access modeReadWriteOnce
mysql.persistence.claim.spec.resources.requests.storageMysql pvc requests storage5G
mysql.persistence.claim.spec.storageClassNameMysql pvc storage class namesc-mysql
mysql.service.portMysql service port3306
resourcesThe [resources] to allocate for nacos container{}
nodeSelectorNacos labels for pod assignment{}
affinityNacos affinity policy{}
tolerationsNacos tolerations{}
resources.requests.cpunacos requests cpu resource500m
resources.requests.memorynacos requests memory resource2G
replicaCountNumber of desired nacos pods, the number should be 1 as run quickstart or standalone mode1
image.repositoryNacos container image namenacos/nacos-server
image.tagNacos container image tag0.9.0
image.pullPolicyNacos container image pull policyIfNotPresent
health.enabledEnable health check or notfalse
env.preferhostmodeEnable Nacos cluster node domain name supporthostname
env.serverPortNacos port8848
persistence.enabledEnable the nacos data persistence or notfalse
persistence.storageClassNameNacos storage class namesc-nacos
persistence.classParametersNacos storageclass parameters{}
persistence.data.accessModesNacos data pvc access modeReadWriteOnce
persistence.data.storageClassNameNacos data pvc storage class namemanual
persistence.data.resources.requests.storageNacos data pvc requests storage5G
persistence.plugin.accessModesNacos plugin pvc access mode (Available as cluster mode)ReadWriteOnce
persistence.plugin.storageClassNameNacos plugin pvc storage class name (Available as cluster mode)manual
persistence.plugin.resources.requests.storageNacos plugin pvc requests storage (Available as cluster mode)5G
persistence.log.accessModesNacos log pvc access mode (Available as cluster mode)ReadWriteOnce
persistence.log.storageClassNameNacos log pvc storage class name (Available as cluster mode)manual
persistence.log.resources.requests.storageNacos log pvc requests storage (Available as cluster mode)5G
service.typehttp service typeNodePort
service.porthttp service port8848
service.nodePorthttp service nodeport30000
ingress.enabledEnable ingress or notfalse
ingress.annotationsThe annotations used in ingress{}
ingress.hostsThe host of nacos service in ingress rulenacos.example.com

Example

quickstart mode(without mysql)

$ helm install `release name` ./ --set global.mode=quickstart

standalone mode(without pv)

$ helm install `release name` ./ --set global.mode=standalone

Tip: if the logs of nacos pod throws exception, you may need to delete the pod. Because mysql pod is not ready, nacos pod has been started.

cluster mode(without pv)

$ helm install `release name` ./ --set global.mode=cluster

$ kubectl scale sts `release name`-nacos --replicas=3

  • Use kubectl exec to get the cluster config of the Pods in the nacos StatefulSet after scale StatefulSets

Deploy nacos with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has nacos on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the chartnacos is pinned at v0.1.1 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below
opentenant validate opentenant.yaml
terraform init && terraform apply