通过k8s部署最新开源版本,组件包括service,ingress,deployment,configmap(挂载emqx.conf以及acl.conf),secret(dashborad的admin账户的密码),deployment中引入cm,secret以及挂载的pvc(挂载/opt/emex/data),但是pod重启之后登陆密码等信息依旧被重置,进入容器后查看发现pvc挂载成功(在里面修改文件重启不会被重置),secret密码引入容器成功(进入容器执行printenv EMQX_ADMIN_PASSWORD,显示secret中配置的密码),以上验证的没有问题,就是deployment中对admin密码的配置,尝试过command命令以及在环境变量中直接指定(多个文档中有的说是指定EMQX_DASHBOARD__DEFAULT_PASSWORD ,有的又说是直接EMQX_PASSWORD),都没有生效,下面贴下deployment的配置,麻烦哪位大佬帮忙看下:
apiVersion: apps/v1
kind: Deployment
metadata:
annotations:
deployment.kubernetes.io/revision: "22"
meta.helm.sh/release-name: base
meta.helm.sh/release-namespace: prj-xy
creationTimestamp: "2024-10-24T06:01:52Z"
generation: 22
labels:
app.kubernetes.io/instance: base
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: mqtt-server
app.kubernetes.io/version: 1.16.0
helm.sh/chart: mqtt-server-0.1.0
name: mqtt-server
namespace: prj-xy
resourceVersion: "4378334"
uid: 923e0857-3443-4627-b581-b9bebf60bf4f
spec:
progressDeadlineSeconds: 600
replicas: 1
revisionHistoryLimit: 10
selector:
matchLabels:
app.kubernetes.io/instance: base
app.kubernetes.io/name: mqtt-server
strategy:
rollingUpdate:
maxSurge: 25%
maxUnavailable: 25%
type: RollingUpdate
template:
metadata:
creationTimestamp: null
labels:
app.kubernetes.io/instance: base
app.kubernetes.io/name: mqtt-server
spec:
containers:
- env:
- name: EMQX_NODE__COOKIE
valueFrom:
configMapKeyRef:
key: node.cookie
name: mqtt-configmap
- name: EMQX_USERNAME
value: admin
- name: EMQX_PASSWORD
valueFrom:
secretKeyRef:
key: admin_password
name: mqtt-secret
- name: EMQX_LISTENER__TCP__DEFAULT__ACL
value: allow
- name: EMQX_LISTENER__TCP__DEFAULT__AUTH
value: password_file
image: registry.fpi-inc.site/dockerhub/emqx/emqx:latest
imagePullPolicy: IfNotPresent
livenessProbe:
failureThreshold: 3
initialDelaySeconds: 5
periodSeconds: 10
successThreshold: 1
tcpSocket:
port: 1883
timeoutSeconds: 1
name: mqtt-server
ports:
- containerPort: 1883
name: mqtt
protocol: TCP
- containerPort: 8084
name: mqtt3
protocol: TCP
- containerPort: 18083
name: http
protocol: TCP
readinessProbe:
failureThreshold: 3
initialDelaySeconds: 5
periodSeconds: 10
successThreshold: 1
tcpSocket:
port: 1883
timeoutSeconds: 1
resources:
limits:
memory: 2Gi
requests:
memory: 1Gi
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
volumeMounts:
- mountPath: /opt/emqx/etc/emqx.conf
name: config-volume
subPath: emqx.conf
- mountPath: /opt/emqx/etc/acl.conf
name: config-volume
subPath: acl.conf
- mountPath: /opt/emqx/data
name: data-volume
dnsPolicy: ClusterFirst
imagePullSecrets:
- name: registry-fpi-inc-site
restartPolicy: Always
schedulerName: default-scheduler
securityContext: {}
terminationGracePeriodSeconds: 30
volumes:
- configMap:
defaultMode: 420
name: mqtt-configmap
name: config-volume
- name: data-volume
persistentVolumeClaim:
claimName: mqtt-server