github.com/qsunny/k8s@v0.0.0-20220101153623-e6dca256d5bf/nacos/helm/README.md (about) 1 # Nacos Helm Chart 2 3 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. 4 5 ## Introduction 6 7 This project is based on the Helm Chart packaged by [nacos-k8s](https://github.com/nacos-group/nacos-k8s/). 8 9 ## Prerequisites 10 11 - Kubernetes 1.10+ 12 - Helm v3 13 - PV provisioner support in the underlying infrastructure 14 15 ## Tips 16 If you use a custom database, please initialize the database script yourself first. 17 <https://github.com/alibaba/nacos/blob/develop/distribution/conf/nacos-mysql.sql> 18 19 20 ## Installing the Chart 21 22 To install the chart with `release name`: 23 24 ```shell 25 $ helm install `release name` ./nacos 26 ``` 27 28 The command deploys Nacos on the Kubernetes cluster in the default configuration. It will run without a mysql chart and persistent volume. The [configuration](#configuration) section lists the parameters that can be configured during installation. 29 30 ### Service & Configuration Management 31 32 #### Service registration 33 ```shell 34 curl -X POST 'http://$NODE_IP:$NODE_PORT/nacos/v1/ns/instance?serviceName=nacos.naming.serviceName&ip=20.18.7.10&port=8080' 35 ``` 36 37 #### Service discovery 38 ```shell 39 curl -X GET 'http://$NODE_IP:$NODE_PORT/nacos/v1/ns/instance/list?serviceName=nacos.naming.serviceName' 40 ``` 41 #### Publish config 42 ```shell 43 curl -X POST "http://$NODE_IP:$NODE_PORT/nacos/v1/cs/configs?dataId=nacos.cfg.dataId&group=test&content=helloWorld" 44 ``` 45 #### Get config 46 ```shell 47 curl -X GET "http://$NODE_IP:$NODE_PORT/nacos/v1/cs/configs?dataId=nacos.cfg.dataId&group=test" 48 ``` 49 50 51 52 > **Tip**: List all releases using `helm list` 53 54 ## Uninstalling the Chart 55 56 To uninstall/delete `release name`: 57 58 ```shell 59 $ helm uninstall `release name` 60 ``` 61 The command removes all the Kubernetes components associated with the chart and deletes the release. 62 63 ## Configuration 64 65 The following table lists the configurable parameters of the Skywalking chart and their default values. 66 67 | Parameter | Description | Default | 68 |---------------------------------------|--------------------------------------------------------------------|-------------------------------------| 69 | `global.mode` | Run Mode (~~quickstart,~~ standalone, cluster; ) | `standalone` | 70 | `resources` | The [resources] to allocate for nacos container | `{}` | 71 | `nodeSelector` | Nacos labels for pod assignment | `{}` | 72 | `affinity` | Nacos affinity policy | `{}` | 73 | `tolerations` | Nacos tolerations | `{}` | 74 | `resources.requests.cpu`|nacos requests cpu resource|`500m`| 75 | `resources.requests.memory`|nacos requests memory resource|`2G`| 76 | `nacos.replicaCount` | Number of desired nacos pods, the number should be 1 as run standalone mode| `1` | 77 | `nacos.image.repository` | Nacos container image name | `nacos/nacos-server` | 78 | `nacos.image.tag` | Nacos container image tag | `latest` | 79 | `nacos.image.pullPolicy` | Nacos container image pull policy | `IfNotPresent` | 80 | `nacos.plugin.enable` | Nacos cluster plugin that is auto scale | `true` | 81 | `nacos.plugin.image.repository` | Nacos cluster plugin image name | `nacos/nacos-peer-finder-plugin` | 82 | `nacos.plugin.image.tag` | Nacos cluster plugin image tag | `1.1` | 83 | `nacos.health.enabled` | Enable health check or not | `false` | 84 | `nacos.env.preferhostmode` | Enable Nacos cluster node domain name support | `hostname` | 85 | `nacos.env.serverPort` | Nacos port | `8848` | 86 | `nacos.storage.type` | Nacos data storage method `mysql` or `embedded`. The `embedded` supports either standalone or cluster mode | `embedded` | 87 | `nacos.storage.db.host` | mysql host | | 88 | `nacos.storage.db.name` | mysql database name | | 89 | `nacos.storage.db.port` | mysql port | 3306 | 90 | `nacos.storage.db.username` | username of database | | 91 | `nacos.storage.db.password` | password of database | | 92 | `nacos.storage.db.param` | Database url parameter | `characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useSSL=false` | 93 | `persistence.enabled` | Enable the nacos data persistence or not | `false` | 94 | `persistence.data.accessModes` | Nacos data pvc access mode | `ReadWriteOnce` | 95 | `persistence.data.storageClassName` | Nacos data pvc storage class name | `manual` | 96 | `persistence.data.resources.requests.storage` | Nacos data pvc requests storage | `5G` | 97 | `service.type` | http service type | `NodePort` | 98 | `service.port` | http service port | `8848` | 99 | `service.nodePort` | http service nodeport | `30000` | 100 | `ingress.enabled` | Enable ingress or not | `false` | 101 | `ingress.annotations` | The annotations used in ingress | `{}` | 102 | `ingress.hosts` | The host of nacos service in ingress rule | `nacos.example.com` | 103 104 105 ## Example 106  107 #### standalone mode(with embedded) 108 ```console 109 $ helm install `release name` ./ --set global.mode=standalone 110 ``` 111  112 113 #### standalone mode(with mysql) 114 ```console 115 $ helm install `release name` ./ --set global.mode=standalone --set nacos.storage.db.host=host --set nacos.storage. 116 db.name=dbName --set nacos.storage.db.port=port --set nacos.storage.db.username=username --set nacos.storage.db. 117 password=password 118 ``` 119  120 121 122 > **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. 123 124 #### cluster mode(without pv) 125 ```console 126 $ helm install `release name` ./ --set global.mode=cluster 127 ``` 128  129 130 ```console 131 $ kubectl scale sts `release name`-nacos --replicas=3 132 ``` 133  134 135 * Use kubectl exec to get the cluster config of the Pods in the nacos StatefulSet after scale StatefulSets 136 137 