跳到主要内容
版本:v1.2

安装

Koordinator 依赖 Kubernetes version >= 1.18

Koordinator 需要从 kubelet 只读端口收集指标(默认设置为禁用)。 更多信息 here.

为了最好的体验,koordinator 推荐 linux kernel 4.19 或者更高版本。

使用 Helm 安装

Koordinator 可以使用 Helm v3.5+ 安装, Helm 是一个简单的命令行工具,更多信息 here.

# Firstly add koordinator charts repository if you haven't do this.
$ helm repo add koordinator-sh https://koordinator-sh.github.io/charts/

# [Optional]
$ helm repo update

# Install the latest version.
$ helm install koordinator koordinator-sh/koordinator --version 1.2.0

使用 Helm 升级

# Firstly add koordinator charts repository if you haven't do this.
$ helm repo add koordinator-sh https://koordinator-sh.github.io/charts/

# [Optional]
$ helm repo update

# Upgrade the latest version.
$ helm upgrade koordinator koordinator-sh/koordinator --version 1.2.0 [--force]

注意:

  1. 升级前,为确保你了解新版本中的重大更改,你 必须 先阅读 变更日志
  2. 如果你想删除或者新增旧版本中的 Chart 参数,推荐在 helm upgrade 命令中添加参数 --reset-values 。否则,你应该使用 --reuse-values 参数来恢复上一个版本的值。

可选:手动下载 Charts

如果你在生产环境中连接到 https://koordinator-sh.github.io/charts/ 时遇到问题,你可能需要从 此处 手动下载 Charts 进行安装或升级。

$ helm install/upgrade koordinator /PATH/TO/CHART

安装 koord-runtime-proxy

koord-runtime-proxy 充当 Kubelet 和 Containerd 之间的代理(Dockershim 场景下的 Dockerd),旨在拦截 CRI 请求, 并应用一些资源管理策略,比如在混合工作负载编排场景下通过 Pod 优先级设置不同的 CGroup 参数,为最新的 Linux 内核应用新的隔离策略, CPU 架构等等。

1、下载二进制文件

从 Github 下载:

$ # select the version
$ wget https://github.com/koordinator-sh/koordinator/releases/download/v1.2.0/koord-runtime-proxy_1.2.0_linux_x86_64 -O koord-runtime-proxy
$ chmod +x koord-runtime-proxy

或者,你可以从源代码开始构建:

$ git clone https://github.com/koordinator-sh/koordinator.git
$ cd koordinator
$ make build-koord-runtime-proxy

2、设置 koord-runtime-proxy

首先,请确保你的运行时后端是 Containerd 或 Dockerd。

在 Containerd 场景下,如果 Containerd 在默认的 /var/run/containerd/containerd.sock 监听 CRI 请求,koord-runtime-proxy 可以这样设置(无需任何参数):

koord-runtime-proxy

或者使用以下命令设置:

koord-runtime-proxy \
--remote-runtime-service-endpoint=<runtime socketFile path> \
--remote-image-service-endpoint=<image socketFile path>

在 Docker 的场景下,koord-runtime-proxy 应该使用附加参数设置 --backend-runtime-mode Docker,无需 remote-image-service-endpoint:

koord-runtime-proxy \
--backend-runtime-mode=Docker \
--remote-runtime-service-endpoint=<runtime socketFile path>

koord-runtime-proxy 将监听 /var/run/koord-runtimeproxy/runtimeproxy.sock

3、设置 Kubelet

要使 koord-runtime-proxy 成为 Kubelet 和 Containerd 之间的代理,应修改 Kubelet 参数,如下所示:

kubelet <other options> \
--container-runtime=remote \
--container-runtime-endpoint=unix:///var/run/koord-runtimeproxy/runtimeproxy.sock

在 Docker 的场景下, 应修改 Kubelet 参数如下:

kubelet <other options> --docker-endpoint=unix:///var/run/koord-runtimeproxy/runtimeproxy.sock

可选

请注意,直接安装这个 Chart 意味着使用 Koordinator 的默认模板值。

如果将其部署到生产集群中,或者你想要配置 feature-gates,你可能需要设置特定配置。

可选: Chart 参数

下表列出了 Chart 可配置参数及其默认值。

