16.4.2. 打包调度程序
在集群中包含自定义调度程序的常规流程涉及创建镜像,并将该镜像包含在部署中。
- 将调度程序二进制文件打包到容器镜像中。
创建包含调度程序二进制文件的容器镜像。
例如:
FROM <source-image> ADD <path-to-binary> /usr/local/bin/kube-scheduler
将文件保存为 Dockerfile,构建镜像并将其推送到 Registry。
例如:
docker build -t <dest_env_registry_ip>:<port>/<namespace>/<image name>:<tag> docker push <dest_env_registry_ip>:<port>/<namespace>/<image name>:<tag>
在 OpenShift Container Platform 中,为自定义调度程序创建一个部署。
apiVersion: v1 kind: ServiceAccount metadata: name: custom-scheduler namespace: kube-system --- apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRoleBinding metadata: name: custom-scheduler subjects: - kind: ServiceAccount name: custom-scheduler namespace: kube-system roleRef: kind: ClusterRole name: system:kube-scheduler apiGroup: rbac.authorization.k8s.io --- apiVersion: apps/v1 kind: Deployment metadata: name: custom-scheduler namespace: kube-system labels: app: custom-scheduler spec: replicas: 1 selector: matchLabels: app: custom-scheduler template: metadata: labels: app: custom-scheduler spec: serviceAccount: custom-scheduler containers: - name: custom-scheduler image: "<namespace>/<image name>:<tag>" 1 imagePullPolicy: Always
- 1
- 指定您为自定义调度程序创建的容器镜像。