面包店
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

deployment-prd.yaml 3.0 KiB

8 miesięcy temu
7 miesięcy temu
8 miesięcy temu
7 miesięcy temu
8 miesięcy temu
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. kind: Deployment
  2. apiVersion: apps/v1
  3. # 元数据
  4. metadata:
  5. name: bakery
  6. namespace: zhios # namespace,测试环境为dev,正式环境为:zhios
  7. labels:
  8. app: bakery
  9. annotations:
  10. kubesphere.io/creator: dengbiao
  11. kubesphere.io/description: 面包店
  12. # deployment主要部分
  13. spec:
  14. replicas: 1
  15. selector:
  16. matchLabels:
  17. # 名称与上面的labels对应
  18. app: bakery
  19. template:
  20. metadata:
  21. labels:
  22. # 名称与上面的matchLabels对应
  23. app: bakery
  24. spec:
  25. # 声明挂载卷(将外部已存在的pvc、config等挂载进来)
  26. volumes:
  27. # 用于时区校正
  28. - name: host-time
  29. hostPath:
  30. path: /etc/localtime
  31. type: ''
  32. # 将前面创建的configMap也挂载进来
  33. - name: bakery-cfg
  34. configMap:
  35. # 这里的名字就是前面创建的configMap的名字
  36. name: bakery-cfg
  37. defaultMode: 420
  38. # pvc
  39. - name: bakery # 在该部署中的名称,后面使用改名称挂载
  40. persistentVolumeClaim:
  41. claimName: bakery # pvc的名称
  42. # Nginx配置
  43. - name: bakery-nginx
  44. configMap:
  45. name: bakery-nginx # 外部configMap的名称
  46. items:
  47. - key: go.conf
  48. path: default.conf
  49. containers:
  50. # 主容器
  51. - name: bakery
  52. # 镜像地址(提前打包好并推送的镜像仓库)
  53. image: 'registry.cn-shenzhen.aliyuncs.com/fnuoos-prd/bakery:24043014'
  54. ports:
  55. - name: httpsupply4001
  56. # 容器端口号(注意与golang web server启动的端口一致)
  57. containerPort: 4001
  58. protocol: TCP
  59. # 将前面volume声明的需要用到的pvc、config挂载上来
  60. volumeMounts:
  61. - name: host-time
  62. readOnly: true
  63. mountPath: /etc/localtime
  64. - name: bakery-cfg # 该名字对应前面volumes声明的名字
  65. readOnly: true
  66. # 挂载到容器的哪个路径
  67. mountPath: /var/zyos
  68. # 存储卷 用于存放前端代码
  69. - name: bakery # 前面volumes声明的名称
  70. mountPath: /data
  71. imagePullPolicy: Always
  72. # Nginx 容器
  73. - name: container-nginx
  74. image: nginx
  75. ports:
  76. - name: http-80
  77. containerPort: 80
  78. protocol: TCP
  79. volumeMounts:
  80. # 时区校正
  81. - name: host-time
  82. readOnly: true
  83. mountPath: /etc/localtime
  84. # 存储卷 用于存放前端代码
  85. - name: bakery # 前面volumes声明的名称
  86. mountPath: /usr/share/nginx/html
  87. - name: bakery-nginx # Nginx 配置
  88. readOnly: true
  89. mountPath: /etc/nginx/conf.d/default.conf
  90. subPath: default.conf
  91. restartPolicy: Always
  92. terminationGracePeriodSeconds: 30
  93. dnsPolicy: ClusterFirst