helm部署nacos

1.去helm仓库拉取nacos包
https://artifacthub.io/packages/helm/kubegemsapp/nacos?modal=install
在这里插入图片描述

helm repo add kubegemsapp https://charts.kubegems.io/kubegemsapp
helm pull kubegemsapp/nacos
tar -zxvf nacos-0.1.5.tgz
mkdir -p nacos/ci/test

2.修改chart配置文件
注释nacos/values.yaml 与nacos/ci/values.yaml里面的数据库,
在这里插入图片描述

3.将nacos/values.yaml这个文件内容拷贝到nacos/ci/values.yaml,新增的文件里面将单点改为了集群模式,部署三个实例,
cp values.yaml ci/
改动1单点改为集群模式
在这里插入图片描述
改动2由一个实例启动改为三个实例启动
在这里插入图片描述
改动3,pvc磁盘改为false(关闭pvc挂载),不关闭就无法启动
在这里插入图片描述
这个nacos/ci/values.yaml文件启动的时候加了-f在后面,会默认覆盖前面的配置,只有这个文件里面没有的才会读取前一级的values.yaml

#这个是自己加的参数固定到一台机器上面运行pod,不想在一台机器上启动可以去掉
affinity:
  nodeAffinity:
    requiredDuringSchedulingIgnoredDuringExecution:
      nodeSelectorTerms:
      - matchExpressions:
        - key: nacos.comm
          operator: In
          values:
          - "true"
# Default values for nacos.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.

global:
  #mode: standalone
  mode: cluster

nameOverride: nacos
fullnameOverride: nacos
############################nacos###########################
nacos:
  image:
    repository: registry.cn-beijing.aliyuncs.com/kubegemsapp/nacos-server
    tag: 2.0.2
    pullPolicy: IfNotPresent
  plugin:
    enable: true
    image:
      repository: registry.cn-beijing.aliyuncs.com/kubegemsapp/nacos-peer-finder-plugin
      tag: 1.1
  replicaCount: 3
  domainName: cluster.local
  preferhostmode: hostname
  serverPort: 8848
  health:
    enabled: true
#  storage:
#    type: mysql
#    db:
#      host: localhost
#      name: nacos
#      port: 3306
#      username: usernmae
#      password: password
#      param: characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useSSL=false

persistence:
  enabled: false
  data:
    accessModes:
      - ReadWriteOnce
    storageClassName: local-path
    resources:
      requests:
        storage: Gi


service:
  #type: ClusterIP
  type: ClusterIP
  port: 8848
  #nodePort: 30000


ingress:
  enabled: false
  annotations: { }
    # kubernetes.io/ingress.class: nginx
  # kubernetes.io/tls-acme: "true"
  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: "1"
    memory: 2.5Gi
  requests:
    cpu: 500m
    memory: 2Gi
annotations: { }

nodeSelector: { }

tolerations: [ ]

affinity: { }

3.增加数据库配置,nacos/ci/test/values.yaml 改成自己的数据库配置,name为数据库名称
values.yaml

nacos:
  storage:
    type: mysql
    db:
      host: percona80-master.devops
      name: nacos
      port: "3306"
      username: nacos
      password: password
      param: characterEncoding=utf8&connectTimeout=60000&socketTimeout=180000&autoReconnect=true&useSSL=false&allowPublicKeyRetrieval=true

启动命令

helm upgrade nacos ./nacos/ -f ./nacos/ci/values.yaml -f ./nacos/ci/test/values.yaml -i -n default

helm list -n default
helm uninstall nacos -n default

查看运行成功
在这里插入图片描述

端口限制
service.yaml里面有一段是限制端口的,会自动减去1000,当端口设置低于31000的时候会报错,可以注释掉这段
service.yaml

    ## 兼容1.4.x版本的选举端口
#    - port: 7848
#      name: old-raft-rpc
#      targetPort: 7848
#      protocol: TCP
#      {{- if eq .Values.service.type "NodePort" }}
#      nodePort: {{ sub .Values.service.nodePort 1000 }}
#      {{- end }}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值