deploy-tmp.yaml 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. ---
  2. apiVersion: apps/v1
  3. kind: StatefulSet
  4. metadata:
  5. name: nginx-material
  6. namespace: pro
  7. labels:
  8. app: nginx-material
  9. spec:
  10. serviceName: nginx-material
  11. replicas: 2
  12. selector:
  13. matchLabels:
  14. app: nginx-material
  15. template:
  16. metadata:
  17. labels:
  18. app: nginx-material
  19. spec:
  20. terminationGracePeriodSeconds: 180
  21. dnsPolicy: ClusterFirstWithHostNet
  22. dnsConfig:
  23. nameservers:
  24. - 223.5.5.5
  25. - 10.26.22.50
  26. - 10.26.22.150
  27. initContainers:
  28. - name: init
  29. image: hub.evbj.easou.com/dev/busybox
  30. command: [ "chmod","777","-R","/data" ]
  31. imagePullPolicy: IfNotPresent
  32. volumeMounts:
  33. - name: volume
  34. mountPath: /data
  35. #nodeSelector:
  36. # app.touchrs: touchrs
  37. # affinity:
  38. # podAntiAffinity:
  39. # preferredDuringSchedulingIgnoredDuringExecution:
  40. # - weight: 100
  41. # podAffinityTerm:
  42. # labelSelector:
  43. # matchExpressions:
  44. # - key: app
  45. # operator: In
  46. # values:
  47. # - nginx-material
  48. # topologyKey: kubernetes.io/hostname
  49. containers:
  50. - name: nginx-material
  51. image: nginx:1.14.2
  52. imagePullPolicy: IfNotPresent
  53. ports:
  54. - containerPort: 80
  55. name: port
  56. volumeMounts:
  57. - name: volume
  58. mountPath: /data
  59. - name: nginx-material-config
  60. mountPath: /etc/nginx/nginx.conf
  61. subPath: nginx.conf
  62. readinessProbe:
  63. tcpSocket:
  64. port: 80
  65. initialDelaySeconds: 40
  66. periodSeconds: 15
  67. # - image: hub.evbj.easou.com/pro/filebeat:7.13.3
  68. # imagePullPolicy: IfNotPresent
  69. # name: filebeat
  70. # volumeMounts:
  71. # - name: volume #日志同时挂载在nginx和filebeat中
  72. # mountPath: /data
  73. # - name: filebeat-config
  74. # mountPath: /usr/share/filebeat/filebeat.yml
  75. # subPath: filebeat.yml
  76. volumes:
  77. - name: nginx-material-config
  78. configMap:
  79. name: nginx-material-config
  80. items:
  81. - key: nginx.conf
  82. path: nginx.conf
  83. volumeClaimTemplates:
  84. - metadata:
  85. name: volume
  86. spec:
  87. accessModes: [ "ReadWriteOnce" ]
  88. storageClassName: ceph-block
  89. resources:
  90. requests:
  91. storage: 100Gi
  92. ---
  93. apiVersion: v1
  94. kind: Service
  95. metadata:
  96. name: nginx-material-svc
  97. namespace: pro
  98. labels:
  99. app: nginx-material-svc
  100. spec:
  101. type: NodePort
  102. ports:
  103. - port: 80
  104. targetPort: 80
  105. name: "main"
  106. selector:
  107. app: nginx-material
  108. ---
  109. apiVersion: networking.k8s.io/v1
  110. kind: Ingress
  111. metadata:
  112. name: nginx-material-ingress
  113. namespace: pro
  114. spec:
  115. rules:
  116. - host: material.appeasou.com
  117. http:
  118. paths:
  119. - path: /
  120. pathType: Prefix
  121. backend:
  122. service:
  123. name: nginx-material-svc
  124. port:
  125. number: 8080
  126. ingressClassName: nginx
  127. ---
  128. apiVersion: v1
  129. kind: ConfigMap
  130. metadata:
  131. name: nginx-material-config
  132. namespace: pro
  133. data:
  134. nginx.conf: |
  135. user nginx;
  136. worker_processes 1;
  137. error_log /var/log/nginx/error.log warn;
  138. pid /var/run/nginx.pid;
  139. events {
  140. worker_connections 1024;
  141. }
  142. http {
  143. include /etc/nginx/mime.types;
  144. default_type application/octet-stream;
  145. log_format main '$remote_addr - $remote_user [$time_local] "$request" '
  146. '$status $body_bytes_sent "$http_referer" '
  147. '"$http_user_agent" "$http_x_forwarded_for"';
  148. access_log /var/log/nginx/access.log main;
  149. sendfile on;
  150. #tcp_nopush on;
  151. keepalive_timeout 65;
  152. #gzip on;
  153. include /etc/nginx/conf.d/*.conf;
  154. }