--- apiVersion: v1 kind: Service metadata: name: fuzzs-scene-sim-test spec: type: NodePort ports: - name: backend port: 8089 targetPort: 8089 nodePort: 30000 - name: client port: 8080 targetPort: 8080 nodePort: 30001 - name: db port: 3306 targetPort: 3306 nodePort: 30002 selector: app: fuzzs-scene-sim-test-app --- # 改为NodePort apiVersion: apps/v1 kind: Deployment metadata: name: fuzzs-scene-sim-test-app spec: replicas: 1 selector: matchLabels: app: fuzzs-scene-sim-test-app template: metadata: labels: app: fuzzs-scene-sim-test-app spec: securityContext: runAsUser: 0 containers: - name: backend image: fuzzsscenesimtest-backend:latest imagePullPolicy: Never ports: - containerPort: 8089 env: - name: TZ value: Asia/Shanghai - name: DB_URL value: jdbc:mysql://fuzzs-scene-sim-test:3306/test?serverTimezone=Asia/Shanghai - name: client image: fuzzsscenesimtest-client:latest imagePullPolicy: Never ports: - containerPort: 8081 env: - name: SERVER_URL value: http://fuzzs-scene-sim-test:8089 - name: CLIENT_PORT value: "8081" - name: db image: mysql:5.7 volumeMounts: - name: mysql-data mountPath: /var/lib/mysql ports: - containerPort: 3306 env: - name: MYSQL_ROOT_PASSWORD value: root - name: TZ value: Asia/Shanghai volumes: - name: mysql-data hostPath: path: /home/fuzzs-scene-sim-test/mysql/data