手写chart

野性酷女 2023-05-22 22:11 42阅读 0赞

欢迎关注我的公众号:

watermark_type_ZHJvaWRzYW5zZmFsbGJhY2s_shadow_50_text_Q1NETiBAaHhwamF2YTE_size_8_color_FFFFFF_t_70_g_se_x_16

目前刚开始写一个月,一共写了18篇原创文章,文章目录如下:

istio多集群探秘,部署了50次多集群后我得出的结论

istio多集群链路追踪,附实操视频

istio防故障利器,你知道几个,istio新手不要读,太难!

istio业务权限控制,原来可以这么玩

istio实现非侵入压缩,微服务之间如何实现压缩

不懂envoyfilter也敢说精通istio系列-http-rbac-不要只会用AuthorizationPolicy配置权限

不懂envoyfilter也敢说精通istio系列-02-http-corsFilter-不要只会vs

不懂envoyfilter也敢说精通istio系列-03-http-csrf filter-再也不用再代码里写csrf逻辑了

不懂envoyfilter也敢说精通istio系列http-jwt_authn-不要只会RequestAuthorization

不懂envoyfilter也敢说精通istio系列-05-fault-filter-故障注入不止是vs

不懂envoyfilter也敢说精通istio系列-06-http-match-配置路由不只是vs

不懂envoyfilter也敢说精通istio系列-07-负载均衡配置不止是dr

不懂envoyfilter也敢说精通istio系列-08-连接池和断路器

不懂envoyfilter也敢说精通istio系列-09-http-route filter

不懂envoyfilter也敢说精通istio系列-network filter-redis proxy

不懂envoyfilter也敢说精通istio系列-network filter-HttpConnectionManager

不懂envoyfilter也敢说精通istio系列-ratelimit-istio ratelimit完全手册

————————————————

