赞
踩
1.helm新的chart包制作helm create myapp( metallb和nacos)
3.helm启动LoadBalancer服务(之前用NodePort暴漏3000+端口压测100个微服务就挂了,所以更换了LoadBalancer模式很稳定)
4.持久化分布存储longhorn安装(longhorn安装略,rancher商店有现成的可以一键安装,网上也有很多longhorn.yaml模板k8s启动就可以了)
├── Chart.yaml
1.1# values.yaml 更改成自己IP同一网段(切记别冲突自己内外IP)
1.2#启动服务metallb (每台都会启动speaker服务)
{{- if ne .Values.global.mode "quickstart" }}
mysql.master.service.host: "192.168.78.13"
mysql.slave.service.host: "182.168.78.14"
mysql.master.password: "123456"
name: {{ include "nacos.fullname" . }}
{{- toYaml .Values.annotations | indent 4 }}
{{- if eq .Values.global.mode "cluster" }}
replicas: {{ .Values.replicaCount }}
app.kubernetes.io/name: {{ include "nacos.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/name: {{ include "nacos.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- if eq .Values.global.mode "cluster" }}
- name: peer-finder-plugin-install
image: nacos/nacos-peer-finder-plugin:1.0
- mountPath: /home/nacos/plugins/peer-finder
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
containerPort: {{ .Values.env.serverPort }}
{{- toYaml .Values.resources | nindent 12 }}
{{- if eq .Values.global.mode "quickstart" }}
value: {{ .Values.env.preferhostmode | quote }}
{{- else if eq .Values.global.mode "standalone" }}
value: {{ .Values.env.preferhostmode | quote }}
- name: SPRING_DATASOURCE_PLATFORM
- name: MYSQL_MASTER_SERVICE_HOST
key: mysql.master.service.host
- name: MYSQL_SLAVE_SERVICE_HOST
- name: MYSQL_MASTER_SERVICE_DB_NAME
- name: MYSQL_MASTER_SERVICE_PORT
- name: MYSQL_SLAVE_SERVICE_PORT
- name: MYSQL_MASTER_SERVICE_USER
- name: MYSQL_MASTER_SERVICE_PASSWORD
value: {{ .Values.env.serverPort | quote }}
- name: NACOS_APPLICATION_PORT
value: {{ .Values.env.serverPort | quote }}
{{- if not .Values.persistence.enabled }}
{{- else if eq .Values.global.mode "cluster" }}
value: {{ .Values.env.preferhostmode | quote }}
- name: MYSQL_MASTER_SERVICE_HOST
key: mysql.master.service.host
- name: MYSQL_SLAVE_SERVICE_HOST
- name: MYSQL_MASTER_SERVICE_DB_NAME
- name: MYSQL_MASTER_SERVICE_PORT
- name: MYSQL_SLAVE_SERVICE_PORT
- name: MYSQL_MASTER_SERVICE_USER
- name: MYSQL_MASTER_SERVICE_PASSWORD
value: {{ .Values.env.serverPort | quote }}
mountPath: /home/nacos/plugins/peer-finder
{{- if not .Values.persistence.enabled }}
{{- if and .Values.persistence.enabled (eq .Values.global.mode "standalone") }}
{{- toYaml .Values.persistence.data | nindent 6 }}
{{- if and .Values.persistence.enabled (eq .Values.global.mode "cluster") }}
{{- toYaml .Values.persistence.data | nindent 6 }}
{{- toYaml .Values.persistence.plugin | nindent 6 }}
{{- toYaml .Values.persistence.log| nindent 6 }}
{{- with .Values.nodeSelector }}
{{- with .Values.tolerations }}
{{- if and (eq .Values.global.mode "cluster") }}
- port: {{ .Values.service.port }}
app.kubernetes.io/name: {{ include "nacos.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- toYaml .Values.service.labels | nindent 4 }}
{{- toYaml .Values.service.annotations | nindent 4 }}
type: {{ .Values.service.type }}
- port: {{ .Values.service.port }}
{{- if eq .Values.service.type "NodePort" }}
nodePort: {{ .Values.service.nodePort }}
app.kubernetes.io/name: {{ include "nacos.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.
############################nacos###########################
repository: nacos/nacos-server
- ReadWriteOnce
# kubernetes.io/ingress.class: nginx
# kubernetes.io/tls-acme: "true"
# - secretName: chart-example-tls
# 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:'.
#查看日志启动正常
#登录http://192.168.78.100:8848/nacos/ (这个IP100就是LoadBalancer分配的对外服务地址)用户名密码默认是nacos(记得更改)
#查看集群节点(我这里部署的是集群模式#mode: quickstart #mode: standalone
#这里就可以正常使用了,导入或创建配置(我这里之前有了的就直接导入了)
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。