-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathk8s.yaml
1019 lines (910 loc) · 37.5 KB
/
k8s.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
---
apiVersion: v1
kind: Service
metadata:
name: apogy-api
namespace: apogy
spec:
ports:
- port: 27666
targetPort: 27666
selector:
app: apogy
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: apogy-api
namespace: apogy
spec:
replicas: 1
selector:
matchLabels:
app: apogy
template:
metadata:
labels:
app: apogy
spec:
containers:
- name: apogy
image: ghcr.io/aep/apogy:v0.0.8
ports:
- containerPort: 27666
args: [ 'server' ]
env:
- name: PD_ENDPOINT
value: "apogy-tikv-pd:2379"
---
apiVersion: pingcap.com/v1alpha1
kind: TidbCluster
metadata:
name: apogy-tikv
namespace: apogy
spec:
#######################
# Basic Configuration #
#######################
## TiDB cluster version
version: "v8.5.0"
## Time zone of TiDB cluster Pods
timezone: UTC
## serviceAccount specifies the service account for PD/TiDB/TiKV/TiFlash/Pump/TiCDC components in this TidbCluster
# serviceAccount: advanced-tidb
## ConfigUpdateStrategy determines how the configuration change is applied to the cluster.
## Valid values are `InPlace` and `RollingUpdate`
## UpdateStrategy `InPlace` will update the ConfigMap of configuration in-place and an extra rolling update of the
## cluster component is needed to reload the configuration change.
## UpdateStrategy `RollingUpdate` will create a new ConfigMap with the new configuration and rolling update the
## related components to use the new ConfigMap, that is, the new configuration will be applied automatically.
configUpdateStrategy: RollingUpdate
## ImagePullPolicy of TiDB cluster Pods
## Ref: https://kubernetes.io/docs/concepts/configuration/overview/#container-images
# imagePullPolicy: IfNotPresent
## If private registry is used, imagePullSecrets may be set
## You can also set this in service account
## Ref: https://kubernetes.io/docs/concepts/containers/images/#specifying-imagepullsecrets-on-a-pod
# imagePullSecrets:
# - name: secretName
## Image used to do miscellaneous tasks as sidecar container, such as:
## - execute sysctls when PodSecurityContext is set for some components, requires `sysctl` installed
## - tail slow log for tidb, requires `tail` installed
## - fill tiflash config template file based on pod ordinal
helper:
image: alpine:3.16.0
# imagePullPolicy: IfNotPresent
## Enable PVC/PV reclaim for orphan PVC/PV left by statefulset scale-in.
## When set to `true`, PVC/PV that are not used by any tidb cluster pods will be deleted automatically.
# enablePVReclaim: false
## Persistent volume reclaim policy applied to the PV consumed by the TiDB cluster, default to `Retain`.
## Note that the reclaim policy Recycle may not be supported by some storage types, e.g. local.
## Ref: https://kubernetes.io/docs/tasks/administer-cluster/change-pv-reclaim-policy/
#pvReclaimPolicy: Retain
##########################
# Advanced Configuration #
##########################
## when deploying a heterogeneous TiDB cluster, you MUST specify the cluster name to join here
# cluster:
# namespace: default
# name: tidb-cluster-to-join
# clusterDomain: cluster.local
## specifying pdAddresses will make PD in this TiDB cluster to join another existing PD cluster
## PD will then start with arguments --join= instead of --initial-cluster=
# pdAddresses:
# - http://cluster1-pd-0.cluster1-pd-peer.default.svc:2379
# - http://cluster1-pd-1.cluster1-pd-peer.default.svc:2379
## Enable mutual TLS connection between TiDB cluster components
## Ref: https://docs.pingcap.com/tidb-in-kubernetes/stable/enable-tls-between-components/
# tlsCluster:
# enabled: true
## Annotations of TiDB cluster pods, will be merged with component annotation settings.
# annotations:
# node.kubernetes.io/instance-type: some-vm-type
# topology.kubernetes.io/region: some-region
## NodeSelector of TiDB cluster pods, will be merged with component nodeSelector settings.
## Ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/
# nodeSelector:
# node-role.kubernetes.io/tidb: true
## Tolerations are applied to TiDB cluster pods, allowing (but do not require) pods to be scheduled onto nodes with matching taints.
## This cluster-level `tolerations` only takes effect when no component-level `tolerations` are set.
## e.g. if `pd.tolerations` is not empty, `tolerations` here will be ignored.
## Ref: https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/
# tolerations:
# - effect: NoSchedule
# key: dedicated
# operator: Equal
# value: tidb
## Use the node network namespace, default to false
## Ref: https://kubernetes.io/docs/concepts/policy/pod-security-policy/#host-namespaces
# hostNetwork: false
## specify resource requirements for discovery deployment
# discovery:
# requests:
# cpu: 1000m
# memory: 256Mi
# limits:
# cpu: 2000m
# memory: 1Gi
# ## The following block overwrites TiDB cluster-level configurations in `spec`
# imagePullPolicy: IfNotPresent
# imagePullSecrets: secretName
# hostNetwork: false
# priorityClassName: system-cluster-critical
# schedulerName: default-scheduler
# nodeSelector:
# app.kubernetes.io/component: discovery
# annotations:
# node.kubernetes.io/instance-type: some-vm-type
# labels: {}
# env:
# - name: MY_ENV_1
# value: value1
# affinity: {}
# tolerations:
# - effect: NoSchedule
# key: dedicated
# operator: Equal
# value: discovery
## if true, this tidb cluster is paused and will not be synced by the controller
# paused: false
## SchedulerName of TiDB cluster pods.
## If specified, the pods will be scheduled by the specified scheduler.
## Can be overwritten by component settings.
# schedulerName: default-scheduler
## PodManagementPolicy default `OrderedReady` for Pump
## and default `Parallel` for the other components.
## Ref: https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/#pod-management-policies
# podManagementPolicy: Parallel
## Affinity for pod scheduling, will be overwritten by each cluster component's specific affinity setting
## Can refer to PD/TiDB/TiKV affinity settings, and ensure only cluster-scope general settings here
## Ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity
# affinity: {}
## Specify pod priorities of pods in TidbCluster, default to empty.
## Can be overwritten by component settings.
## Ref: https://kubernetes.io/docs/concepts/configuration/pod-priority-preemption/
# priorityClassName: system-cluster-critical
## If set to `true`, `--advertise-status-addr` will be appended to the startup parameters of TiKV
enableDynamicConfiguration: true
## Set update strategy of StatefulSet, can be overwritten by the setting of each component.
## defaults to RollingUpdate
## Ref: https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/#update-strategies
# statefulSetUpdateStrategy: RollingUpdate
## The identifier of the Pod will be `$(podName).$(serviceName).$(namespace).svc.$(clusterDomain)` when `clusterDomain` is set.
## Set this in the case where a TiDB cluster is deployed across multiple Kubernetes clusters. default to empty.
# clusterDomain: cluster.local
## TopologySpreadConstraints for pod scheduling, will be overwritten by each cluster component's specific spread constraints setting
## Can refer to PD/TiDB/TiKV/TiCDC/TiFlash/Pump topologySpreadConstraints settings, and ensure only cluster-scope general settings here
## Ref: pkg/apis/pingcap/v1alpha1/types.go#TopologySpreadConstraint
# topologySpreadConstraints:
# - topologyKey: topology.kubernetes.io/zone
# maxSkew: 1
# minDomains: 3
# nodeAffinityPolicy: Honor
###########################
# TiDB Cluster Components #
###########################
pd:
##########################
# Basic PD Configuration #
##########################
## Base image of the component
baseImage: pingcap/pd
## pd-server configuration
## Ref: https://docs.pingcap.com/tidb/stable/pd-configuration-file
config: |
[dashboard]
internal-proxy = true
## The desired replicas
replicas: 3
## max inprogress failover PD pod counts
maxFailoverCount: 0
## describes the compute resource requirements and limits.
## Ref: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/
requests:
# cpu: 1000m
# memory: 1Gi
storage: 10Gi
# limits:
# cpu: 2000m
# memory: 2Gi
## defines Kubernetes service for pd-server
## Ref: https://kubernetes.io/docs/concepts/services-networking/service/
# service:
# type: ClusterIP
# annotations:
# foo: bar
# portName: client
#############################
# Advanced PD Configuration #
#############################
## The following block overwrites TiDB cluster-level configurations in `spec`
# version: "v8.5.0"
# imagePullPolicy: IfNotPresent
# imagePullSecrets:
# - name: secretName
# hostNetwork: false
# serviceAccount: advanced-tidb-pd
# priorityClassName: system-cluster-critical
# schedulerName: default-scheduler
# nodeSelector:
# app.kubernetes.io/component: pd
# annotations:
# node.kubernetes.io/instance-type: some-vm-type
# tolerations:
# - effect: NoSchedule
# key: dedicated
# operator: Equal
# value: pd
# configUpdateStrategy: RollingUpdate
# statefulSetUpdateStrategy: RollingUpdate
## List of environment variables to set in the container
## Note that the following env names cannot be used and will be overwritten by TiDB Operator builtin envs
## - NAMESPACE
## - TZ
## - SERVICE_NAME
## - PEER_SERVICE_NAME
## - HEADLESS_SERVICE_NAME
## - SET_NAME
## - HOSTNAME
## - CLUSTER_NAME
## - POD_NAME
## - BINLOG_ENABLED
## - SLOW_LOG_FILE
## Ref: https://kubernetes.io/docs/tasks/inject-data-application/environment-variable-expose-pod-information/
# env:
# - name: MY_ENV_1
# value: value1
# - name: MY_ENV_2
# valueFrom:
# fieldRef:
# fieldPath: status.myEnv2
## Custom sidecar containers can be injected into the PD pods,
## which can act as a logging/tracing agent or for any other use case
# additionalContainers:
# - name: myCustomContainer
# image: ubuntu
## custom additional volumes in PD pods
# additionalVolumes:
# # specify volume types that are supported by Kubernetes, Ref: https://kubernetes.io/docs/concepts/storage/persistent-volumes/#types-of-persistent-volumes
# - name: nfs
# nfs:
# server: 192.168.0.2
# path: /nfs
## custom additional volume mounts in PD pods
# additionalVolumeMounts:
# # this must match `name` in `additionalVolumes`
# - name: nfs
# mountPath: /nfs
## Optional duration in seconds the pod needs to terminate gracefully. May be decreased in delete request.
## Ref: https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#hook-handler-execution
# terminationGracePeriodSeconds: 30
## PodSecurityContext holds pod-level security attributes and common container settings.
## Ref: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/
# podSecurityContext:
# sysctls:
# - name: net.core.somaxconn
# value: "32768"
## when TLS cluster feature is enabled, TiDB Operator will automatically mount the cluster client certificates if mountClusterClientSecret is set to true
## Defaults to false
## Ref: https://docs.pingcap.com/tidb-in-kubernetes/stable/configure-a-tidb-cluster#mountclusterclientsecret
mountClusterClientSecret: true
## The storageClassName of the persistent volume for PD data storage.
storageClassName: "lv"
## defines additional volumes for which PVCs will be created by StatefulSet controller
# storageVolumes:
# # this will be suffix of PVC names in VolumeClaimTemplates of PD StatefulSet
# - name: volumeName
# # specify this to use special storageClass for this volume, default to component-level `storageClassName`
# storageClassName: local-storage
# # storage request of PVC
# storageSize: 1Gi
# # mount path of the PVC
# mountPath: /some/path
## Subdirectory within the volume to store PD Data. By default, the data
## is stored in the root directory of volume which is mounted at
## /var/lib/pd. Specifying this will change the data directory to a subdirectory,
## e.g. /var/lib/pd/data if you set the value to "data".
## It's dangerous to change this value for a running cluster as it will
## upgrade your cluster to use a new storage directory.
## Defaults to "" (volume's root).
# dataSubDir: ""
## Affinity for pod scheduling
## Ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity
# affinity:
# podAntiAffinity:
# # prefer not to run pd pods on the same node which runs tidb/tikv pods
# preferredDuringSchedulingIgnoredDuringExecution:
# - podAffinityTerm:
# labelSelector:
# matchExpressions:
# - key: app.kubernetes.io/component
# operator: In
# values:
# - tidb
# - tikv
# topologyKey: kubernetes.io/hostname
# weight: 100
# # require not to run PD pods on nodes where there's already a PD pod running
# # if setting this, you must ensure that at least `replicas` nodes are available in the cluster
# requiredDuringSchedulingIgnoredDuringExecution:
# - labelSelector:
# matchExpressions:
# - key: app.kubernetes.io/component
# operator: In
# values:
# - pd
# topologyKey: kubernetes.io/hostname
## set a different tidb client TLS cert secret name for TiDB Dashboard than the default ${clusterName}-tidb-client-secret
## only useful when TLS is enabled for TiDB server
## Ref: https://docs.pingcap.com/tidb-in-kubernetes/stable/enable-tls-for-mysql-client
# tlsClientSecretName: custom-tidb-client-secret-name
## TopologySpreadConstraints for pod scheduling, will overwrite cluster level spread constraints setting
## Ref: pkg/apis/pingcap/v1alpha1/types.go#TopologySpreadConstraint
# topologySpreadConstraints:
# - topologyKey: topology.kubernetes.io/zone
# maxSkew: 1
# minDomains: 3
# nodeAffinityPolicy: Honor
tidb:
############################
# Basic TiDB Configuration #
############################
## Base image of the component
baseImage: pingcap/tidb
## tidb-server Configuration
## Ref: https://docs.pingcap.com/tidb/stable/tidb-configuration-file
config: |
[performance]
tcp-keep-alive = true
## The desired replicas
replicas: 0
## max inprogress failover TiDB pod counts
maxFailoverCount: 0
## describes the compute resource requirements.
## Ref: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/
# requests:
# cpu: 1000m
# memory: 1Gi
# limits:
# cpu: 2000m
# memory: 2Gi
## defines Kubernetes service for tidb-server
## If you are in a public cloud environment, you can use cloud LoadBalancer to access the TiDB service
## if you are in a private cloud environment, you can use Ingress or NodePort, or ClusterIP and port forward (only for development/test)
## you can set mysqlNodePort and statusNodePort to expose server/status service to the given NodePort
service:
type: NodePort
# Ref: https://kubernetes.io/docs/tasks/access-application-cluster/create-external-load-balancer/#preserving-the-client-source-ip
externalTrafficPolicy: Local
# # which NodePort to expose 4000 (mysql) port of tidb-server, only effective when type=LoadBalancer/NodePort
# mysqlNodePort: 30020
# # whether to export the status port, defaults to true
# exposeStatus: true
# # which NodePort to expose 10080 (status) port of tidb-server, only effective when type=LoadBalancer/NodePort and exposeStatus=true
# statusNodePort: 30040
###############################
# Advanced TiDB Configuration #
###############################
## The following block overwrites TiDB cluster-level configurations in `spec`
# version: "v8.5.0"
# imagePullPolicy: IfNotPresent
# imagePullSecrets:
# - name: secretName
# hostNetwork: false
# serviceAccount: advanced-tidb-tidb
# priorityClassName: system-cluster-critical
# schedulerName: default-scheduler
# nodeSelector:
# app.kubernetes.io/component: tidb
# annotations:
# node.kubernetes.io/instance-type: some-vm-type
# tolerations:
# - effect: NoSchedule
# key: dedicated
# operator: Equal
# value: tidb
# configUpdateStrategy: RollingUpdate
# statefulSetUpdateStrategy: RollingUpdate
## List of environment variables to set in the container
## Note that the following env names cannot be used and will be overwritten by TiDB Operator builtin envs
## - NAMESPACE
## - TZ
## - SERVICE_NAME
## - PEER_SERVICE_NAME
## - HEADLESS_SERVICE_NAME
## - SET_NAME
## - HOSTNAME
## - CLUSTER_NAME
## - POD_NAME
## - BINLOG_ENABLED
## - SLOW_LOG_FILE
## Ref: https://kubernetes.io/docs/tasks/inject-data-application/environment-variable-expose-pod-information/
# env:
# - name: MY_ENV_1
# value: value1
# - name: MY_ENV_2
# valueFrom:
# fieldRef:
# fieldPath: status.myEnv2
## Custom sidecar containers can be injected into the TiDB pods,
## which can act as a logging/tracing agent or for any other use case
# additionalContainers:
# - name: myCustomContainer
# image: ubuntu
## custom additional volumes in TiDB pods
# additionalVolumes:
# # specify volume types that are supported by Kubernetes, Ref: https://kubernetes.io/docs/concepts/storage/persistent-volumes/#types-of-persistent-volumes
# - name: nfs
# nfs:
# server: 192.168.0.2
# path: /nfs
## custom additional volume mounts in TiDB pods
# additionalVolumeMounts:
# # this must match `name` in `additionalVolumes`
# - name: nfs
# mountPath: /nfs
## Optional duration in seconds the pod needs to terminate gracefully. May be decreased in delete request.
## Ref: https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#hook-handler-execution
# terminationGracePeriodSeconds: 30
## PodSecurityContext holds pod-level security attributes and common container settings.
## Ref: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/
# podSecurityContext:
# sysctls:
# - name: net.ipv4.tcp_keepalive_time
# value: "300"
# - name: net.ipv4.tcp_keepalive_intvl
# value: "75"
# - name: net.core.somaxconn
# value: "32768"
## prob tidb-server readiness
## valid type values:
## - `tcp`, which uses Kubernetes TCPSocketAction to prob the 4000 tcp port of the pod
## - `command`, which uses curl to access the /status path on port 10080 of the pod
## This is supported from TiDB Operator v1.1.7
# readinessProbe:
# # The `command` type is only supported after tidb v4.0.9, ref: https://github.com/pingcap/tidb/pull/20694
# type: command
## when enabled, TiDB will accept TLS encrypted connections from MySQL client
## Ref: https://docs.pingcap.com/tidb-in-kubernetes/stable/enable-tls-for-mysql-client
# tlsClient:
# enabled: true
# disableClientAuthn: false
# skipInternalClientCA: false
## binlogEnabled will automatically be true if Pump is enabled, otherwise false
## set this manually only if you really know what you are doing
## MANUAL CONFIG NOT RECOMMENDED
# binlogEnabled: false
## if enabled, the slow log will be shown in a separate sidecar container
# separateSlowLog: true
# slowLogVolumeName: ""
## configures separate sidecar container, where `image` & `imagePullPolicy` will be overwritten by
## the same field in `TidbCluster.helper`
# slowLogTailer:
# requests:
# cpu: 1000m
# memory: 1Gi
# limits:
# cpu: 2000m
# memory: 2Gi
# image: busybox
# imagePullPolicy: IfNotPresent
## The storageClassName of the persistent volume for TiDB data storage.
# storageClassName: ""
## defines additional volumes for which PVCs will be created by StatefulSet controller
# storageVolumes:
# # this will be suffix of PVC names in VolumeClaimTemplates of TiDB StatefulSet
# - name: volumeName
# # specify this to use special storageClass for this volume, default to component-level `storageClassName`
# storageClassName: local-storage
# # storage request of PVC
# storageSize: 1Gi
# # mount path of the PVC
# mountPath: /some/path
## config Kubernetes container lifecycle hooks for tidb-server pods
## Ref: https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/
# lifecycle:
# postStart:
# exec:
# command:
# - echo
# - "postStart"
# preStop:
# exec:
# command:
# - echo
# - "preStop"
## Affinity for pod scheduling
## Ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity
# affinity:
# podAntiAffinity:
# preferredDuringSchedulingIgnoredDuringExecution:
# - podAffinityTerm:
# labelSelector:
# matchExpressions:
# - key: app.kubernetes.io/component
# operator: In
# values:
# - pd
# - tikv
# topologyKey: kubernetes.io/hostname
# weight: 100
# # require not to run TiDB pods on nodes where there's already a TiDB pod running
# # if setting this, you must ensure that at least `replicas` nodes are available in the cluster
# requiredDuringSchedulingIgnoredDuringExecution:
# - labelSelector:
# matchExpressions:
# - key: app.kubernetes.io/component
# operator: In
# values:
# - tidb
# topologyKey: kubernetes.io/hostname
## TopologySpreadConstraints for pod scheduling, will overwrite cluster level spread constraints setting
## Ref: pkg/apis/pingcap/v1alpha1/types.go#TopologySpreadConstraint
# topologySpreadConstraints:
# - topologyKey: topology.kubernetes.io/zone
# maxSkew: 1
# minDomains: 3
# nodeAffinityPolicy: Honor
tikv:
############################
# Basic TiKV Configuration #
############################
## Base image of the component
baseImage: pingcap/tikv
## tikv-server configuration
## Ref: https://docs.pingcap.com/tidb/stable/tikv-configuration-file
config: |
log-level = "info"
## The desired replicas
replicas: 3
## max inprogress failover TiKV pod counts
maxFailoverCount: 0
## describes the compute resource requirements.
## Ref: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/
requests:
# cpu: 1000m
# memory: 1Gi
storage: 100Gi
# limits:
# cpu: 2000m
# memory: 2Gi
# # settings `storage` here will add `--capacity` arg to tikv-server
# storage: 10Gi
###############################
# Advanced TiKV Configuration #
###############################
## The following block overwrites TiDB cluster-level configurations in `spec`
# version: "v8.5.0"
# imagePullPolicy: IfNotPresent
# imagePullSecrets:
# - name: secretName
# hostNetwork: false
# serviceAccount: advanced-tidb-tikv
# priorityClassName: system-cluster-critical
# schedulerName: default-scheduler
# nodeSelector:
# app.kubernetes.io/component: tikv
# annotations:
# node.kubernetes.io/instance-type: some-vm-type
# tolerations:
# - effect: NoSchedule
# key: dedicated
# operator: Equal
# value: tikv
# configUpdateStrategy: RollingUpdate
# statefulSetUpdateStrategy: RollingUpdate
## List of environment variables to set in the container
## Note that the following env names cannot be used and will be overwritten by TiDB Operator builtin envs
## - NAMESPACE
## - TZ
## - SERVICE_NAME
## - PEER_SERVICE_NAME
## - HEADLESS_SERVICE_NAME
## - SET_NAME
## - HOSTNAME
## - CLUSTER_NAME
## - POD_NAME
## - BINLOG_ENABLED
## - SLOW_LOG_FILE
## Ref: https://kubernetes.io/docs/tasks/inject-data-application/environment-variable-expose-pod-information/
# env:
# - name: MY_ENV_1
# value: value1
# - name: MY_ENV_2
# valueFrom:
# fieldRef:
# fieldPath: status.myEnv2
## Custom sidecar containers can be injected into the TiKV pods,
## which can act as a logging/tracing agent or for any other use case
# additionalContainers:
# - name: myCustomContainer
# image: ubuntu
## custom additional volumes in TiKV pods
# additionalVolumes:
# # specify volume types that are supported by Kubernetes, Ref: https://kubernetes.io/docs/concepts/storage/persistent-volumes/#types-of-persistent-volumes
# - name: nfs
# nfs:
# server: 192.168.0.2
# path: /nfs
## custom additional volume mounts in TiKV pods
# additionalVolumeMounts:
# # this must match `name` in `additionalVolumes`
# - name: nfs
# mountPath: /nfs
## Optional duration in seconds the pod needs to terminate gracefully. May be decreased in delete request.
## Ref: https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#hook-handler-execution
# terminationGracePeriodSeconds: 30
## PodSecurityContext holds pod-level security attributes and common container settings.
## Ref: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/
# podSecurityContext:
# sysctls:
# - name: net.ipv4.tcp_keepalive_time
# value: "300"
# - name: net.ipv4.tcp_keepalive_intvl
# value: "75"
# - name: net.core.somaxconn
# value: "32768"
## when TLS cluster feature is enabled, TiDB Operator will automatically mount the cluster client certificates if mountClusterClientSecret is set to true
## Defaults to false
## Ref: https://docs.pingcap.com/tidb-in-kubernetes/stable/configure-a-tidb-cluster#mountclusterclientsecret
mountClusterClientSecret: true
## if enabled, the RocksDB log will be shown in a separate sidecar container
# separateRocksDBLog: true
## rocksDBLogVolumeName is only applicable when separateRocksDBLog is enabled.
## if separateRocksDBLog is enabled, rocksDBLogVolumeName can be set or not.
## if rocksDBLogVolumeName is not set, the rocksdb log is saved in the PV of TiKV data, which may increase the IO pressure of the data disk.
## if rocksDBLogVolumeName is set, rocksDBLogVolumeName should be defined in storageVolumes or additionalVolumes to use another PV.
## you may need to change the `rocksdb.info-log-dir` to save the logs in the separate PV.
## Ref: https://github.com/tikv/tikv/blob/master/etc/config-template.toml
# rocksDBLogVolumeName: ""
## if enabled, the Raft log will be shown in a separate sidecar container
# separateRaftLog: true
## raftLogVolumeName is only applicable when separateRaftLog is enabled.
## if separateRaftLog is enabled, raftLogVolumeName can be set or not.
## if raftLogVolumeName is not set, the separated raftdb log is saved in the PV of TiKV data, which may increase the IO pressure of the data disk.
## if raftLogVolumeName is set, raftLogVolumeName should be defined in storageVolumes or additionalVolumes to use another PV.
## you may need to change the `raftdb.info-log-dir` to save the logs in the separate PV.
## Ref: https://github.com/tikv/tikv/blob/master/etc/config-template.toml
# raftLogVolumeName: ""
## configures RocksDB/Raft log sidecar container resource requirements
# logTailer:
# requests:
# cpu: 1000m
# memory: 1Gi
# limits:
# cpu: 2000m
# memory: 2Gi
## The storageClassName of the persistent volume for TiKV data storage.
# storageClassName: ""
## defines additional volumes for which PVCs will be created by StatefulSet controller
# storageVolumes:
# # this will be suffix of PVC names in VolumeClaimTemplates of TiKV StatefulSet
# - name: volumeName
# # specify this to use special storageClass for this volume, default to component-level `storageClassName`
# storageClassName: local-storage
# # storage request of PVC
# storageSize: 1Gi
# # mount path of the PVC
# mountPath: /some/path
## run TiKV container in privileged mode
## Processes in privileged containers are essentially equivalent to root on the host
## NOT RECOMMENDED in production environment
## Ref: https://kubernetes.io/docs/concepts/policy/pod-security-policy/#privileged
# privileged: false
## if set to true, TiDB Operator will recover newly created TiKV pods due to automatic failover
# recoverFailover: true
## Subdirectory within the volume to store TiKV Data. By default, the data
## is stored in the root directory of volume which is mounted at /var/lib/tikv.
## Specifying this will change the data directory to a subdirectory, e.g.
## /var/lib/tikv/data if you set the value to "data".
## It's dangerous to change this value for a running cluster as it will
## upgrade your cluster to use a new storage directory.
## Defaults to "" (volume's root).
# dataSubDir: ""
## defines the timeout for region leader eviction in golang `Duration` format, if raft region leaders are not transferred to other stores after this duration, TiDB Operator will delete the Pod forcibly.
# evictLeaderTimeout: 3m
## Affinity for pod scheduling
## Ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity
# affinity:
# podAntiAffinity:
# preferredDuringSchedulingIgnoredDuringExecution:
# - podAffinityTerm:
# labelSelector:
# matchExpressions:
# - key: app.kubernetes.io/component
# operator: In
# values:
# - tidb
# - pd
# topologyKey: kubernetes.io/hostname
# weight: 100
# # require not to run TiKV pods on nodes where there's already a TiKV pod running
# # if setting this, you must ensure that at least `replicas` nodes are available in the cluster
# requiredDuringSchedulingIgnoredDuringExecution:
# - labelSelector:
# matchExpressions:
# - key: app.kubernetes.io/component
# operator: In
# values:
# - tikv
# topologyKey: kubernetes.io/hostname
## TopologySpreadConstraints for pod scheduling, will overwrite cluster level spread constraints setting
## Ref: pkg/apis/pingcap/v1alpha1/types.go#TopologySpreadConstraint
# topologySpreadConstraints:
# - topologyKey: topology.kubernetes.io/zone
# maxSkew: 1
# minDomains: 3
# nodeAffinityPolicy: Honor
## Deploy TiDB Binlog of a TiDB cluster
## Ref: https://docs.pingcap.com/tidb-in-kubernetes/stable/deploy-tidb-binlog/#deploy-pump
# pump:
# baseImage: pingcap/tidb-binlog
# version: "v8.5.0"
# replicas: 1
# storageClassName: local-storage
# requests:
# cpu: 1000m
# memory: 1Gi
# storage: 1Gi
# limits:
# cpu: 2000m
# memory: 2Gi
# imagePullPolicy: IfNotPresent
# imagePullSecrets:
# - name: secretName
# hostNetwork: false
# serviceAccount: advanced-tidb-pump
# priorityClassName: system-cluster-critical
# schedulerName: default-scheduler
# nodeSelector:
# app.kubernetes.io/component: pump
# annotations:
# node.kubernetes.io/instance-type: some-vm-type
# tolerations: []
# configUpdateStrategy: RollingUpdate
# statefulSetUpdateStrategy: RollingUpdate
# podSecurityContext: {}
# env: []
# additionalContainers: []
# additionalVolumes: []
# additionalVolumeMounts: []
# terminationGracePeriodSeconds: 30
# # Ref: https://docs.pingcap.com/tidb/stable/tidb-binlog-configuration-file#pump
# config: |
# gc = 7
# # TopologySpreadConstraints for pod scheduling, will overwrite cluster level spread constraints setting
# # Ref: pkg/apis/pingcap/v1alpha1/types.go#TopologySpreadConstraint
# topologySpreadConstraints:
# - topologyKey: topology.kubernetes.io/zone
# maxSkew: 1
# minDomains: 3
# nodeAffinityPolicy: Honor
## TiCDC is a tool for replicating the incremental data of TiDB
## Ref: https://docs.pingcap.com/tidb-in-kubernetes/stable/deploy-ticdc/
# ticdc:
# baseImage: pingcap/ticdc
# version: "v8.5.0"
# replicas: 3
# storageClassName: local-storage
# requests:
# cpu: 1000m
# memory: 1Gi
# limits:
# cpu: 2000m
# memory: 2Gi
# imagePullPolicy: IfNotPresent
# imagePullSecrets:
# - name: secretName
# hostNetwork: false
# serviceAccount: advanced-tidb-ticdc
# priorityClassName: system-cluster-critical
# schedulerName: default-scheduler
# nodeSelector:
# app.kubernetes.io/component: ticdc
# annotations:
# node.kubernetes.io/instance-type: some-vm-type
# tolerations: []
# configUpdateStrategy: RollingUpdate
# statefulSetUpdateStrategy: RollingUpdate
# podSecurityContext: {}
# env: []
# additionalContainers: []
# storageVolumes: []
# additionalVolumes: []
# additionalVolumeMounts: []
# terminationGracePeriodSeconds: 30
# config: |
# gc-ttl = 86400
# log-level = "info"
# log-file = ""
# # TopologySpreadConstraints for pod scheduling, will overwrite cluster level spread constraints setting
# # Ref: pkg/apis/pingcap/v1alpha1/types.go#TopologySpreadConstraint
# topologySpreadConstraints:
# - topologyKey: topology.kubernetes.io/zone
# maxSkew: 1
# minDomains: 3
# nodeAffinityPolicy: Honor
## TiFlash is the columnar storage extension of TiKV
## Ref: https://docs.pingcap.com/tidb-in-kubernetes/stable/deploy-tiflash/
# tiflash:
# ###############################
# # Basic TiFlash Configuration #
# ###############################
# baseImage: pingcap/tiflash
# version: "v8.5.0"
# replicas: 1
# # limits:
# # cpu: 2000m
# # memory: 2Gi
# imagePullPolicy: IfNotPresent
# imagePullSecrets:
# - name: secretName
# ##################################
# # Advanced TiFlash Configuration #
# ##################################
# maxFailoverCount: 0
# hostNetwork: false
# serviceAccount: advanced-tidb-tiflash
# priorityClassName: system-cluster-critical
# schedulerName: default-scheduler
# nodeSelector:
# app.kubernetes.io/component: tiflash
# annotations:
# node.kubernetes.io/instance-type: some-vm-type
# tolerations: []
# configUpdateStrategy: RollingUpdate
# statefulSetUpdateStrategy: RollingUpdate
# podSecurityContext: {}
# env: []
# additionalContainers: []
# additionalVolumes: []
# additionalVolumeMounts: []
# terminationGracePeriodSeconds: 30
# storageClaims:
# - resources:
# requests:
# # specify PVC storage used for TiFlash
# storage: 1Gi
# # specify PVC storage class
# storageClassName: local-storage
# # run TiFlash container in privileged mode
# # Processes in privileged containers are essentially equivalent to root on the host
# # NOT RECOMMENDED in production environment
# # Ref: https://kubernetes.io/docs/concepts/policy/pod-security-policy/#privileged
# privileged: false
# # if set to true, TiDB Operator will recover newly created TiFlash pods due to automatic failover
# recoverFailover: true
# # configures serverlog/errorlog/clusterlog sidecar container resource requirements
# # logTailer:
# # requests:
# # cpu: 1000m
# # memory: 1Gi
# # limits:
# # cpu: 2000m
# # memory: 2Gi
# # configures init container resource requirements
# initializer:
# requests:
# cpu: 1000m
# memory: 1Gi
# limits:
# cpu: 2000m
# memory: 2Gi