manifest文件:

  1. [root@master01 manifest]# cat ./*
  2. kind: ClusterRoleBinding
  3. apiVersion: rbac.authorization.k8s.io/v1
  4. metadata:
  5. name: mysql-clusterrole-binding
  6. labels:
  7. app: "mysql"
  8. component: "mysql"
  9. chart: "mysql-0.1"
  10. release: "mysql"
  11. heritage: "Helm"
  12. roleRef:
  13. kind: ClusterRole
  14. name: mysql-clusterrole
  15. apiGroup: rbac.authorization.k8s.io
  16. subjects:
  17. - kind: ServiceAccount
  18. name: mysql-sa
  19. namespace: mysql
  20. kind: ClusterRole
  21. apiVersion: rbac.authorization.k8s.io/v1
  22. metadata:
  23. name: mysql-clusterrole
  24. labels:
  25. app: "mysql"
  26. component: "mysql"
  27. chart: "mysql-0.1"
  28. release: "mysql"
  29. heritage: "Helm"
  30. rules:
  31. - apiGroups: ['policy']
  32. resources: ['podsecuritypolicies']
  33. verbs: ['use']
  34. apiVersion: v1
  35. data:
  36. my.cnf: |
  37. [mysqld]
  38. skip-name-resolve
  39. port=3306
  40. innodb_file_per_table = 1
  41. kind: ConfigMap
  42. metadata:
  43. name: mysql-configmap
  44. labels:
  45. app: "mysql"
  46. component: "mysql"
  47. chart: "mysql"
  48. release: "mysql"
  49. heritage: "helm"
  50. apiVersion: apps/v1
  51. kind: Deployment
  52. metadata:
  53. name: mysql
  54. labels:
  55. app: mysql
  56. chart: "mysql-0.1"
  57. release: "mysql"
  58. heritage: "Helm"
  59. spec:
  60. progressDeadlineSeconds: 600
  61. strategy:
  62. type: RollingUpdate
  63. rollingUpdate:
  64. maxSurge: 1
  65. maxUnavailable: 1
  66. revisionHistoryLimit: 10
  67. selector:
  68. matchLabels:
  69. app: mysql
  70. release: mysql
  71. replicas: 1
  72. template:
  73. metadata:
  74. labels:
  75. app: mysql
  76. release: mysql
  77. spec:
  78. tolerations:
  79. - key: "example-key"
  80. operator: "Exists"
  81. effect: "NoSchedule"
  82. serviceAccountName: mysql-sa
  83. terminationGracePeriodSeconds: 60
  84. containers:
  85. - name: mysql
  86. image: mysql:5.6
  87. imagePullPolicy: IfNotPresent
  88. ports:
  89. - containerPort: 3306
  90. env:
  91. - name: MYSQL_ROOT_PASSWORD
  92. value: "mysql"
  93. readinessProbe:
  94. exec:
  95. command:
  96. - sh
  97. - -c
  98. - "mysqladmin ping -u root -p${MYSQL_ROOT_PASSWORD}"
  99. initialDelaySeconds: 30
  100. periodSeconds: 10
  101. timeoutSeconds: 5
  102. successThreshold: 1
  103. failureThreshold: 3
  104. livenessProbe:
  105. exec:
  106. command:
  107. - sh
  108. - -c
  109. - "mysqladmin ping -u root -p${MYSQL_ROOT_PASSWORD}"
  110. initialDelaySeconds: 30
  111. periodSeconds: 10
  112. timeoutSeconds: 5
  113. successThreshold: 1
  114. failureThreshold: 3
  115. resources:
  116. requests:
  117. cpu: 0.2
  118. memory: 100Mi
  119. limits:
  120. cpu: 0.5
  121. memory: 500Mi
  122. securityContext:
  123. allowPrivilegeEscalation: false
  124. volumeMounts:
  125. - mountPath: /var/lib/mysql
  126. name: data
  127. - name: configurations
  128. mountPath: /etc/mysql/conf.d/
  129. subPath: mysql.cnf
  130. volumes:
  131. - name: data
  132. persistentVolumeClaim:
  133. claimName: mysql-nfs-pvc
  134. - name: configurations
  135. configMap:
  136. name: mysql-configmap
  137. apiVersion: autoscaling/v1
  138. kind: HorizontalPodAutoscaler
  139. metadata:
  140. name: mysql-hpa
  141. labels:
  142. app: "mysql"
  143. component: "mysql"
  144. chart: "mysql-0.1"
  145. release: "mysql"
  146. heritage: "Helm"
  147. spec:
  148. scaleTargetRef:
  149. apiVersion: apps/v1
  150. kind: Deployment
  151. name: mysql
  152. minReplicas: 1
  153. maxReplicas: 5
  154. targetCPUUtilizationPercentage: 50
  155. apiVersion: policy/v1beta1
  156. kind: PodDisruptionBudget
  157. metadata:
  158. name: mysql-pdb
  159. labels:
  160. app: "mysql"
  161. component: "mysql"
  162. chart: "mysql-0.1"
  163. release: "mysql"
  164. heritage: "Helm"
  165. spec:
  166. minAvailable: 1
  167. selector:
  168. matchLabels:
  169. app: mysql
  170. release: mysql
  171. apiVersion: policy/v1beta1
  172. kind: PodSecurityPolicy
  173. metadata:
  174. name: mysql-psp
  175. labels:
  176. app: "mysql"
  177. component: "mysql"
  178. chart: "mysql-0.1"
  179. release: "mysql"
  180. heritage: "Helm"
  181. spec:
  182. runAsUser:
  183. rule: 'RunAsAny'
  184. seLinux:
  185. rule: 'RunAsAny'
  186. supplementalGroups:
  187. rule: 'MustRunAs'
  188. ranges:
  189. - min: 1
  190. max: 65535
  191. fsGroup:
  192. rule: 'MustRunAs'
  193. ranges:
  194. - min: 1
  195. max: 65535
  196. volumes:
  197. - 'configMap'
  198. - 'emptyDir'
  199. - 'projected'
  200. - 'secret'
  201. - 'downwardAPI'
  202. - 'persistentVolumeClaim'
  203. apiVersion: v1
  204. kind: PersistentVolumeClaim
  205. metadata:
  206. name: mysql-nfs-pvc
  207. labels:
  208. app: "mysql"
  209. component: "mysql"
  210. chart: "mysql-0.1"
  211. release: "mysql"
  212. heritage: "Helm"
  213. spec:
  214. storageClassName: mysql-sc
  215. accessModes:
  216. - ReadWriteMany
  217. resources:
  218. requests:
  219. storage: 500Mi
  220. apiVersion: v1
  221. kind: ServiceAccount
  222. metadata:
  223. name: mysql-sa
  224. labels:
  225. app: mysql
  226. chart: mysql-0.1
  227. release: mysql
  228. heritage: helm
  229. apiVersion: storage.k8s.io/v1
  230. kind: StorageClass
  231. metadata:
  232. name: mysql-sc
  233. labels:
  234. app: "mysql"
  235. component: "mysql"
  236. chart: "mysql-0.1"
  237. release: "mysql"
  238. heritage: "Helm"
  239. provisioner: fuseim.pri/ifs
  240. reclaimPolicy: Retain
  241. apiVersion: v1
  242. kind: Service
  243. metadata:
  244. name: mysql-svc
  245. labels:
  246. app: "mysql"
  247. component: "mysql"
  248. chart: "mysql-0.1"
  249. release: "mysql"
  250. heritage: "Helm"
  251. spec:
  252. selector:
  253. app: mysql
  254. release: mysql
  255. type: NodePort
  256. ports:
  257. - name: tcp
  258. port: 3306
  259. targetPort: 3306

