[kubesphere平台搭建 part.3]集群部署中间件-Nacos

323 阅读1分钟

1 Nacos

仅为集群部署

1.1 修改mysql

创建nacos账户

 CREATE DATABASE 'nacos';
 CREATE USER 'nacos'@'%' IDENTIFIED BY 'nacos';
 GRANT ALL PRIVILEGES ON nacos.* TO 'nacos'@'%';
 FLUSH PRIVILEGES;

1.2 初始化nacos数据库

mysql数据库-nacos

github.com/alibaba/nac…

1.3 拉取nacos官方镜像

 git clone https://github.com/nacos-group/nacos-k8s.git

1.4 修改value.yaml部署文件

 cd nacos-k8s/helm
 vim values.yaml
 # Default values for nacos.
 # This is a YAML-formatted file.
 # Declare variables to be passed into your templates.
 global:
 #  mode: standalone
   mode: cluster
 ############################nacos###########################
 namespace: public-tools
 nacos:
   image:
     repository: nacos/nacos-server
     tag: latest
     pullPolicy: IfNotPresent
   plugin:
     enable: true
     image:
       repository: nacos/nacos-peer-finder-plugin
       tag: 1.1
       pullPolicy: IfNotPresent
   replicaCount: 3
   podManagementPolicy: Parallel
   domainName: cluster.local
   preferhostmode: hostname
   serverPort: 8848
   health:
     enabled: false
   storage:
 #   type: embedded
     type: mysql
     db:
       host: 10.233.90.212
       name: nacos
       port: 3306
       username: nacos
       password: nacos
       param: characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useSSL=false
 persistence:
   enabled: false
   data:
     accessModes:
       - ReadWriteOnce
     storageClassName: manual
     resources:
       requests:
         storage: 5Gi
 service:
   #type: ClusterIP
   type: NodePort
   port: 8848
   nodePort: 31848
 ingress:
   enabled: false
   # apiVersion: extensions/v1beta1
   apiVersion: networking.k8s.io/v1
   annotations: { }
     # kubernetes.io/ingress.class: nginx
     # kubernetes.io/tls-acme: "true"
     # For Kubernetes >= 1.18 you should specify the ingress-controller via the field ingressClassName
     # See https://kubernetes.io/blog/2020/04/02/improvements-to-the-ingress-api-in-kubernetes-1.18/#specifying-the-class-of-an-ingress
     # ingressClassName: nginx
   ingressClassName: "nginx"
   hosts:
     - host: nacos.example.com
       #paths: [ ]
   tls: [ ]
   #  - secretName: chart-example-tls
   #    hosts:
   #      - chart-example.local
 resources:
   # We usually recommend not to specify default resources and to leave this as a conscious
   # choice for the user. This also increases chances charts run on environments with little
   # resources, such as Minikube. If you do want to specify resources, uncomment the following
   # lines, adjust them as necessary, and remove the curly braces after 'resources:'.
   # limits:
   #   cpu: 100m
   #   memory: 128Mi
   requests:
     cpu: 500m
     memory: 2Gi
 annotations: { }
 nodeSelector: { }
 tolerations: [ ]
 affinity: { }

1.5 进行部署

 cd ../
 sudo helm install helm

1.6 helm打包上传模板

跳过1.5,将helm文件夹下内容放入独立文件夹 与独立文件夹同级进行打包

 #helm package [package_name]
 helm package nacos

把压缩的tar文件上传到kubesphere 企业空间-应用管理-应用模板