# deployment 配置 apiVersion: apps/v1 kind: Deployment metadata: name: logic-deployment namespace: egg-im labels: app: logic spec: replicas: 1 selector: matchLabels: app: logic template: metadata: labels: app: logic spec: containers: - name: logic image: 'registry.cn-shenzhen.aliyuncs.com/fnuoos-prd/egg-im-logic:0.0.2' imagePullPolicy: Always # 在kind中需要指定,不然会强制到远程拉取镜像,导致部署失败 ports: - containerPort: 8001 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: logic namespace: egg-im labels: app: logic # 只有设置label,才能被服务发现找到 spec: selector: app: logic ports: - protocol: TCP port: 8000 targetPort: 8000