--- apiVersion: apps/v1 kind: Deployment metadata: name: api-deployment spec: selector: matchLabels: app: api # 选择这个指定标签执行 replicas: 2 # 运行pod数量 template: metadata: labels: app: api # 标签 spec: containers: - name: api image: openim/api:2.0.10 ports: - containerPort: 10002 volumeMounts: - name: cfg mountPath: /Open-IM-Server/config/config.yaml subPath: config.yaml updateStrategy: #更新策略 rollingUpdate: partition: 1 type: RollingUpdate # 滚动更新 --- apiVersion: v1 kind: Service metadata: name: api spec: externalTrafficPolicy: Cluster ports: - name: apiPort port: 10002 protocol: TCP targetPort: 10002 selector: app: api type: NodePort