user-service-deployment.yaml 980 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. apiVersion: apps/v1
  2. kind: Deployment
  3. metadata:
  4. name: user-service
  5. labels:
  6. name: user-service
  7. spec:
  8. replicas: 3
  9. strategy:
  10. type: RollingUpdate
  11. selector:
  12. matchLabels:
  13. name: user-service
  14. template:
  15. metadata:
  16. labels:
  17. name: user-service
  18. spec:
  19. containers: #定义User容器,开放10086端口
  20. - name: user
  21. image: user
  22. ports:
  23. - containerPort: 10086
  24. imagePullPolicy: IfNotPresent
  25. - name: mysql #定义MySQL容器,3306
  26. image: mysql-for-user
  27. ports:
  28. - containerPort: 3306
  29. env:
  30. - name: MYSQL_ROOT_PASSWORD
  31. value: "123456"
  32. imagePullPolicy: IfNotPresent
  33. - name: redis #定义Redis容器,开放6379端口
  34. image: redis:5.0
  35. ports:
  36. - containerPort: 6379
  37. imagePullPolicy: IfNotPresent