-
Notifications
You must be signed in to change notification settings - Fork 501
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add deploy yamls for dm with new ha architecture #1738
Merged
Merged
Changes from 5 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
163b225
add deploy yamls for dm with new ha architecture
DanielZhangQD 6d4d9f0
fix format
DanielZhangQD 73d2a39
address comments
DanielZhangQD 227557e
add configmap for dm-master
DanielZhangQD 5cd8afe
Merge branch 'master' into dm-ha-yaml
DanielZhangQD fe30a04
Merge branch 'master' into dm-ha-yaml
DanielZhangQD 254179d
Merge branch 'master' into dm-ha-yaml
DanielZhangQD File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
--- | ||
title: Deploy DM on Kubernetes | ||
summary: Deploy DM on Kubernetes | ||
category: how-to | ||
--- | ||
|
||
# Deploy DM on Kubernetes | ||
|
||
This document describes how to deploy DM of the new HA architecture with the yamls in this directory. | ||
|
||
## Deploy dm-master | ||
|
||
Update the rpc configs if necessary in `master/config/config.toml`. | ||
|
||
{{< copyable "shell-regular" >}} | ||
|
||
``` shell | ||
kubectl apply -k master -n <namespace> | ||
``` | ||
|
||
> **Note: ** | ||
> | ||
> - `3` replicas are deployed by default. | ||
> - `storageClassName` is set to `local-storage` by default. | ||
|
||
## Deploy dm-worker | ||
|
||
- If you only need to use DM for incremental data migration, no need to create PVC for dm-worker, just deploy it with below command: | ||
|
||
{{< copyable "shell-regular" >}} | ||
|
||
``` shell | ||
kubectl apply -k worker/base -n <namespace> | ||
``` | ||
|
||
- If you need to use DM for both full and incremental data migration, you have to create PVC for dm-worker, deploy it with below command: | ||
|
||
{{< copyable "shell-regular" >}} | ||
|
||
``` shell | ||
kubectl apply -k worker/overlays/full -n <namespace> | ||
``` | ||
|
||
> **Note: ** | ||
> | ||
> - `3` replicas are deployed by default. | ||
> - `storageClassName` is set to `local-storage` for PVC by default. | ||
> - If PVCs are created, they are mounted to `/data` directory. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# rpc configuration | ||
# | ||
# rpc timeout is a positive number plus time unit. we use golang standard time | ||
# units including: "ns", "us", "ms", "s", "m", "h". You should provide a proper | ||
# rpc timeout according to your use scenario. | ||
rpc-timeout = "30s" | ||
# rpc limiter controls how frequently events are allowed to happen. | ||
# It implements a "token bucket" of size `rpc-rate-limit`, initially full and | ||
# refilled at rate `rpc-rate-limit` tokens per second. Note `rpc-rate-limit` | ||
# is float64 type, so remember to add a decimal point and one trailing 0 if its | ||
# literal value happens to be an integer. | ||
rpc-rate-limit = 10.0 | ||
rpc-rate-burst = 40 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,148 @@ | ||
apiVersion: apps/v1 | ||
kind: StatefulSet | ||
metadata: | ||
labels: | ||
app.kubernetes.io/component: dm-master | ||
name: dm-master | ||
spec: | ||
podManagementPolicy: Parallel | ||
replicas: 3 | ||
revisionHistoryLimit: 10 | ||
selector: | ||
matchLabels: | ||
app.kubernetes.io/component: dm-master | ||
serviceName: dm-master-peer | ||
template: | ||
metadata: | ||
annotations: | ||
prometheus.io/path: /metrics | ||
prometheus.io/port: "8261" | ||
prometheus.io/scrape: "true" | ||
creationTimestamp: null | ||
labels: | ||
app.kubernetes.io/component: dm-master | ||
spec: | ||
affinity: {} | ||
containers: | ||
- command: | ||
- /dm-master | ||
- --data-dir=/data | ||
- --config=/etc/config/config.toml | ||
- --name=$(MY_POD_NAME) | ||
- --master-addr=:8261 | ||
- --advertise-addr=$(MY_POD_NAME).$(PEER_SERVICE_NAME).$(NAMESPACE):8261 | ||
- --peer-urls=:8291 | ||
- --advertise-peer-urls=http://$(MY_POD_NAME).$(PEER_SERVICE_NAME).$(NAMESPACE):8291 | ||
- --initial-cluster=dm-master-0=http://dm-master-0.$(PEER_SERVICE_NAME).$(NAMESPACE):8291,dm-master-1=http://dm-master-1.$(PEER_SERVICE_NAME).$(NAMESPACE):8291,dm-master-2=http://dm-master-2.$(PEER_SERVICE_NAME).$(NAMESPACE):8291 | ||
env: | ||
- name: MY_POD_NAME | ||
valueFrom: | ||
fieldRef: | ||
apiVersion: v1 | ||
fieldPath: metadata.name | ||
- name: NAMESPACE | ||
valueFrom: | ||
fieldRef: | ||
apiVersion: v1 | ||
fieldPath: metadata.namespace | ||
- name: PEER_SERVICE_NAME | ||
value: dm-master-peer | ||
- name: SERVICE_NAME | ||
value: dm-master | ||
- name: TZ | ||
value: UTC | ||
image: pingcap/dm:ha-alpha | ||
imagePullPolicy: IfNotPresent | ||
livenessProbe: | ||
failureThreshold: 8 | ||
httpGet: | ||
path: /status | ||
port: 8261 | ||
scheme: HTTP | ||
initialDelaySeconds: 5 | ||
timeoutSeconds: 5 | ||
readinessProbe: | ||
failureThreshold: 5 | ||
httpGet: | ||
path: /status | ||
port: 8261 | ||
scheme: HTTP | ||
initialDelaySeconds: 5 | ||
timeoutSeconds: 5 | ||
name: master | ||
ports: | ||
- containerPort: 8291 | ||
name: server | ||
protocol: TCP | ||
- containerPort: 8261 | ||
name: client | ||
protocol: TCP | ||
resources: {} | ||
terminationMessagePath: /dev/termination-log | ||
terminationMessagePolicy: File | ||
volumeMounts: | ||
- mountPath: /data | ||
name: data | ||
- mountPath: /etc/config | ||
name: config | ||
dnsPolicy: ClusterFirst | ||
restartPolicy: Always | ||
schedulerName: default-scheduler | ||
securityContext: {} | ||
terminationGracePeriodSeconds: 30 | ||
volumes: | ||
- configMap: | ||
name: dm-master-config | ||
name: config | ||
updateStrategy: | ||
rollingUpdate: | ||
partition: 3 | ||
type: RollingUpdate | ||
volumeClaimTemplates: | ||
- metadata: | ||
name: data | ||
spec: | ||
accessModes: | ||
- ReadWriteOnce | ||
dataSource: null | ||
resources: | ||
requests: | ||
storage: 10Gi | ||
storageClassName: local-storage | ||
--- | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
labels: | ||
app.kubernetes.io/component: dm-master | ||
name: dm-master | ||
spec: | ||
ports: | ||
- name: client | ||
port: 8261 | ||
protocol: TCP | ||
targetPort: 8261 | ||
selector: | ||
app.kubernetes.io/component: dm-master | ||
sessionAffinity: None | ||
type: ClusterIP | ||
--- | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
labels: | ||
app.kubernetes.io/component: dm-master | ||
name: dm-master-peer | ||
spec: | ||
clusterIP: None | ||
ports: | ||
- name: peer | ||
port: 8291 | ||
protocol: TCP | ||
targetPort: 8291 | ||
selector: | ||
app.kubernetes.io/component: dm-master | ||
publishNotReadyAddresses: true | ||
sessionAffinity: None | ||
type: ClusterIP | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
resources: | ||
- dm-master.yaml | ||
configMapGenerator: | ||
- name: dm-master-config | ||
files: | ||
- config/config.toml | ||
generatorOptions: | ||
labels: | ||
app.kubernetes.io/component: dm-master | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
apiVersion: apps/v1 | ||
kind: StatefulSet | ||
metadata: | ||
labels: | ||
app.kubernetes.io/component: dm-worker | ||
name: dm-worker | ||
spec: | ||
podManagementPolicy: Parallel | ||
replicas: 3 | ||
revisionHistoryLimit: 10 | ||
selector: | ||
matchLabels: | ||
app.kubernetes.io/component: dm-worker | ||
serviceName: dm-worker-peer | ||
template: | ||
metadata: | ||
annotations: | ||
prometheus.io/path: /metrics | ||
prometheus.io/port: "8262" | ||
prometheus.io/scrape: "true" | ||
creationTimestamp: null | ||
labels: | ||
app.kubernetes.io/component: dm-worker | ||
spec: | ||
affinity: {} | ||
containers: | ||
- command: | ||
- /dm-worker | ||
- --name=$(MY_POD_NAME) | ||
- --worker-addr=:8262 | ||
- --advertise-addr=$(MY_POD_NAME).$(PEER_SERVICE_NAME).$(NAMESPACE):8262 | ||
- --join=dm-master.$(NAMESPACE):8261 | ||
env: | ||
- name: MY_POD_NAME | ||
valueFrom: | ||
fieldRef: | ||
apiVersion: v1 | ||
fieldPath: metadata.name | ||
- name: NAMESPACE | ||
valueFrom: | ||
fieldRef: | ||
apiVersion: v1 | ||
fieldPath: metadata.namespace | ||
- name: PEER_SERVICE_NAME | ||
value: dm-worker-peer | ||
- name: SERVICE_NAME | ||
value: dm-worker | ||
- name: TZ | ||
value: UTC | ||
image: pingcap/dm:ha-alpha | ||
imagePullPolicy: IfNotPresent | ||
livenessProbe: | ||
failureThreshold: 8 | ||
httpGet: | ||
path: /status | ||
port: 8262 | ||
scheme: HTTP | ||
initialDelaySeconds: 5 | ||
timeoutSeconds: 5 | ||
readinessProbe: | ||
failureThreshold: 5 | ||
httpGet: | ||
path: /status | ||
port: 8262 | ||
scheme: HTTP | ||
initialDelaySeconds: 5 | ||
timeoutSeconds: 5 | ||
name: worker | ||
ports: | ||
- containerPort: 8262 | ||
name: client | ||
protocol: TCP | ||
resources: {} | ||
terminationMessagePath: /dev/termination-log | ||
terminationMessagePolicy: File | ||
dnsPolicy: ClusterFirst | ||
restartPolicy: Always | ||
schedulerName: default-scheduler | ||
securityContext: {} | ||
terminationGracePeriodSeconds: 30 | ||
updateStrategy: | ||
rollingUpdate: | ||
partition: 3 | ||
type: RollingUpdate | ||
--- | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
labels: | ||
app.kubernetes.io/component: dm-worker | ||
name: dm-worker | ||
spec: | ||
ports: | ||
- name: client | ||
port: 8262 | ||
protocol: TCP | ||
targetPort: 8262 | ||
selector: | ||
app.kubernetes.io/component: dm-worker | ||
sessionAffinity: None | ||
type: ClusterIP | ||
--- | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
labels: | ||
app.kubernetes.io/component: dm-worker | ||
name: dm-worker-peer | ||
spec: | ||
clusterIP: None | ||
ports: | ||
- name: peer | ||
port: 8262 | ||
protocol: TCP | ||
targetPort: 8262 | ||
selector: | ||
app.kubernetes.io/component: dm-worker | ||
publishNotReadyAddresses: true | ||
sessionAffinity: None | ||
type: ClusterIP | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
resources: | ||
- dm-worker.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
apiVersion: apps/v1 | ||
kind: StatefulSet | ||
metadata: | ||
name: dm-worker | ||
spec: | ||
template: | ||
spec: | ||
containers: | ||
- name: worker | ||
volumeMounts: | ||
- mountPath: /data | ||
name: data | ||
volumeClaimTemplates: | ||
- metadata: | ||
name: data | ||
spec: | ||
accessModes: | ||
- ReadWriteOnce | ||
dataSource: null | ||
resources: | ||
requests: | ||
storage: 10Gi | ||
storageClassName: local-storage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
bases: | ||
- ../../base | ||
patches: | ||
- dm-worker-pvc.yaml |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move docs to
docs/
directory?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is just for temp deployment, we may need to support DM with chart or controller later, I think we can leave it here for now.