部署专属算力服务
配置专属算力服务器
加入到 kubernetes 集群
-
提前在专属算力服务器部署好 kubernetes node 环境
-
在 kubernetes 主节点获取新节点加入集群的命令
kubeadm token create --print-join-command
-
在专属算力服务器执行加入集群的命令
kubeadm join 192.168.1.100:6443 --token 3nwjzw.pdod3r27lnqqhi0x --discovery-token-ca-cert-hash sha256:a84445303xxxxxxxxxxxxxxxxxxx175a2
下载镜像
-
下载 computinginstance 镜像(仅需在专属算力服务器上操作)
- 服务器支持访问互联网
- 服务器不支持访问互联网
crictl pull registry.cn-hangzhou.aliyuncs.com/mdpublic/mingdaoyun-computinginstance:6.0.0
# 镜像文件下载链接,下载完成后上传到部署服务器
http://pdpublic.mingdao.com/private-deployment/offline/mingdaoyun-computinginstance-linux-amd64-6.0.0.tar.gz
# 解压镜像
gunzip -d mingdaoyun-computinginstance-linux-amd64-6.0.0.tar.gz
# 导入镜像
ctr -n k8s.io image import mingdaoyun-computinginstance-linux-amd64-6.0.0.tar
添加污点及标签
-
获取专属算力节点 node 名称
kubectl get node
-
给专属算力节点添加污点与标签
kubectl taint node $your_node_name md=workflowcompute:NoSchedule
kubectl label node $your_node_name md=workflowcompute- 注意,需要将
$your_node_name
替换为实际的 node 名称
- 注意,需要将
-
给专属算力节点添加标签
部署专属算力服务
-
专属算力是从 v5.1.0 版本开始支持的,在安装管理器版本>=5.1.0时,首次部署会生成默认的
computinginstance.yaml
文件,在配置专属算力服务时通常修改现有配置文件即可 -
如首次部署时安装管理器版本<5.1.0,需要新增
computinginstance.yaml
文件并修改相关脚本
- 首次部署时安装管理器版本>=5.1.0
- 首次部署时安装管理器版本<5.1.0
-
执行
cat $KUBECONFIG
获取 $KUBECONFIG 内容(对应 kubernetes 的/etc/kubernetes/admin.conf
文件)cat $KUBECONFIG
输出样例:
apiVersion: v1
clusters:
- cluster:
certificate-authority-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUMvakNDQWVhZ0F3SUJBZ0lCQURBTkJna3Foa2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F3eWNScCtUTlZ5UnphNXpmUkt6RUZiZml0WU1LQk0KNkVhZmk3d3lma2twNDBDYzFoKzJMM3N4WG1sSDUyaXA4REx3WDJGVEVXRjE3VnE5WTBRdXZDcGpBSUlnY09aSgpGQjNCMHhiK0ZsUGsxZC9vakNHSzVOdDd6Z2VWQmN1VkhGSUhITSs5eWQ0dHJCVVViR05vVCszWVJXU0hxTGJECml3LzdQVDU2SFpheHA1VmUvN2p1cTZEbkRIYXQ5ZW9Idk5acEcvNUJMUW1SWUUyOFNaU3lvUnd5V3pUMkpTb24KOE8wPQotLS0tLUVORCBDRVJUSUZJQ0FURS0tLS0tCg==
server: https://192.168.0.150:6443
name: kubernetes
contexts:
- context:
cluster: kubernetes
user: kubernetes-admin
name: kubernetes-admin@kubernetes
current-context: kubernetes-admin@kubernetes
kind: Config
preferences: {}
users:
- name: kubernetes-admin
user:
client-certificate-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURJVENDQWdtZ0F3SUJBZ0lJWnJObmsyZ1RLRmd3RFFZSktvWklodmNOQVFFTEJRQXdGVEVUTUJFR0ExVUUKQXhNS2EzVmlaWEp1WlhSbGN6QWVGdzB5TkRBeE1qa3dPVE0wTlRWYUZ3MHlOVEF4TWpnd09UTTBOVGRhTURReApGekFWQmdOVkJBb1REbk41YzNSbGJUcHRZWE4wWlhKek1Sa3dGd1lEVlFRREV4QnJkV0psY201bGRHVnpMV0ZrCmJXbHVNSUlCSWpBTkJna3Foa2lHOXcwQkFRRUZBQU9DQVE4QU1JSUJDZ0tDQVFFQXBhMk1zT1JkNHJ5djFhdEsKbkcrZzZiUkhJZ28rbEVkL09qSThTVU9BVlppV0tNY2pFaU81TXpkSXhaZW8yNFIxYzBweTNyei9WQ1FkNkZTdQpmSkFydDJodkZEczFvWGN2UEZ6d2xKRWZpblRNZkdqVndhZTkyNGZrak15MDU4d0pFbjVEVDJYa294QmhyOGhFClhSZ2dBbFpDL0R3dVA3ZjhBcmtyTC8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TQSBQUklWQVRFIEtFWS0tLS0tCg==- 下一步会将
cat $KUBECONFIG
输出内容复制到computinginstance.yaml
文件中,注意复制前需要在每行前添加四个空格
- 下一步会将
-
修改
/data/mingdao/script/kubernetes/computinginstance.yaml
文件首次部署时,computinginstance.yaml 文件中以下几点务必修改
- kafka.brokers:修改为微服务连接的 kafka 地址
- syncStatus.mongoUri:# 修改为实际的 mongodb 连接信息
- image:修改为与微服务相同的 computinginstance 版本号
- kubeconfig.yaml:修改为 $KUBECONFIG 实际的内容,务必注意需要在 $KUBECONFIG 原始内容每行前添加四个空格
修改样例:
apiVersion: v1
kind: ConfigMap
metadata:
name: computinginstance
namespace: default
data:
config.yaml: |-
server:
listen:
host: "0.0.0.0"
port: "9157"
common:
kubernetes:
configFile: "/usr/local/computinginstance/kubeconfig.yaml"
namespace: "default"
configmapTemplate: "/usr/local/computinginstance/configmap-workflowcompute.yaml"
deploymentTemplate: "/usr/local/computinginstance/deployment-workflowcompute.yaml"
kafka:
brokers: "192.168.0.144:9092" # 修改为微服务连接的 kafka 地址
workflowTopicPrefix: "WorkFlow-"
workSheetTopicPrefix: "WorkSheet-"
workflowConsumerIdPrefix: "md-workflow-consumer-"
replicationFactor: 1
deleteTopic: true
callback:
url: "http://computingschedule:9158"
createInterval: 120000 #ms
deleteInterval: 120000 #ms
syncStatus:
mongoUri: "mongodb://mingdao:123456@192.168.0.144:27017/mdIdentification" # 修改为实际的 mongodb 连接信息
model:
10:
replicas: 1 # 实例数量
thread: 2 # 表示单个种类线程数量,总数=5*thread*replicas=10
cpu: 2 # 单个实例最大CPU核,总数=cpu*replicas=2
memory: 4 # 单个实例最大内存GB,,总数=memory*replicas=4
20:
replicas: 1
thread: 4
cpu: 4
memory: 8
50:
replicas: 1
thread: 10
cpu: 8
memory: 16
100:
replicas: 1
thread: 20
cpu: 16
memory: 32
configmap-workflowcompute.yaml: |-
apiVersion: v1
kind: ConfigMap
metadata:
name: workflowcompute
data:
application-www-computing.properties: |-
md.resource.consumer.config.maps={\
'resourceId': 'CONFIGMAP_INSTANCEID', \
'wfTopic': 'WorkFlow-CONFIGMAP_INSTANCEID', \
'wsTopic': 'WorkSheet-CONFIGMAP_INSTANCEID', \
'partition': 'CONFIGMAP_WORKFLOW_PARTITION' \
}
md.kafka.consumer.topic=WorkSheet-CONFIGMAP_INSTANCEID
md.kafka.consumer.group.id=md-workflow-consumer-CONFIGMAP_INSTANCEID
md.kafka.consumer.concurrency=CONFIGMAP_WORKFLOW_THREAD
md.kafka.batch.topic=WorkSheet-CONFIGMAP_INSTANCEID
md.kafka.batch.concurrency=CONFIGMAP_WORKFLOW_THREAD
spring.kafka.batch.topic=WorkFlow-CONFIGMAP_INSTANCEID
spring.kafka.batch.concurrency=CONFIGMAP_WORKFLOW_THREAD
spring.kafka.button.topic=WorkFlow-CONFIGMAP_INSTANCEID
spring.kafka.button.concurrency=CONFIGMAP_WORKFLOW_THREAD
spring.kafka.process.topic=WorkFlow-CONFIGMAP_INSTANCEID
spring.kafka.process.concurrency=CONFIGMAP_WORKFLOW_THREAD
spring.kafka.consumer.topic=WorkFlow-CONFIGMAP_INSTANCEID
spring.kafka.consumer.group.id=md-workflow-consumer-CONFIGMAP_INSTANCEID
spring.kafka.consumer.concurrency=CONFIGMAP_WORKFLOW_THREAD
spring.kafka.properties.partition=CONFIGMAP_WORKFLOW_PARTITION
grpc.client.MDWorksheetService.address=static://127.0.0.1:9422
spring.kafka.router.topic=WorkFlow-CONFIGMAP_INSTANCEID
deployment-workflowcompute.yaml: |-
apiVersion: apps/v1
kind: Deployment
metadata:
name: workflowcompute-DEPLOYMENT_INSTANCEID
labels:
app: workflowcompute-DEPLOYMENT_INSTANCEID
md-service: workflowcompute
spec:
replicas: DEPLOYMENT_REPLICAS
selector:
matchLabels:
app: workflowcompute-DEPLOYMENT_INSTANCEID
template:
metadata:
labels:
app: workflowcompute-DEPLOYMENT_INSTANCEID
md-service: workflowcompute
annotations:
md-update: '20231228184263'
spec:
imagePullSecrets:
- name: hub.mingdao.com
tolerations:
- key: "md"
operator: "Equal"
value: "workflowcompute"
effect: "NoSchedule"
nodeSelector:
md: workflowcompute
containers:
- name: workflow-consumer
image: registry.cn-hangzhou.aliyuncs.com/mdpublic/mingdaoyun-computinginstance:6.0.0 # computinginstance 镜像版本号
env:
- name: ENV_SERVERID
value: "single:workflowconsumer"
command:
- sh
- -c
- |
cp /usr/local/MDPrivateDeployment/workflowconsumer/application-www-computing.properties.template /usr/local/MDPrivateDeployment/workflowconsumer/application-www-computing.properties
sed -i s/CONFIGMAP_INSTANCEID/DEPLOYMENT_INSTANCEID/g /usr/local/MDPrivateDeployment/workflowconsumer/application-www-computing.properties
sed -i s/CONFIGMAP_WORKFLOW_THREAD/DEPLOYMENT_WORKFLOW_THREAD/g /usr/local/MDPrivateDeployment/workflowconsumer/application-www-computing.properties
sed -i s/CONFIGMAP_WORKFLOW_PARTITION/DEPLOYMENT_WORKFLOW_PARTITION/g /usr/local/MDPrivateDeployment/workflowconsumer/application-www-computing.properties
cat /usr/local/MDPrivateDeployment/workflowconsumer/application-www-computing.properties
sleep 20
exec /Housekeeper/main -config /Housekeeper/config.yaml
resources:
limits:
memory: DEPLOYMENT_MEMORYGi
cpu: DEPLOYMENT_CPU
requests:
memory: 1Gi
cpu: 0.25
volumeMounts:
- name: tz-config
mountPath: /etc/localtime
- name: workflowcompute
mountPath: /usr/local/MDPrivateDeployment/workflowconsumer/application-www-computing.properties.template
subPath: application-www-computing.properties
- name: worksheetservice
image: registry.cn-hangzhou.aliyuncs.com/mdpublic/mingdaoyun-computinginstance:6.0.0 # computinginstance 镜像版本号
env:
- name: ENV_SERVERID
value: "single:worksheet"
command:
- sh
- -c
- |
cat /usr/local/MDPrivateDeployment/worksheet/Config/appsettingsMain.json
exec /Housekeeper/main -config /Housekeeper/config.yaml
resources:
limits:
memory: DEPLOYMENT_MEMORYGi
cpu: DEPLOYMENT_CPU
requests:
memory: 1Gi
cpu: 0.25
readinessProbe:
tcpSocket:
port: 9422
initialDelaySeconds: 10
periodSeconds: 10
livenessProbe:
tcpSocket:
port: 9422
initialDelaySeconds: 60
periodSeconds: 10
volumeMounts:
- name: tz-config
mountPath: /etc/localtime
volumes:
- name: tz-config
hostPath:
path: /usr/share/zoneinfo/Etc/GMT-8
- name: workflowcompute
configMap:
name: workflowcompute
items:
- key: application-www-computing.properties
path: application-www-computing.properties
kubeconfig.yaml: |- # 将下方修改为 $KUBECONFIG 实际的内容,注意需要在 $KUBECONFIG 原始内容每行前添加四个空格
apiVersion: v1
clusters:
- cluster:
certificate-authority-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUMvakNDQWVhZ0F3SUJBZ0lCQURBTkJna3Foa2lHOXcwQkFRc0ZBREFWTVJNd0VRWURWUVFERXdwcmRXSmwKY201bGRHVnpNQjRYRFRJME1ERXlPVEE1TXpRMU5Wb1hEVE0wTURFeU5qQTVNelExTlZvd0ZURVRNQkVHQTFVRQpBeE1LYTNWaVpYSnVaWFJsY3pDQ0FTSXdEUVlKS29aSWh2Y05BUUVCQlFBRGdnRVBBRENDQVFvQ2dnRUJBTjR3CklsY3RBNzhlTlRPZWJOK1RoUXdDL29SamtKMlJMeUlVZ2dncU1MSWlxWWpEbytqczNKbkdpNVU4cUIrZ3RlV1AKRDhTUEVlVUd0ZmNOOHoxTzlqK0Q1aFB3dkRPRDFyV2k3OEpnZWI3SURtdkU4L1VMdWdIYldkajlTckcrWTVEYwpDakQrcFduWHAzQUkzdjhwbm45a1ZJZ2Z3RldFcFVGQWI4Y2h0WSt3MU11ZjVhNVlhSTJ3NWtwOXhVS1lmV0g0CkFWUnlCUUFFVU5TUjE1Y3EyZ3Z2WDVTT1ZXUU0xcFJYNG1jcHovZ0toZ1pCYTBoSHZJaGRIRFBxQ0o0bUNYak4KbzgrWDYzNWZ4S3JPYTV4NTFhemVJMTljeE5lOXh0V25JdDUzLzJtWVlkYjIzWVI5UDRCK3U5NWVheWZWU2JwZQo4amhvdW1qVXFoSmNHMFdiY1pNQ0F3RUFBYU5aTUZjd0RnWURWUjBQQVFIL0JBUURBZ0trTUE4R0ExVWRFd0VCCi93UUZNQU1CQWY4d0hRWURWUjBPQkJZRUZHMW1zZ01jVDBoOVpZbVlJU2pZK2wyNFRERFJNQlVHQTFVZEVRUU8KTUF5Q0NtdDFZbVZ5Ym1WMFpYTXdEUVlKS29aSWh2Y05BUUVMQlFBRGdnRUJBSHFXUDhnVDFJbXBpL1M4NVIzQwpzU0Y2V0NISFFscU5uOTh3UHdhR0dEcmFZQnUwbnhSeFk5Q243cHk3TytzZ2hLeDRpLzR5N3ZKYi84MXZWTEx2CklORGhxL2N2enp1WWtHQ0J1QStXcFVMZmhneHFsb0F4MjF3eWNScCtUTlZ5UnphNXpmUkt6RUZiZml0WU1LQk0KNkVhZmk3d3lma2twNDBDYzFoKzJMM3N4WG1sSDUyaXA4REx3WDJGVEVXRjE3VnE5WTBRdXZDcGpBSUlnY09aSgpGQjNCMHhiK0ZsUGsxZC9vakNHSzVOdDd6Z2VWQmN1VkhGSUhITSs5eWQ0dHJCVVViR05vVCszWVJXU0hxTGJECml3LzdQVDU2SFpheHA1VmUvN2p1cTZEbkRIYXQ5ZW9Idk5acEcvNUJMUW1SWUUyOFNaU3lvUnd5V3pUMkpTb24KOE8wPQotLS0tLUVORCBDRVJUSUZJQ0FURS0tLS0tCg==
server: https://192.168.0.150:6443
name: kubernetes
contexts:
- context:
cluster: kubernetes
user: kubernetes-admin
name: kubernetes-admin@kubernetes
current-context: kubernetes-admin@kubernetes
kind: Config
preferences: {}
users:
- name: kubernetes-admin
user:
client-certificate-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURJVENDQWdtZ0F3SUJBZ0lJWnJObmsyZ1RLRmd3RFFZSktvWklodmNOQVFFTEJRQXdGVEVUTUJFR0ExVUUKQXhNS2EzVmlaWEp1WlhSbGN6QWVGdzB5TkRBeE1qa3dPVE0wTlRWYUZ3MHlOVEF4TWpnd09UTTBOV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FYSU5zYUppUExxZjZ4ZTdET1c1d0lmZQppWEdnZzlMcGR5T0l5dHBSTzc0a0p6QTJjSDVxRkVHZll5bnY1TTlEOUUxQmwyZXZFcDMvUytDaFFKSWFjeW9aCkVEZnlJUUtCZ0JXUGRELzhSTFhVWm9oV2FnTy9uMHRBUnlLMnladTA4RWFjcENXV2ZFNUdUZzF1cnVTNTdhT0IKMU1KeTFQNElnODJhVml4T291bkR3d2xzSHBjNXlHdVNBTERvYklkRnJoMHJVYVZLTTJZMDN1VzFBRnhzcnFFQQpWc0t0aUQ3WjMrRzM1cmFwRTkrcDhoR0EzaVF6eHl3YWdtRUI0Sm9WU0MxbHZJekc1ME1XCi0tLS0tRU5EIFJTQSBQUklWQVRFIEtFWS0tLS0tCg==
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: computinginstance
namespace: default
spec:
replicas: 1
selector:
matchLabels:
app: computinginstance
template:
metadata:
labels:
app: computinginstance
dir: grpc
annotations:
md-update: "20231228184309"
spec:
imagePullSecrets:
- name: hub.mingdao.com
containers:
- name: computinginstance
image: registry.cn-hangzhou.aliyuncs.com/mdpublic/mingdaoyun-computinginstance:6.0.0 # computinginstance 镜像版本号
resources:
limits:
cpu: "2"
memory: 2G
requests:
cpu: "0.01"
memory: 128M
readinessProbe:
tcpSocket:
port: 9157
initialDelaySeconds: 3
periodSeconds: 3
livenessProbe:
tcpSocket:
port: 9157
initialDelaySeconds: 20
periodSeconds: 10
volumeMounts:
- name: configfile
mountPath: /usr/local/computinginstance/config.yaml
subPath: config.yaml
- name: configfile
mountPath: /usr/local/computinginstance/configmap-workflowcompute.yaml
subPath: configmap-workflowcompute.yaml
- name: configfile
mountPath: /usr/local/computinginstance/deployment-workflowcompute.yaml
subPath: deployment-workflowcompute.yaml
- name: configfile
mountPath: /usr/local/computinginstance/kubeconfig.yaml
subPath: kubeconfig.yaml
- name: tz-config
mountPath: /etc/localtime
volumes:
- name: tz-config
hostPath:
path: /usr/share/zoneinfo/Asia/Shanghai
- name: configfile
configMap:
name: computinginstance
items:
- key: config.yaml
path: config.yaml
- key: configmap-workflowcompute.yaml
path: configmap-workflowcompute.yaml
- key: deployment-workflowcompute.yaml
path: deployment-workflowcompute.yaml
- key: kubeconfig.yaml
path: kubeconfig.yaml
---
apiVersion: v1
kind: Service
metadata:
name: computinginstance
namespace: default
spec:
selector:
app: computinginstance
ports:
- name: http-computinginstance
port: 9157
targetPort: 9157
nodePort: 9157
type: NodePort -
重启服务
cd /data/mingdao/script/kubernetes/
bash restart.sh
-
修改
/data/mingdao/script/kubernetes/start.sh
baseDir=$(dirname $0)
kubectl apply -f $baseDir/config.yaml
sleep 30
kubectl apply -f $baseDir/service.yaml
kubectl apply -f $baseDir/datapipeline.yaml
kubectl apply -f $baseDir/wps.yaml
kubectl apply -f $baseDir/computinginstance.yaml # 新增这 行
sleep 180
kubectl apply -f $baseDir/www.yaml -
修改
/data/mingdao/script/kubernetes/stop.sh
baseDir=$(dirname $0)
kubectl delete -f $baseDir/www.yaml
kubectl delete -f $baseDir/service.yaml
kubectl delete -f $baseDir/datapipeline.yaml
kubectl delete -f $baseDir/wps.yaml
kubectl delete -f $baseDir/computinginstance.yaml # 新增这行
kubectl delete -f $baseDir/config.yaml -
修改
/data/mingdao/script/kubernetes/update.sh
baseDir=$(dirname $0)
imagePrefix="registry.cn-hangzhou.aliyuncs.com/mdpublic/mingdaoyun-"
function replaceEnv() {
local key=$1
local value=$2
local file=$3
sed -i "/$key/ s#\".*\"#\"$value\"#" $file
}
function replaceAppVersion() {
local version=$1
replaceEnv ENV_APP_VERSION $version $baseDir/config.yaml
}
function update() {
local service=$1
local version=$2
sed -r -i "/$(echo -n "${imagePrefix}$service" | sed -n 's#/#\\/#g;p')/ s/$service:.*$/$service:$version/" $baseDir/config.yaml
sed -r -i "/$(echo -n "${imagePrefix}$service" | sed -n 's#/#\\/#g;p')/ s/$service:.*$/$service:$version/" $baseDir/service.yaml
sed -r -i "/$(echo -n "${imagePrefix}$service" | sed -n 's#/#\\/#g;p')/ s/$service:.*$/$service:$version/" $baseDir/datapipeline.yaml
sed -r -i "/$(echo -n "${imagePrefix}$service" | sed -n 's#/#\\/#g;p')/ s/$service:.*$/$service:$version/" $baseDir/wps.yaml
# 下面一行新增
sed -r -i "/$(echo -n "${imagePrefix}computinginstance" | sed -n 's#/#\\/#g;p')/ s/computinginstance:.*$/computinginstance:$version/" $baseDir/computinginstance.yaml # 本行属于新增
sed -r -i "/$(echo -n "${imagePrefix}$service" | sed -n 's#/#\\/#g;p')/ s/$service:.*$/$service:$version/" $baseDir/www.yaml
echo "Note: The version number of the ${service} service has been changed to ${version}, it will take effect after restart"
}
case $1 in
update)
if [[ $# -ne 3 ]];then
echo "Update the specific service version number, format example: $baseDir/$scriptName update community 3.1.0"
exit 1
fi
update $2 $3
replaceAppVersion $3
echo "Restarting services..."
/bin/bash $baseDir/restart.sh
# 下面四行属于新增
echo "Updating workflowcompute instance...: $3" # 本行属于新增
curl -XPOST '127.0.0.1:9157/instance/update' -d '{"ContainerName": "workflow-consumer", "Image": "'${imagePrefix}computinginstance:$3'"}' -H 'Content-Type: application/json' # 本行属于新增
sleep 5 # 本行属于新增
curl -XPOST '127.0.0.1:9157/instance/update' -d '{"ContainerName": "worksheetservice", "Image": "'${imagePrefix}computinginstance:$3'"}}' -H 'Content-Type: application/json' # 本行属于新增
;;
*)
echo "Usage:
$0 <$(sed -n '/case \$1/,/esac/p' $0 | grep -oP '\b\w+\)$' | tr -d ')' | paste -s -d '|')>"
;;
esac -
执行
cat $KUBECONFIG
获取 $KUBECONFIG 内容(对应 kubernetes 的/etc/kubernetes/admin.conf
文件)cat $KUBECONFIG
输出样例:
apiVersion: v1
clusters:
- cluster:
certificate-authority-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUMvakNDQWVhZ0F3SUJBZ0lCQURBTkJna3Foa2lHOXcwQkFRc0ZBREFWTVJNd0VRWURWUVFERXdwcmRXSmwKY201bGRHVnpNQjRYRFRJME1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JMM3N4WG1sSDUyaXA4REx3WDJGVEVXRjE3VnE5WTBRdXZDcGpBSUlnY09aSgpGQjNCMHhiK0ZsUGsxZC9vakNHSzVOdDd6Z2VWQmN1VkhGSUhITSs5eWQ0dHJCVVViR05vVCszWVJXU0hxTGJECml3LzdQVDU2SFpheHA1VmUvN2p1cTZEbkRIYXQ5ZW9Idk5acEcvNUJMUW1SWUUyOFNaU3lvUnd5V3pUMkpTb24KOE8wPQotLS0tLUVORCBDRVJUSUZJQ0FURS0tLS0tCg==
server: https://192.168.0.150:6443
name: kubernetes
contexts:
- context:
cluster: kubernetes
user: kubernetes-admin
name: kubernetes-admin@kubernetes
current-context: kubernetes-admin@kubernetes
kind: Config
preferences: {}
users:
- name: kubernetes-admin
user:
client-certificate-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURJVENDQWdtZ0F3SUJBZ0lJWnJObmsyZ1RLRmd3RFFZSktvWklodmNOQVFFTEJRQXdGVEVUTUJFR0ExVUUKQXhNS2EzVmlaWEp1WlhSbGN6QWVGdzB5TkRBeE1qa3dPVE0wTlRWYUZ3MHlOVEF4TWpnd09UTTBOVGRhTURReApGekFWQmdOVkJBb1REbk41YzNSbGJUcHRZWE4wWlhKek1Sa3dGd1lEVlFRREV4QnJkV0psY201bGRHVnpMV0ZrCmJXbHVNSUlCSWpBTkJna3Foa2lHOXcwQkFRRUZBQU9DQVE4QU1JSUJDZ0tDQVFFQXBhMk1zT1JkNHJ5djFhdEsKbkcrZzZiUkhJZ28rbEVkL09qSThTVU9BVlppV0tNY2pFaU81TXpkSXhaZW8yNFIxYzBweTNyei9WQ1FkNkZTdQpmSkFydDJodkZEczFvWGN2UEZ6d2xKRWZpblRNZkdqVndhZTkyNGZrak15MDU4d0pFbjVEVDJYa294QmhyOGhFClhSZ2dBbFpDL0R3dVA3ZjhBcmtyTC8wOG9TbmFhWm5sVkpKTU9qWnN5VFBCMnFTTXZselh1Z25vSW14Qlhkc0oKZkVScm5qQ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文件中,注意复制前需要在每行前添加四个空格
- 下一步会将
-
新增
/data/mingdao/script/kubernetes/computinginstance.yaml
文件首次部署时,computinginstance.yaml 文件中以下几点务必修改
- kafka.brokers:修改为微服务连接的 kafka 地址
- syncStatus.mongoUri:# 修改为实际的 mongodb 连接信息
- image:修改为与微服务相同的 computinginstance 版本号
- kubeconfig.yaml:修改为 $KUBECONFIG 实际的内容,务必注意需要在 $KUBECONFIG 原始内容每行前添加四个空格
computinginstance.yaml
文件样例:apiVersion: v1
kind: ConfigMap
metadata:
name: computinginstance
namespace: default
data:
config.yaml: |-
server:
listen:
host: "0.0.0.0"
port: "9157"
common:
kubernetes:
configFile: "/usr/local/computinginstance/kubeconfig.yaml"
namespace: "default"
configmapTemplate: "/usr/local/computinginstance/configmap-workflowcompute.yaml"
deploymentTemplate: "/usr/local/computinginstance/deployment-workflowcompute.yaml"
kafka:
brokers: "192.168.0.144:9092" # 修改为微服务连接的 kafka 地址
workflowTopicPrefix: "WorkFlow-"
workSheetTopicPrefix: "WorkSheet-"
workflowConsumerIdPrefix: "md-workflow-consumer-"
replicationFactor: 1
deleteTopic: true
callback:
url: "http://computingschedule:9158"
createInterval: 120000 #ms
deleteInterval: 120000 #ms
syncStatus:
mongoUri: "mongodb://mingdao:123456@192.168.0.144:27017/mdIdentification" # 修改为实际的 mongodb 连接信息
model:
10:
replicas: 1 # 实例数量
thread: 2 # 表示单个种类线程数量,总数=5*thread*replicas=10
cpu: 2 # 单个实例最大CPU核,总数=cpu*replicas=2
memory: 4 # 单个实例最大内存GB,,总数=memory*replicas=4
20:
replicas: 1
thread: 4
cpu: 4
memory: 8
50:
replicas: 1
thread: 10
cpu: 8
memory: 16
100:
replicas: 1
thread: 20
cpu: 16
memory: 32
configmap-workflowcompute.yaml: |-
apiVersion: v1
kind: ConfigMap
metadata:
name: workflowcompute
data:
application-www-computing.properties: |-
md.resource.consumer.config.maps={\
'resourceId': 'CONFIGMAP_INSTANCEID', \
'wfTopic': 'WorkFlow-CONFIGMAP_INSTANCEID', \
'wsTopic': 'WorkSheet-CONFIGMAP_INSTANCEID', \
'partition': 'CONFIGMAP_WORKFLOW_PARTITION' \
}
md.kafka.consumer.topic=WorkSheet-CONFIGMAP_INSTANCEID
md.kafka.consumer.group.id=md-workflow-consumer-CONFIGMAP_INSTANCEID
md.kafka.consumer.concurrency=CONFIGMAP_WORKFLOW_THREAD
md.kafka.batch.topic=WorkSheet-CONFIGMAP_INSTANCEID
md.kafka.batch.concurrency=CONFIGMAP_WORKFLOW_THREAD
spring.kafka.batch.topic=WorkFlow-CONFIGMAP_INSTANCEID
spring.kafka.batch.concurrency=CONFIGMAP_WORKFLOW_THREAD
spring.kafka.button.topic=WorkFlow-CONFIGMAP_INSTANCEID
spring.kafka.button.concurrency=CONFIGMAP_WORKFLOW_THREAD
spring.kafka.process.topic=WorkFlow-CONFIGMAP_INSTANCEID
spring.kafka.process.concurrency=CONFIGMAP_WORKFLOW_THREAD
spring.kafka.consumer.topic=WorkFlow-CONFIGMAP_INSTANCEID
spring.kafka.consumer.group.id=md-workflow-consumer-CONFIGMAP_INSTANCEID
spring.kafka.consumer.concurrency=CONFIGMAP_WORKFLOW_THREAD
spring.kafka.properties.partition=CONFIGMAP_WORKFLOW_PARTITION
grpc.client.MDWorksheetService.address=static://127.0.0.1:9422
spring.kafka.router.topic=WorkFlow-CONFIGMAP_INSTANCEID
deployment-workflowcompute.yaml: |-
apiVersion: apps/v1
kind: Deployment
metadata:
name: workflowcompute-DEPLOYMENT_INSTANCEID
labels:
app: workflowcompute-DEPLOYMENT_INSTANCEID
md-service: workflowcompute
spec:
replicas: DEPLOYMENT_REPLICAS
selector:
matchLabels:
app: workflowcompute-DEPLOYMENT_INSTANCEID
template:
metadata:
labels:
app: workflowcompute-DEPLOYMENT_INSTANCEID
md-service: workflowcompute
annotations:
md-update: '20231228184263'
spec:
imagePullSecrets:
- name: hub.mingdao.com
tolerations:
- key: "md"
operator: "Equal"
value: "workflowcompute"
effect: "NoSchedule"
nodeSelector:
md: workflowcompute
containers:
- name: workflow-consumer
image: registry.cn-hangzhou.aliyuncs.com/mdpublic/mingdaoyun-computinginstance:6.0.0 # computinginstance 镜像版本号
env:
- name: ENV_SERVERID
value: "single:workflowconsumer"
command:
- sh
- -c
- |
cp /usr/local/MDPrivateDeployment/workflowconsumer/application-www-computing.properties.template /usr/local/MDPrivateDeployment/workflowconsumer/application-www-computing.properties
sed -i s/CONFIGMAP_INSTANCEID/DEPLOYMENT_INSTANCEID/g /usr/local/MDPrivateDeployment/workflowconsumer/application-www-computing.properties
sed -i s/CONFIGMAP_WORKFLOW_THREAD/DEPLOYMENT_WORKFLOW_THREAD/g /usr/local/MDPrivateDeployment/workflowconsumer/application-www-computing.properties
sed -i s/CONFIGMAP_WORKFLOW_PARTITION/DEPLOYMENT_WORKFLOW_PARTITION/g /usr/local/MDPrivateDeployment/workflowconsumer/application-www-computing.properties
cat /usr/local/MDPrivateDeployment/workflowconsumer/application-www-computing.properties
sleep 20
exec /Housekeeper/main -config /Housekeeper/config.yaml
resources:
limits:
memory: DEPLOYMENT_MEMORYGi
cpu: DEPLOYMENT_CPU
requests:
memory: 1Gi
cpu: 0.25
volumeMounts:
- name: tz-config
mountPath: /etc/localtime
- name: workflowcompute
mountPath: /usr/local/MDPrivateDeployment/workflowconsumer/application-www-computing.properties.template
subPath: application-www-computing.properties
- name: worksheetservice
image: registry.cn-hangzhou.aliyuncs.com/mdpublic/mingdaoyun-computinginstance:6.0.0 # computinginstance 镜像版本号
env:
- name: ENV_SERVERID
value: "single:worksheet"
command:
- sh
- -c
- |
cat /usr/local/MDPrivateDeployment/worksheet/Config/appsettingsMain.json
exec /Housekeeper/main -config /Housekeeper/config.yaml
resources:
limits:
memory: DEPLOYMENT_MEMORYGi
cpu: DEPLOYMENT_CPU
requests:
memory: 1Gi
cpu: 0.25
readinessProbe:
tcpSocket:
port: 9422
initialDelaySeconds: 10
periodSeconds: 10
livenessProbe:
tcpSocket:
port: 9422
initialDelaySeconds: 60
periodSeconds: 10
volumeMounts:
- name: tz-config
mountPath: /etc/localtime
volumes:
- name: tz-config
hostPath:
path: /usr/share/zoneinfo/Etc/GMT-8
- name: workflowcompute
configMap:
name: workflowcompute
items:
- key: application-www-computing.properties
path: application-www-computing.properties
kubeconfig.yaml: |- # 将下方修改为 $KUBECONFIG 实际的内容,注意需要在 $KUBECONFIG 原始内容每行前添加四个空格
apiVersion: v1
clusters:
- cluster:
certificate-authority-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUMvakNDQWVhZ0F3SUJBZ0lCQURBTkJna3Foa2lHOXcwQkFRc0ZBREFWTVJNd0VRWURWUVFERXdwcmRXSmwKY201bGRHVnpNQjRYRFRJME1ERXlPVEE1TXpRMU5Wb1hEVE0wTURFeU5qQTVNelExTlZvd0ZURVRNQkVHQTFVRQpBeE1LYTNWaVpYSnVaWFJsY3pDQ0FTSXdEUVlKS29aSWh2Y05BUUVCQlFBRGdnRVBBRENDQVFvQ2dnRUJBTjR3CklsY3RBNzhlTlRPZWJOK1RoUXdDL29SamtKMlJMeUlVZ2dncU1MSWlxWWpEbytqczNKbkdpNVU4cUIrZ3RlV1AKRDhTUEVlVUd0ZmNOOHoxTzlqK0Q1aFB3dkRPRDFyV2k3OEpnZWI3SURtdkU4L1VMdWdIYldkajlTckcrWTVEYwpDakQrcFduWHAzQUkzdjhwbm45a1ZJZ2Z3RldFcFVGQWI4Y2h0WSt3MU11ZjVhNVlhSTJ3NWtwOXhVS1lmV0g0CkFWUnlCUUFFVU5TUjE1Y3EyZ3Z2WDVTT1ZXUU0xcFJYNG1jcHovZ0toZ1pCYTBoSHZJaGRIRFBxQ0o0bUNYak4KbzgrWDYzNWZ4S3JPYTV4NTFhemVJMTljeE5lOXh0V25JdDUzLzJtWVlkYjIzWVI5UDRCK3U5NWVheWZWU2JwZQo4amhvdW1qVXFoSmNHMFdiY1pNQ0F3RUFBYU5aTUZjd0RnWURWUjBQQVFIL0JBUURBZ0trTUE4R0ExVWRFd0VCCi93UUZNQU1CQWY4d0hRWURWUjBPQkJZRUZHMW1zZ01jVDBoOVpZbVlJU2pZK2wyNFRERFJNQlVHQTFVZEVRUU8KTUF5Q0NtdDFZbVZ5Ym1WMFpYTXdEUVlKS29aSWh2Y05BUUVMQlFBRGdnRUJBSHFXUDhnVDFJbXBpL1M4NVIzQwpzU0Y2V0NISFFscU5uOTh3UHdhR0dEcmFZQnUwbnhSeFk5Q243cHk3TytzZ2hLeDRpLzR5N3ZKYi84MXZWTEx2CklORGhxL2N2enp1WWtHQ0J1QStXcFVMZmhneHFsb0F4MjF3eWNScCtUTlZ5UnphNXpmUkt6RUZiZml0WU1LQk0KNkVhZmk3d3lma2twNDBDYzFoKzJMM3N4WG1sSDUyaXA4REx3WDJGVEVXRjE3VnE5WTBRdXZDcGpBSUlnY09aSgpGQjNCMHhiK0ZsUGsxZC9vakNHSzVOdDd6Z2VWQmN1VkhGSUhITSs5eWQ0dHJCVVViR05vVCszWVJXU0hxTGJECml3LzdQVDU2SFpheHA1VmUvN2p1cTZEbkRIYXQ5ZW9Idk5acEcvNUJMUW1SWUUyOFNaU3lvUnd5V3pUMkpTb24KOE8wPQotLS0tLUVORCBDRVJUSUZJQ0FURS0tLS0tCg==
server: https://192.168.0.150:6443
name: kubernetes
contexts:
- context:
cluster: kubernetes
user: kubernetes-admin
name: kubernetes-admin@kubernetes
current-context: kubernetes-admin@kubernetes
kind: Config
preferences: {}
users:
- name: kubernetes-admin
user:
client-certificate-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURJVENDQWdtZ0F3SUJBZ0lJWnJObmsyZ1RLRmd3RFFZSktvWklodmNOQVFFTEJRQXdGVEVUTUJFR0ExVUUKQXhNS2EzVmlaWEp1WlhSbGN6QWVGdzB5TkRBeE1qa3dPVE0wTlRWYUZ3MHlOVEF4TWpnd09UTTBOVGRhTURReApGekFWQmdOVkJBb1REbk41YzNSbGJUcHRZWE4wWlhKek1Sa3dGd1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0a0p6QTJjSDVxRkVHZll5bnY1TTlEOUUxQmwyZXZFcDMvUytDaFFKSWFjeW9aCkVEZnlJUUtCZ0JXUGRELzhSTFhVWm9oV2FnTy9uMHRBUnlLMnladTA4RWFjcENXV2ZFNUdUZzF1cnVTNTdhT0IKMU1KeTFQNElnODJhVml4T291bkR3d2xzSHBjNXlHdVNBTERvYklkRnJoMHJVYVZLTTJZMDN1VzFBRnhzcnFFQQpWc0t0aUQ3WjMrRzM1cmFwRTkrcDhoR0EzaVF6eHl3YWdtRUI0Sm9WU0MxbHZJekc1ME1XCi0tLS0tRU5EIFJTQSBQUklWQVRFIEtFWS0tLS0tCg==
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: computinginstance
namespace: default
spec:
replicas: 1
selector:
matchLabels:
app: computinginstance
template:
metadata:
labels:
app: computinginstance
dir: grpc
annotations:
md-update: "20231228184309"
spec:
imagePullSecrets:
- name: hub.mingdao.com
containers:
- name: computinginstance
image: registry.cn-hangzhou.aliyuncs.com/mdpublic/mingdaoyun-computinginstance:6.0.0 # computinginstance 镜像版本号
resources:
limits:
cpu: "2"
memory: 2G
requests:
cpu: "0.01"
memory: 128M
readinessProbe:
tcpSocket:
port: 9157
initialDelaySeconds: 3
periodSeconds: 3
livenessProbe:
tcpSocket:
port: 9157
initialDelaySeconds: 20
periodSeconds: 10
volumeMounts:
- name: configfile
mountPath: /usr/local/computinginstance/config.yaml
subPath: config.yaml
- name: configfile
mountPath: /usr/local/computinginstance/configmap-workflowcompute.yaml
subPath: configmap-workflowcompute.yaml
- name: configfile
mountPath: /usr/local/computinginstance/deployment-workflowcompute.yaml
subPath: deployment-workflowcompute.yaml
- name: configfile
mountPath: /usr/local/computinginstance/kubeconfig.yaml
subPath: kubeconfig.yaml
- name: tz-config
mountPath: /etc/localtime
volumes:
- name: tz-config
hostPath:
path: /usr/share/zoneinfo/Asia/Shanghai
- name: configfile
configMap:
name: computinginstance
items:
- key: config.yaml
path: config.yaml
- key: configmap-workflowcompute.yaml
path: configmap-workflowcompute.yaml
- key: deployment-workflowcompute.yaml
path: deployment-workflowcompute.yaml
- key: kubeconfig.yaml
path: kubeconfig.yaml
---
apiVersion: v1
kind: Service
metadata:
name: computinginstance
namespace: default
spec:
selector:
app: computinginstance
ports:
- name: http-computinginstance
port: 9157
targetPort: 9157
nodePort: 9157
type: NodePort -
重启服务
cd /data/mingdao/script/kubernetes/
bash restart.sh
验证
获取 default 命名空间下 获取所有以 workflowcompute-
和 computinginstance
开头的 deployments
ns="default"
deployments=$(kubectl -n $ns get deployments -o jsonpath='{.items[*].metadata.name}' | tr ' ' '\n' | grep '^workflowcompute-\|computinginstance')
for deploy in $deployments
do
echo "Namespace: $ns, Deployment: $deploy"
# 获取并打印 deployment 的镜像
kubectl -n $ns get deployment $deploy -o jsonpath='{.spec.template.spec.containers[*].image}'
echo
done
输出示例:
Namespace: default, Deployment: computinginstance
registry.cn-hangzhou.aliyuncs.com/mdpublic/mingdaoyun-computinginstance:6.0.0
Namespace: default, Deployment: workflowcompute-7e4wf0fea4ho
registry.cn-hangzhou.aliyuncs.com/mdpublic/mingdaoyun-computinginstance:6.0.0
workflowcompute-
开头的 deployment 只有在页面上创建了专属算力资源后才会有
查看污点是否生效
kubectl get pod -o wide | grep workflowcompute-
- 正常应为容器运行在专属算力的节点上
查看 kafka
/usr/local/kafka/bin/kafka-consumer-groups.sh --bootstrap-server ${ENV_KAFKA_ENDPOINTS:=127.0.0.1:9092} --describe --group md-workflow-consumer-7e4wf0fea4ho
- 这里以资源 ID 为
7e4wf0fea4ho
为例