ParameterDescriptionDefault
featureGatesFeature gates for Koordinator, empty string means all by default
installation.namespacenamespace for Koordinator installationkoordinator-system
installation.createNamespaceWhether to create the installation.namespacetrue
imageRepositoryHostImage repository hostghcr.io
manager.log.levelLog level that koord-manager printed4
manager.replicasReplicas of koord-manager deployment2
manager.image.repositoryRepository for koord-manager imagekoordinatorsh/koord-manager
manager.image.tagTag for koord-manager imagev1.2.0
manager.resources.limits.cpuCPU resource limit of koord-manager container1000m
manager.resources.limits.memoryMemory resource limit of koord-manager container1Gi
manager.resources.requests.cpuCPU resource request of koord-manager container500m
manager.resources.requests.memoryMemory resource request of koord-manager container256Mi
manager.metrics.portPort of metrics served8080
manager.webhook.portPort of webhook served9443
manager.nodeAffinityNode affinity policy for koord-manager pod{}
manager.nodeSelectorNode labels for koord-manager pod{}
manager.tolerationsTolerations for koord-manager pod[]
manager.resyncPeriodResync period of informer koord-manager, defaults no resync0
manager.hostNetworkWhether koord-manager pod should run with hostnetworkfalse
scheduler.log.levelLog level that koord-scheduler printed4
scheduler.replicasReplicas of koord-scheduler deployment2
scheduler.image.repositoryRepository for koord-scheduler imagekoordinatorsh/koord-scheduler
scheduler.image.tagTag for koord-scheduler imagev1.2.0
scheduler.resources.limits.cpuCPU resource limit of koord-scheduler container1000m
scheduler.resources.limits.memoryMemory resource limit of koord-scheduler container1Gi
scheduler.resources.requests.cpuCPU resource request of koord-scheduler container500m
scheduler.resources.requests.memoryMemory resource request of koord-scheduler container256Mi
scheduler.portPort of metrics served10251
scheduler.nodeAffinityNode affinity policy for koord-scheduler pod{}
scheduler.nodeSelectorNode labels for koord-scheduler pod{}
scheduler.tolerationsTolerations for koord-scheduler pod[]
scheduler.hostNetworkWhether koord-scheduler pod should run with hostnetworkfalse
koordlet.log.levelLog level that koordlet printed4
koordlet.image.repositoryRepository for koordlet imagekoordinatorsh/koordlet
koordlet.image.tagTag for koordlet imagev1.2.0
koordlet.resources.limits.cpuCPU resource limit of koordlet container500m
koordlet.resources.limits.memoryMemory resource limit of koordlet container256Mi
koordlet.resources.requests.cpuCPU resource request of koordlet container0
koordlet.resources.requests.memoryMemory resource request of koordlet container0
koordlet.enableServiceMonitorWhether to enable ServiceMonitor for koordletfalse
webhookConfiguration.failurePolicy.podsThe failurePolicy for pods in mutating webhook configurationIgnore
webhookConfiguration.timeoutSecondsThe timeoutSeconds for all webhook configuration30
crds.managedKoordinator will not install CRDs with chart if this is falsetrue
imagePullSecretsThe list of image pull secrets for koordinator imagefalse

使用 helm installhelm upgrade--set key=value[,key=value] 参数指定每个参数。

可选: feature-gate

Feature-Gate 控制 Koordinator 中的一些有影响力的功能:

NameDescriptionDefaultEffect (if closed)
PodMutatingWebhookWhether to open a mutating webhook for Pod createtrueDon't inject koordinator.sh/qosClass, koordinator.sh/priority and don't replace koordinator extend resources ad so on
PodValidatingWebhookWhether to open a validating webhook for Pod create/updatetrueIt is possible to create some Pods that do not conform to the Koordinator specification, causing some unpredictable problems

如果要配置 feature-gate ,只需在安装或升级时设置参数即可。如:

$ helm install koordinator https://... --set featureGates="PodMutatingWebhook=true\,PodValidatingWebhook=true"

如果要启用所有 feature-gates ,请将参数设置为 featureGates=AllAlpha=true

可选: 中国本地镜像

如果你在中国并且无法从官方 DockerHub 拉取镜像,你可以使用托管在阿里云上的镜像仓库:

$ helm install koordinator https://... --set imageRepositoryHost=registry.cn-beijing.aliyuncs.com

最佳实践

AWS EKS 的安装参数

在 EKS 上使用自定义 CNI(例如 Weave 或 Calico)时,默认情况下无法访问 webhook。发生这种情况是因为在 EKS 上控制平面无法配置运行自定义 CNI ,因此控制平面和工作节点之间的 CNI 不同。

为了解决这个问题,使用 helm install 或 upgrade 时设置 --set manager.hostNetwork=true,webhook 可以在主机网络中运行。

卸载

请注意,这将导致 Koordinator 创建的所有资源,包括 Webhook 配置、Services、Namespace、CRD 和由 Koordinator 控制器管理的 CR 实例,都被删除! 请在充分了解后果的情况下才这样做。

卸载通过 Chart 安装的 Koordinator :

$ helm uninstall koordinator
release "koordinator" uninstalled