# deployment 配置 apiVersion: apps/v1 kind: Deployment metadata: name: business-deployment namespace: egg-im labels: app: business spec: replicas: 1 selector: matchLabels: app: business template: metadata: labels: app: business spec: containers: - name: business image: 'registry.cn-shenzhen.aliyuncs.com/fnuoos-prd/egg-im-busness:0.0.1' imagePullPolicy: Always ports: - containerPort: 8000 volumeMounts: # 映射文件为宿主机文件 - mountPath: /log/ name: log env: - name: POD_IP valueFrom: fieldRef: fieldPath: status.podIP volumes: - name: log hostPath: path: /log/ --- # service 配置 apiVersion: v1 kind: Service metadata: name: business namespace: egg-im labels: app: business # 只有设置label,才能被服务发现找到 spec: selector: app: business ports: - protocol: TCP port: 8000 targetPort: 8000