大量更新
This commit is contained in:
266
84-202605-北京三河测试/k8s-app/helm-emqxs.yaml
Normal file
266
84-202605-北京三河测试/k8s-app/helm-emqxs.yaml
Normal file
@@ -0,0 +1,266 @@
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: StatefulSet
|
||||
metadata:
|
||||
labels:
|
||||
cmii.app: helm-emqxs
|
||||
cmii.emqx.architecture: cluster
|
||||
cmii.type: middleware
|
||||
name: helm-emqxs
|
||||
namespace: bj-sh-uas-260511
|
||||
spec:
|
||||
persistentVolumeClaimRetentionPolicy:
|
||||
whenDeleted: Retain
|
||||
whenScaled: Retain
|
||||
podManagementPolicy: Parallel
|
||||
replicas: 1
|
||||
revisionHistoryLimit: 10
|
||||
selector:
|
||||
matchLabels:
|
||||
cmii.app: helm-emqxs
|
||||
cmii.emqx.architecture: cluster
|
||||
cmii.type: middleware
|
||||
serviceName: helm-emqxs-headless
|
||||
template:
|
||||
metadata:
|
||||
creationTimestamp: null
|
||||
labels:
|
||||
cmii.app: helm-emqxs
|
||||
cmii.emqx.architecture: cluster
|
||||
cmii.type: middleware
|
||||
spec:
|
||||
affinity:
|
||||
nodeAffinity:
|
||||
requiredDuringSchedulingIgnoredDuringExecution:
|
||||
nodeSelectorTerms:
|
||||
- matchExpressions:
|
||||
- key: uavcloud.env
|
||||
operator: In
|
||||
values:
|
||||
- bj-sh-uas-260511
|
||||
podAntiAffinity:
|
||||
preferredDuringSchedulingIgnoredDuringExecution:
|
||||
- podAffinityTerm:
|
||||
labelSelector:
|
||||
matchExpressions:
|
||||
- key: cmii.app
|
||||
operator: In
|
||||
values:
|
||||
- helm-emqxs
|
||||
topologyKey: kubernetes.io/hostname
|
||||
weight: 100
|
||||
containers:
|
||||
- env:
|
||||
- name: POD_NAME
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
apiVersion: v1
|
||||
fieldPath: metadata.name
|
||||
- name: EMQX_DATA_DIR
|
||||
value: /opt/emqx/data
|
||||
image: 192.168.3.31:8088/cmii/emqx:5.8.8
|
||||
imagePullPolicy: IfNotPresent
|
||||
livenessProbe:
|
||||
failureThreshold: 3
|
||||
httpGet:
|
||||
path: /status
|
||||
port: 18083
|
||||
scheme: HTTP
|
||||
initialDelaySeconds: 60
|
||||
periodSeconds: 30
|
||||
successThreshold: 1
|
||||
timeoutSeconds: 10
|
||||
name: emqx
|
||||
ports:
|
||||
- containerPort: 1883
|
||||
name: mqtt
|
||||
protocol: TCP
|
||||
- containerPort: 8883
|
||||
name: mqttssl
|
||||
protocol: TCP
|
||||
- containerPort: 8083
|
||||
name: ws
|
||||
protocol: TCP
|
||||
- containerPort: 18083
|
||||
name: dashboard
|
||||
protocol: TCP
|
||||
- containerPort: 4370
|
||||
name: ekka
|
||||
protocol: TCP
|
||||
readinessProbe:
|
||||
failureThreshold: 3
|
||||
httpGet:
|
||||
path: /status
|
||||
port: 18083
|
||||
scheme: HTTP
|
||||
initialDelaySeconds: 10
|
||||
periodSeconds: 10
|
||||
successThreshold: 1
|
||||
timeoutSeconds: 5
|
||||
resources:
|
||||
limits:
|
||||
cpu: "2"
|
||||
memory: 2Gi
|
||||
requests:
|
||||
cpu: 500m
|
||||
memory: 512Mi
|
||||
startupProbe:
|
||||
failureThreshold: 30
|
||||
httpGet:
|
||||
path: /status
|
||||
port: 18083
|
||||
scheme: HTTP
|
||||
initialDelaySeconds: 10
|
||||
periodSeconds: 5
|
||||
successThreshold: 1
|
||||
timeoutSeconds: 1
|
||||
terminationMessagePath: /dev/termination-log
|
||||
terminationMessagePolicy: File
|
||||
volumeMounts:
|
||||
- mountPath: /opt/emqx/data
|
||||
name: emqx-data
|
||||
- mountPath: /opt/emqx/etc/emqx.conf
|
||||
name: bootstrap-config
|
||||
subPath: emqx.conf
|
||||
- command:
|
||||
- /bin/sh
|
||||
- -c
|
||||
- |
|
||||
# 等待主容器启动
|
||||
echo "等待EMQX启动..."
|
||||
sleep 20
|
||||
|
||||
# 执行初始化
|
||||
/bin/sh /scripts/init-dashboard.sh
|
||||
|
||||
# 保持运行
|
||||
echo "初始化完成,进入守护模式..."
|
||||
while true; do sleep 3600; done
|
||||
env:
|
||||
- name: DASHBOARD_ADMIN_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
key: dashboard-admin-password
|
||||
name: emqx-credentials
|
||||
image: 192.168.3.31:8088/cmii/tools:1.0
|
||||
imagePullPolicy: IfNotPresent
|
||||
name: init-dashboard
|
||||
resources:
|
||||
limits:
|
||||
cpu: 200m
|
||||
memory: 128Mi
|
||||
requests:
|
||||
cpu: 100m
|
||||
memory: 64Mi
|
||||
terminationMessagePath: /dev/termination-log
|
||||
terminationMessagePolicy: File
|
||||
volumeMounts:
|
||||
- mountPath: /scripts
|
||||
name: init-script
|
||||
- mountPath: /bootstrap
|
||||
name: bootstrap-users
|
||||
dnsPolicy: ClusterFirst
|
||||
imagePullSecrets:
|
||||
- name: harborsecret
|
||||
initContainers:
|
||||
- command:
|
||||
- /bin/sh
|
||||
- -c
|
||||
- |
|
||||
echo "准备bootstrap文件..."
|
||||
|
||||
# 创建数据目录
|
||||
mkdir -p /opt/emqx/data
|
||||
|
||||
# 复制bootstrap文件到数据目录
|
||||
# 只在文件不存在时复制,避免覆盖已有数据
|
||||
if [ ! -f /opt/emqx/data/bootstrap_users.json ]; then
|
||||
cp /bootstrap-src/bootstrap_users.json /opt/emqx/data/
|
||||
echo "✓ 已复制用户bootstrap文件"
|
||||
else
|
||||
echo "ℹ 用户bootstrap文件已存在,跳过"
|
||||
fi
|
||||
|
||||
# 设置权限 (现在有root权限,可以成功)
|
||||
chown -R 1000:1000 /opt/emqx/data
|
||||
|
||||
echo "✓ Bootstrap准备完成"
|
||||
image: 192.168.3.31:8088/cmii/tools:1.0
|
||||
imagePullPolicy: IfNotPresent
|
||||
name: prepare-bootstrap
|
||||
resources: {}
|
||||
securityContext:
|
||||
runAsUser: 0
|
||||
terminationMessagePath: /dev/termination-log
|
||||
terminationMessagePolicy: File
|
||||
volumeMounts:
|
||||
- mountPath: /opt/emqx/data
|
||||
name: emqx-data
|
||||
- mountPath: /bootstrap-src
|
||||
name: bootstrap-users
|
||||
nodeSelector:
|
||||
mysql-deploy: "true"
|
||||
restartPolicy: Always
|
||||
schedulerName: default-scheduler
|
||||
securityContext:
|
||||
fsGroup: 1000
|
||||
runAsUser: 1000
|
||||
serviceAccount: helm-emqxs
|
||||
serviceAccountName: helm-emqxs
|
||||
terminationGracePeriodSeconds: 30
|
||||
volumes:
|
||||
- configMap:
|
||||
defaultMode: 420
|
||||
name: emqx-bootstrap-config
|
||||
name: bootstrap-config
|
||||
- configMap:
|
||||
defaultMode: 420
|
||||
name: emqx-bootstrap-users
|
||||
name: bootstrap-users
|
||||
- configMap:
|
||||
defaultMode: 493
|
||||
name: emqx-init-dashboard
|
||||
name: init-script
|
||||
- name: emqx-data
|
||||
hostPath:
|
||||
path: /var/lib/docker/emqx-pv/bj-sh-uas-260511/
|
||||
type: ""
|
||||
updateStrategy:
|
||||
type: RollingUpdate
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
labels:
|
||||
cmii.app: helm-emqxs
|
||||
cmii.type: middleware
|
||||
name: helm-emqxs
|
||||
namespace: bj-sh-uas-260511
|
||||
spec:
|
||||
ports:
|
||||
- name: mqtt
|
||||
nodePort: 31883
|
||||
port: 1883
|
||||
protocol: TCP
|
||||
targetPort: 1883
|
||||
- name: dashboard
|
||||
nodePort: 38085
|
||||
port: 18083
|
||||
protocol: TCP
|
||||
targetPort: 18083
|
||||
- name: ws
|
||||
nodePort: 38083
|
||||
port: 8083
|
||||
protocol: TCP
|
||||
targetPort: 8083
|
||||
- name: mqttssl
|
||||
nodePort: 38883
|
||||
port: 8883
|
||||
protocol: TCP
|
||||
targetPort: 8883
|
||||
selector:
|
||||
cmii.app: helm-emqxs
|
||||
cmii.emqx.architecture: cluster
|
||||
cmii.type: middleware
|
||||
sessionAffinity: None
|
||||
type: NodePort
|
||||
Reference in New Issue
Block a user