一、用到的插件
1、存储卷-日志外挂: 存储类自己提前建
2、env变量-存储nacos信息
二、新建项目
# helm create test-gateway
三、修改values.yaml
## 删除内容
# Additional volumes on the output Deployment definition.
volumes: []
# - name: foo
# secret:
# secretName: mysecret
# optional: false
# Additional volumeMounts on the output Deployment definition.
volumeMounts: []
# - name: foo
# mountPath: "/etc/foo"
# readOnly: true
## 添加
env:
NACOS_SERVER_ADDR: nacos-cs.nacos.svc.cluster.local:8848
NACOS_PASSWORD: nacos
NACOS_NAMESPACE: public
persistence:
data:
accessModes:
- ReadWriteOnce
storageClassName: nfs-hdd
resources:
requests:
storage: 10Gi
# 修改前的
livenessProbe:
httpGet:
path: /
port: http
readinessProbe:
httpGet:
path: /
port: http
# 修改后的
livenessProbe:
tcpSocket:
port: 8080
initialDelaySeconds: 30
periodSeconds: 10
readinessProbe:
tcpSocket:
port: 8080
initialDelaySeconds: 30
periodSeconds: 10
四、修改templates下的deployment.yaml
## 增加
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: {{ .Release.Name }} # 也可以使用{{ include "test-gateway.fullname" . }}
spec:
storageClassName: "{{ .Values.persistence.data.storageClassName }}"
accessModes:
- ReadWriteMany
resources:
requests:
storage: "{{ .Values.persistence.data.resources.requests.storage }}"
---
volumeMounts:
- name: logs
mountPath: "/work/logs"
volumes:
- name: logs
persistentVolumeClaim:
claimName: {{ .Release.Name }} # 也可以使用{{ include "test-gateway.fullname" . }}
## 删除
volumeMounts:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.volumes }}
volumes:
{{- toYaml . | nindent 8 }}
{{- end }}