mdeployments.yaml 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. ---
  2. apiVersion: v1
  3. kind: Service
  4. metadata:
  5. name: fuzzs-scene-sim-test
  6. spec:
  7. type: NodePort
  8. ports:
  9. - name: backend
  10. port: 8089
  11. targetPort: 8089
  12. nodePort: 30000
  13. - name: client
  14. port: 8080
  15. targetPort: 8080
  16. nodePort: 30001
  17. - name: db
  18. port: 3306
  19. targetPort: 3306
  20. nodePort: 30002
  21. selector:
  22. app: fuzzs-scene-sim-test-app
  23. ---
  24. # 改为NodePort
  25. apiVersion: apps/v1
  26. kind: Deployment
  27. metadata:
  28. name: fuzzs-scene-sim-test-app
  29. spec:
  30. replicas: 1
  31. selector:
  32. matchLabels:
  33. app: fuzzs-scene-sim-test-app
  34. template:
  35. metadata:
  36. labels:
  37. app: fuzzs-scene-sim-test-app
  38. spec:
  39. securityContext:
  40. runAsUser: 0
  41. containers:
  42. - name: backend
  43. image: fuzzsscenesimtest-backend:latest
  44. imagePullPolicy: Never
  45. ports:
  46. - containerPort: 8089
  47. env:
  48. - name: TZ
  49. value: Asia/Shanghai
  50. - name: DB_URL
  51. value: jdbc:mysql://fuzzs-scene-sim-test:3306/test?serverTimezone=Asia/Shanghai
  52. - name: client
  53. image: fuzzsscenesimtest-client:latest
  54. imagePullPolicy: Never
  55. ports:
  56. - containerPort: 8081
  57. env:
  58. - name: SERVER_URL
  59. value: http://fuzzs-scene-sim-test:8089
  60. - name: CLIENT_PORT
  61. value: "8081"
  62. - name: db
  63. image: mysql:5.7
  64. volumeMounts:
  65. - name: mysql-data
  66. mountPath: /var/lib/mysql
  67. ports:
  68. - containerPort: 3306
  69. env:
  70. - name: MYSQL_ROOT_PASSWORD
  71. value: root
  72. - name: TZ
  73. value: Asia/Shanghai
  74. volumes:
  75. - name: mysql-data
  76. hostPath:
  77. path: /home/fuzzs-scene-sim-test/mysql/data