template文件:

  1. [root@master01 templates]# cat ./*
  2. {
  3. {- if .Values.rbac.create}}
  4. kind: ClusterRoleBinding
  5. apiVersion: rbac.authorization.k8s.io/v1
  6. metadata:
  7. name: {
  8. {include "mysql.fullname" .}}-binding
  9. labels:{
  10. {include "mysql.labels" .|nindent 4}}
  11. roleRef:
  12. kind: ClusterRole
  13. name: {
  14. {include "mysql.fullname" .}}-clusterrole
  15. apiGroup: rbac.authorization.k8s.io
  16. subjects:
  17. - kind: ServiceAccount
  18. name: {
  19. {include "mysql.fullname" .}}-sa
  20. namespace: {
  21. {.Release.Namespace}}
  22. {
  23. {- end}}
  24. {
  25. {- if .Values.rbac.create}}
  26. kind: ClusterRole
  27. apiVersion: rbac.authorization.k8s.io/v1
  28. metadata:
  29. name: {
  30. {include "mysql.fullname" .}}-clusterrole
  31. labels:{
  32. {include "mysql.labels" .|nindent 4}}
  33. rules:
  34. - apiGroups: ['policy']
  35. resources: ['podsecuritypolicies']
  36. verbs: ['use']
  37. {
  38. {- end}}
  39. apiVersion: v1
  40. data:
  41. my.cnf: |
  42. [mysqld]
  43. skip-name-resolve
  44. port=3306
  45. innodb_file_per_table = 1
  46. kind: ConfigMap
  47. metadata:
  48. name: {
  49. {include "mysql.fullname" .}}-configmap
  50. labels:{
  51. {include "mysql.labels" .|nindent 4}}
  52. apiVersion: {
  53. {include "deployment.apiVersion" .}}
  54. kind: Deployment
  55. metadata:
  56. name: {
  57. {include "mysql.fullname" .}}
  58. labels:{
  59. {include "mysql.labels" .|nindent 4}}
  60. spec:
  61. progressDeadlineSeconds: {
  62. {.Values.deployment.progressDeadlineSeconds}}
  63. {
  64. {- if .Values.deployment.strategy}}
  65. strategy:{
  66. {toYaml .Values.deployment.strategy|nindent 4}}
  67. {
  68. {- end}}
  69. revisionHistoryLimit: {
  70. {.Values.deployment.revisionHistoryLimit}}
  71. selector:
  72. matchLabels: {
  73. {include "mysql.selectorLabels" .|nindent 6}}
  74. replicas: {
  75. {.Values.deployment.replicaCount}}
  76. template:
  77. metadata:
  78. labels: {
  79. {include "mysql.labels" .|nindent 8}}
  80. spec:
  81. {
  82. {- if .Values.deployment.tolerations}}
  83. tolerations:{
  84. {toYaml .Values.deployment.tolerations|nindent 8}}
  85. {
  86. {- end}}
  87. serviceAccountName: {
  88. {include "mysql.serviceAccountName" .}}
  89. terminationGracePeriodSeconds: {
  90. {.Values.deployment.terminationGracePeriodSeconds}}
  91. containers:
  92. - name: mysql
  93. image: {
  94. {.Values.deployment.image.repository}}:{
  95. {.Values.deployment.image.tag}}
  96. imagePullPolicy: {
  97. {.Values.deployment.image.pullPolicy}}
  98. ports:
  99. - containerPort: 3306
  100. env:
  101. - name: MYSQL_ROOT_PASSWORD
  102. value: {
  103. {.Values.deployment.mysql_root_password|quote}}
  104. {
  105. {- if .Values.deployment.readinessProbe}}
  106. readinessProbe:
  107. exec:
  108. command:
  109. - sh
  110. - -c
  111. - "mysqladmin ping -u root -p${MYSQL_ROOT_PASSWORD}"
  112. initialDelaySeconds: {
  113. {.Values.deployment.readinessProbe.initialDelaySeconds}}
  114. periodSeconds: {
  115. {.Values.deployment.readinessProbe.periodSeconds}}
  116. timeoutSeconds: {
  117. {.Values.deployment.readinessProbe.timeoutSeconds}}
  118. successThreshold: {
  119. {.Values.deployment.readinessProbe.successThreshold}}
  120. failureThreshold: {
  121. {.Values.deployment.readinessProbe.failureThreshold}}
  122. {
  123. {- end}}
  124. {
  125. {- if .Values.deployment.livenessProbe}}
  126. livenessProbe:
  127. exec:
  128. command:
  129. - sh
  130. - -c
  131. - "mysqladmin ping -u root -p${MYSQL_ROOT_PASSWORD}"
  132. initialDelaySeconds: {
  133. {.Values.deployment.livenessProbe.initialDelaySeconds}}
  134. periodSeconds: {
  135. {.Values.deployment.livenessProbe.periodSeconds}}
  136. timeoutSeconds: {
  137. {.Values.deployment.livenessProbe.timeoutSeconds}}
  138. successThreshold: {
  139. {.Values.deployment.livenessProbe.successThreshold}}
  140. failureThreshold: {
  141. {.Values.deployment.livenessProbe.failureThreshold}}
  142. {
  143. {- end}}
  144. {
  145. {- if .Values.deployment.resources}}
  146. resources:{
  147. {toYaml .Values.deployment.resources|nindent 10}}
  148. {
  149. {- end}}
  150. {
  151. {- if .Values.deployment.securityContext}}
  152. securityContext:{
  153. {toYaml .Values.deployment.securityContext|nindent 10}}
  154. {
  155. {- end}}
  156. volumeMounts:
  157. - mountPath: /var/lib/mysql
  158. name: data
  159. - name: configurations
  160. mountPath: /etc/mysql/conf.d/
  161. subPath: mysql.cnf
  162. volumes:
  163. - name: data
  164. persistentVolumeClaim:
  165. claimName: {
  166. {include "mysql.fullname" .}}-pvc
  167. - name: configurations
  168. configMap:
  169. name: {
  170. {include "mysql.fullname" .}}-configmap
  171. {
  172. {/* vim: set filetype=mustache: */}}
  173. {
  174. {/*
  175. Expand the name of the chart.
  176. */}}
  177. {
  178. {- define "mysql.name" -}}
  179. {
  180. {- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
  181. {
  182. {- end -}}
  183. {
  184. {/*
  185. Create a default fully qualified app name.
  186. We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
  187. If release name contains chart name it will be used as a full name.
  188. */}}
  189. {
  190. {- define "mysql.fullname" -}}
  191. {
  192. {- if .Values.fullnameOverride -}}
  193. {
  194. {- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
  195. {
  196. {- else -}}
  197. {
  198. {- $name := default .Chart.Name .Values.nameOverride -}}
  199. {
  200. {- if contains $name .Release.Name -}}
  201. {
  202. {- .Release.Name | trunc 63 | trimSuffix "-" -}}
  203. {
  204. {- else -}}
  205. {
  206. {- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
  207. {
  208. {- end -}}
  209. {
  210. {- end -}}
  211. {
  212. {- end -}}
  213. {
  214. {/*
  215. Create chart name and version as used by the chart label.
  216. */}}
  217. {
  218. {- define "mysql.chart" -}}
  219. {
  220. {- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
  221. {
  222. {- end -}}
  223. {
  224. {/*
  225. Common labels
  226. */}}
  227. {
  228. {- define "mysql.labels" -}}
  229. helm.sh/chart: {
  230. { include "mysql.chart" . }}
  231. {
  232. { include "mysql.selectorLabels" . }}
  233. {
  234. {- if .Chart.AppVersion }}
  235. app.kubernetes.io/version: {
  236. { .Chart.AppVersion | quote }}
  237. {
  238. {- end }}
  239. app.kubernetes.io/managed-by: {
  240. { .Release.Service }}
  241. {
  242. {- end -}}
  243. {
  244. {/*
  245. Selector labels
  246. */}}
  247. {
  248. {- define "mysql.selectorLabels" -}}
  249. app.kubernetes.io/name: {
  250. { include "mysql.name" . }}
  251. app.kubernetes.io/instance: {
  252. { .Release.Name }}
  253. {
  254. {- end -}}
  255. {
  256. {/*
  257. Create the name of the service account to use
  258. */}}
  259. {
  260. {- define "mysql.serviceAccountName" -}}
  261. {
  262. {- if .Values.serviceAccount.create -}}
  263. {
  264. { default (include "mysql.fullname" .) .Values.serviceAccount.name }}
  265. {
  266. {- else -}}
  267. {
  268. { default "default" .Values.serviceAccount.name }}
  269. {
  270. {- end -}}
  271. {
  272. {- end -}}
  273. {
  274. {/*
  275. Return the appropriate apiVersion for deployment.
  276. */}}
  277. {
  278. {- define "deployment.apiVersion" -}}
  279. {
  280. {- if semverCompare ">=1.9-0" .Capabilities.KubeVersion.GitVersion -}}
  281. {
  282. {- print "apps/v1" -}}
  283. {
  284. {- else -}}
  285. {
  286. {- print "extensions/v1beta1" -}}
  287. {
  288. {- end -}}
  289. {
  290. {- end -}}
  291. {
  292. {/*
  293. Return the appropriate apiGroup for PodSecurityPolicy.
  294. */}}
  295. {
  296. {- define "podSecurityPolicy.apiGroup" -}}
  297. {
  298. {- if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
  299. {
  300. {- print "policy" -}}
  301. {
  302. {- else -}}
  303. {
  304. {- print "extensions" -}}
  305. {
  306. {- end -}}
  307. {
  308. {- end -}}
  309. {
  310. {/*
  311. Return the appropriate apiVersion for podSecurityPolicy.
  312. */}}
  313. {
  314. {- define "podSecurityPolicy.apiVersion" -}}
  315. {
  316. {- if semverCompare ">=1.10-0" .Capabilities.KubeVersion.GitVersion -}}
  317. {
  318. {- print "policy/v1beta1" -}}
  319. {
  320. {- else -}}
  321. {
  322. {- print "extensions/v1beta1" -}}
  323. {
  324. {- end -}}
  325. {
  326. {- end -}}
  327. {
  328. {- if .Values.hpa.create}}
  329. apiVersion: autoscaling/v1
  330. kind: HorizontalPodAutoscaler
  331. metadata:
  332. name: {
  333. {include "mysql.fullname" .}}-hpa
  334. labels:{
  335. {include "mysql.labels" .|nindent 4}}
  336. spec:
  337. scaleTargetRef:
  338. apiVersion: {
  339. {include "deployment.apiVersion" .}}
  340. kind: Deployment
  341. name: {
  342. {include "mysql.fullname" .}}
  343. minReplicas: {
  344. {.Values.hpa.minReplicas}}
  345. maxReplicas: {
  346. {.Values.hpa.maxReplicas}}
  347. targetCPUUtilizationPercentage: {
  348. {.Values.hpa.targetCPUUtilizationPercentage}}
  349. {
  350. {- end}}
  351. 1. Get the application URL by running these commands:
  352. {
  353. {- if contains "NodePort" .Values.service.type }}
  354. export NODE_PORT=$(kubectl get --namespace {
  355. { .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {
  356. { include "mysql.fullname" . }})
  357. export NODE_IP=$(kubectl get nodes --namespace {
  358. { .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
  359. echo http://$NODE_IP:$NODE_PORT
  360. {
  361. {- else if contains "LoadBalancer" .Values.service.type }}
  362. NOTE: It may take a few minutes for the LoadBalancer IP to be available.
  363. You can watch the status of by running 'kubectl get --namespace {
  364. { .Release.Namespace }} svc -w {
  365. { include "mysql.fullname" . }}'
  366. export SERVICE_IP=$(kubectl get svc --namespace {
  367. { .Release.Namespace }} {
  368. { include "mysql.fullname" . }} --template "{
  369. {"{
  370. { range (index .status.loadBalancer.ingress 0) }}{
  371. {.}}{
  372. { end }}"}}")
  373. echo http://$SERVICE_IP:{
  374. { .Values.service.port }}
  375. {
  376. {- else if contains "ClusterIP" .Values.service.type }}
  377. export POD_NAME=$(kubectl get pods --namespace {
  378. { .Release.Namespace }} -l "app.kubernetes.io/name={
  379. { include "mysql.name" . }},app.kubernetes.io/instance={
  380. { .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
  381. echo "Visit http://127.0.0.1:8080 to use your application"
  382. kubectl --namespace {
  383. { .Release.Namespace }} port-forward $POD_NAME 8080:80
  384. {
  385. {- end }}
  386. {
  387. {- if and .Values.pdb.create (or (gt (.Values.deployment.replicaCount|int) 1) .Values.hpa.create )}}
  388. apiVersion: policy/v1beta1
  389. kind: PodDisruptionBudget
  390. metadata:
  391. name: {
  392. {include "mysql.fullname" .}}-pdb
  393. labels: {
  394. {include "mysql.labels" .|nindent 4}}
  395. spec:
  396. minAvailable: {
  397. {.Values.pdb.minAvailable}}
  398. selector:
  399. matchLabels:{
  400. {include "mysql.selectorLabels" .|nindent 6}}
  401. {
  402. {- end}}
  403. {
  404. {- if .Values.psp.create}}
  405. apiVersion: {
  406. {include "podSecurityPolicy.apiVersion" .}}
  407. kind: PodSecurityPolicy
  408. metadata:
  409. name: {
  410. {include "mysql.fullname" .}}-psp
  411. labels: {
  412. {include "mysql.labels" .|nindent 4}}
  413. spec:
  414. runAsUser:
  415. rule: 'RunAsAny'
  416. seLinux:
  417. rule: 'RunAsAny'
  418. supplementalGroups:
  419. rule: 'MustRunAs'
  420. ranges:
  421. - min: 1
  422. max: 65535
  423. fsGroup:
  424. rule: 'MustRunAs'
  425. ranges:
  426. - min: 1
  427. max: 65535
  428. volumes:
  429. - 'configMap'
  430. - 'emptyDir'
  431. - 'projected'
  432. - 'secret'
  433. - 'downwardAPI'
  434. - 'persistentVolumeClaim'
  435. {
  436. {- end}}
  437. apiVersion: v1
  438. kind: PersistentVolumeClaim
  439. metadata:
  440. name: {
  441. {include "mysql.fullname" .}}-pvc
  442. labels: {
  443. {include "mysql.labels" .|nindent 4}}
  444. spec:
  445. storageClassName: {
  446. {include "mysql.fullname" .}}-sc
  447. accessModes:{
  448. {toYaml .Values.pvc.accessModes|nindent 2}}
  449. resources:
  450. requests:
  451. storage: {
  452. {.Values.pvc.storage}}
  453. {
  454. {- if .Values.serviceAccount.create}}
  455. apiVersion: v1
  456. kind: ServiceAccount
  457. metadata:
  458. name: {
  459. {include "mysql.fullname" .}}-sa
  460. labels: {
  461. {include "mysql.labels" .|nindent 4}}
  462. {
  463. {- end}}
  464. apiVersion: storage.k8s.io/v1
  465. kind: StorageClass
  466. metadata:
  467. name: {
  468. {include "mysql.fullname" .}}-sc
  469. labels: {
  470. {include "mysql.labels" .|nindent 4}}
  471. provisioner: {
  472. {.Values.sc.provisioner}}
  473. reclaimPolicy: {
  474. {.Values.sc.reclaimPolicy}}
  475. apiVersion: v1
  476. kind: Service
  477. metadata:
  478. name: {
  479. {include "mysql.fullname" .}}-svc
  480. labels: {
  481. {include "mysql.labels" .|nindent 4}}
  482. spec:
  483. selector:{
  484. {include "mysql.selectorLabels" .|nindent 4}}
  485. {
  486. {- if eq .Values.service.type "NodePort"}}
  487. type: NodePort
  488. ports:
  489. - name: tcp
  490. port: 3306
  491. targetPort: 3306
  492. {
  493. {- if .Values.service.nodePort}}
  494. nodePort: {
  495. {.Values.service.nodePort}}
  496. {
  497. {- end}}
  498. {
  499. {- else if eq .Values.service.type "ClusterIP"}}
  500. ports:
  501. - name: tcp
  502. port: 3306
  503. targetPort: 3306
  504. {
  505. {- end}}

发表评论

表情:
评论列表 (有 0 条评论,42人围观)

还没有评论,来说两句吧...

相关阅读

    相关 java_java锁

    手写非公平可重入锁 公平锁:多个线程按照申请锁的顺序去获得锁,线程会直接进入队列去排队,永远都是队列的第一位才能得到锁。 优点:所有的线程都能得到资源,不会饿死在队列中。

    相关 HashMap

    在本文中,将会实现一个简单的HashMap,模拟实现了put、get和到达扩容条件时自动扩容等功能。     1、Map<K,V>接口的定义 public

    相关 识别

    作者:倪屁屁 链接:https://zhuanlan.zhihu.com/p/40431290 来源:知乎 著作权归作者所有。商业转载请联系作者获得授权,非商业转载