Skip to content

Commit 6a7aea9

Browse files
stephenlthornti-chi-bot[bot]csuzhangxc
authored
Update examples (#6183)
Co-authored-by: ti-chi-bot[bot] <108142056+ti-chi-bot[bot]@users.noreply.github.com> Co-authored-by: Cody (Xuecheng) Zhang <[email protected]>
1 parent 4958aac commit 6a7aea9

27 files changed

+2825
-0
lines changed

examples/Runbooks/AKS/md-sc.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
kind: StorageClass
2+
apiVersion: storage.k8s.io/v1
3+
metadata:
4+
name: pd-custom
5+
provisioner: kubernetes.io/gce-pd
6+
volumeBindingMode: WaitForFirstConsumer
7+
allowVolumeExpansion: true
8+
parameters:
9+
type: pd-ssd
10+
mountOptions:
11+
- nodelalloc
12+
- noatime
Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
apiVersion: pingcap.com/v1alpha1
2+
kind: TidbCluster
3+
metadata:
4+
name: basic
5+
spec:
6+
version: v8.5.0
7+
timezone: UTC
8+
configUpdateStrategy: RollingUpdate
9+
pvReclaimPolicy: Retain
10+
enableDynamicConfiguration: true
11+
schedulerName: default-scheduler
12+
topologySpreadConstraints:
13+
- topologyKey: topology.kubernetes.io/zone
14+
helper:
15+
image: alpine:3.16.0
16+
pd:
17+
baseImage: pingcap/pd
18+
maxFailoverCount: 0
19+
replicas: 3
20+
requests:
21+
storage: "10Gi"
22+
config: |
23+
[dashboard]
24+
internal-proxy = true
25+
[replication]
26+
location-labels = ["topology.kubernetes.io/zone", "kubernetes.io/hostname"]
27+
max-replicas = 3
28+
nodeSelector:
29+
dedicated: pd
30+
tolerations:
31+
- effect: NoSchedule
32+
key: dedicated
33+
operator: Equal
34+
value: pd
35+
affinity:
36+
podAntiAffinity:
37+
requiredDuringSchedulingIgnoredDuringExecution:
38+
- labelSelector:
39+
matchExpressions:
40+
- key: app.kubernetes.io/component
41+
operator: In
42+
values:
43+
- pd
44+
topologyKey: kubernetes.io/hostname
45+
tikv:
46+
baseImage: pingcap/tikv
47+
maxFailoverCount: 0
48+
replicas: 3
49+
requests:
50+
storage: "100Gi"
51+
annotations:
52+
tidb.pingcap.com/sysctl-init: "true"
53+
podSecurityContext:
54+
sysctls:
55+
- name: net.core.somaxconn
56+
value: "32768"
57+
config: {}
58+
nodeSelector:
59+
dedicated: tikv
60+
tolerations:
61+
- effect: NoSchedule
62+
key: dedicated
63+
operator: Equal
64+
value: tikv
65+
affinity:
66+
podAntiAffinity:
67+
requiredDuringSchedulingIgnoredDuringExecution:
68+
- labelSelector:
69+
matchExpressions:
70+
- key: app.kubernetes.io/component
71+
operator: In
72+
values:
73+
- tikv
74+
topologyKey: kubernetes.io/hostname
75+
tidb:
76+
baseImage: pingcap/tidb
77+
maxFailoverCount: 0
78+
replicas: 2
79+
service:
80+
annotations:
81+
cloud.google.com/load-balancer-type: "Internal"
82+
exposeStatus: true
83+
externalTrafficPolicy: Local
84+
type: LoadBalancer
85+
config: |
86+
[performance]
87+
tcp-keep-alive = true
88+
annotations:
89+
tidb.pingcap.com/sysctl-init: "true"
90+
podSecurityContext:
91+
sysctls:
92+
- name: net.ipv4.tcp_keepalive_time
93+
value: "300"
94+
- name: net.ipv4.tcp_keepalive_intvl
95+
value: "75"
96+
- name: net.core.somaxconn
97+
value: "32768"
98+
separateSlowLog: true
99+
nodeSelector:
100+
dedicated: tidb
101+
tolerations:
102+
- effect: NoSchedule
103+
key: dedicated
104+
operator: Equal
105+
value: tidb
106+
affinity:
107+
podAntiAffinity:
108+
requiredDuringSchedulingIgnoredDuringExecution:
109+
- labelSelector:
110+
matchExpressions:
111+
- key: app.kubernetes.io/component
112+
operator: In
113+
values:
114+
- tidb
115+
topologyKey: kubernetes.io/hostname

examples/Runbooks/AKS/readme.md

Lines changed: 158 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,158 @@
1+
# Table of Contents
2+
1. [AKS Pre-reqs](#aks-pre-reqs)
3+
2. [AKS with Managed Disk](#aks-with-managed-disk)
4+
5+
# AKS Pre-reqs
6+
7+
1. Following TiDB AKS Pre-reqs [documentation](https://docs.pingcap.com/tidb-in-kubernetes/stable/deploy-on-azure-aks/#prerequisites)
8+
9+
```
10+
az login
11+
az provider register --namespace Microsoft.ContainerService
12+
az extension add -n k8s-extension
13+
```
14+
15+
# AKS with Managed Disk
16+
17+
1. Create AKS Cluster and Node Pool
18+
19+
```
20+
# create AKS cluster
21+
az aks create \
22+
--resource-group <<RESOURCE_GROUP_NAME>> \
23+
--name <<CLUSTER_NAME>> \
24+
--location <<LOCATION>> \
25+
--generate-ssh-keys \
26+
--vm-set-type VirtualMachineScaleSets \
27+
--node-vm-size Standard_D2s_v3 \
28+
--load-balancer-sku standard \
29+
--node-count 3 \
30+
--zones 1 2 3 \
31+
--enable-ultra-ssd
32+
```
33+
ex)
34+
```
35+
az aks create \
36+
--resource-group test \
37+
--name test \
38+
--location "East US 2" \
39+
--generate-ssh-keys \
40+
--vm-set-type VirtualMachineScaleSets \
41+
--load-balancer-sku standard \
42+
--node-count 3 \
43+
--zones 2 3
44+
--enable-ultra-ssd
45+
```
46+
47+
2. Create component node pools
48+
49+
```
50+
az aks nodepool add --name admin \
51+
--cluster-name ${clusterName} \
52+
--resource-group ${resourceGroup} \
53+
--zones 1 2 3 \
54+
--node-count 1 \
55+
--labels dedicated=admin
56+
57+
az aks nodepool add --name pd \
58+
--cluster-name ${clusterName} \
59+
--resource-group ${resourceGroup} \
60+
--node-vm-size ${nodeType} \
61+
--zones 1 2 3 \
62+
--node-count 3 \
63+
--labels dedicated=pd \
64+
--node-taints dedicated=pd:NoSchedule
65+
66+
az aks nodepool add --name tidb \
67+
--cluster-name ${clusterName} \
68+
--resource-group ${resourceGroup} \
69+
--node-vm-size ${nodeType} \
70+
--zones 1 2 3 \
71+
--node-count 2 \
72+
--labels dedicated=tidb \
73+
--node-taints dedicated=tidb:NoSchedule
74+
75+
az aks nodepool add --name tikv \
76+
--cluster-name ${clusterName} \
77+
--resource-group ${resourceGroup} \
78+
--node-vm-size ${nodeType} \
79+
--zones 1 2 3 \
80+
--node-count 3 \
81+
--labels dedicated=tikv \
82+
--node-taints dedicated=tikv:NoSchedule \
83+
--node-vm-size Standard_D2s_v3 \
84+
--enable-ultra-ssd
85+
```
86+
87+
ex)
88+
89+
```
90+
az aks nodepool add --name admin \
91+
--cluster-name test \
92+
--resource-group test \
93+
--zones 2 3 \
94+
--node-count 1 \
95+
--labels dedicated=admin
96+
97+
az aks nodepool add --name pd \
98+
--cluster-name test \
99+
--resource-group test \
100+
--node-vm-size Standard_F4s_v2 \
101+
--zones 2 3 \
102+
--node-count 3 \
103+
--labels dedicated=pd \
104+
--node-taints dedicated=pd:NoSchedule
105+
106+
az aks nodepool add --name tidb \
107+
--cluster-name test \
108+
--resource-group test \
109+
--node-vm-size Standard_F8s_v2 \
110+
--zones 2 3 \
111+
--node-count 2 \
112+
--labels dedicated=tidb \
113+
--node-taints dedicated=tidb:NoSchedule
114+
115+
az aks nodepool add --name tikv \
116+
--cluster-name test \
117+
--resource-group test \
118+
--node-vm-size Standard_E8s_v4 \
119+
--zones 2 3 \
120+
--node-count 3 \
121+
--labels dedicated=tikv \
122+
--node-taints dedicated=tikv:NoSchedule \
123+
--enable-ultra-ssd
124+
```
125+
126+
3. Update Kubeconfig
127+
```
128+
az aks get-credentials --name <<NAME>> --resource-group <<RESOURCE_GROUP>>
129+
```
130+
131+
132+
4. Create Namespaces
133+
134+
```
135+
kubectl create namespace tidb-cluster
136+
kubectl create namespace tidb-admin
137+
```
138+
139+
4. Install CRDs for TiDB Operator
140+
141+
```
142+
kubectl create -f https://raw.githubusercontent.com/pingcap/tidb-operator/v1.6.2/manifests/crd.yaml
143+
```
144+
145+
5. Install TiDB Operator via Helm
146+
147+
```
148+
helm repo add pingcap https://charts.pingcap.org/
149+
helm install --namespace tidb-admin tidb-operator pingcap/tidb-operator --version v1.6.2
150+
```
151+
152+
6. Deploy TiDB Cluster and Monitoring Service
153+
154+
```
155+
kubectl apply -f md-sc.yaml
156+
kubectl apply -f md-tidb-cluster.yaml -n tidb-cluster && \
157+
kubectl apply -f tidb-monitor.yaml -n tidb-cluster
158+
```
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
apiVersion: pingcap.com/v1alpha1
2+
kind: TidbDashboard
3+
metadata:
4+
name: basic
5+
spec:
6+
baseImage: pingcap/tidb-dashboard
7+
version: latest
8+
9+
## tidb cluster to be monitored
10+
## ** now only support monitoring one tidb cluster **
11+
clusters:
12+
- name: basic
13+
14+
## describes the compute resource requirements and limits.
15+
## Ref: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/
16+
requests:
17+
# cpu: 1000m
18+
# memory: 1Gi
19+
storage: 10Gi
20+
# limits:
21+
# cpu: 2000m
22+
# memory: 2Gi
23+
24+
service:
25+
type: LoadBalancer
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
apiVersion: pingcap.com/v1alpha1
2+
kind: TidbDashboard
3+
metadata:
4+
name: basic
5+
spec:
6+
baseImage: pingcap/tidb-dashboard
7+
version: latest
8+
9+
## tidb cluster(s) to be monitored
10+
clusters:
11+
- name: basic
12+
13+
## describes the compute resource requirements and limits.
14+
## Ref: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/
15+
requests:
16+
# cpu: 1000m
17+
# memory: 1Gi
18+
storage: 10Gi
19+
# limits:
20+
# cpu: 2000m
21+
# memory: 2Gi
22+
23+
service:
24+
type: LoadBalancer

0 commit comments

Comments
 (0)