Skip to content

k8s 相关的功能,是否完整? #31

Closed

Description

@musionx

你好,我非常喜欢这个软件,目前也在使用中,想咨询下,K8s编排相关的功能,目前是还不太完整吗?似乎没有地方能调整节点的数量?还是我理解的有问题,单机上无法模拟多节点?

Activity

  1. sembsa commented on Sep 17, 2026

    @sembsa
    Owner

    你好,谢谢你的反馈,也很高兴你在用这个软件 🙂

    你的理解是对的 —— 目前单机上无法模拟多节点,而且这不是 Container Desktop 少做了什么,是 container 自带的 k8s 插件本身就只支持单节点。

    container k8s create 的全部选项是:--name、--rm、--cpus、--memory、--node-image、--cni,以及镜像仓库和拉取相关的选项。没有任何关于节点数量的参数,也没有 add-node 之类的子命令(插件只有 create / delete / list / load-image / start / write-config)。

    从上游源码看得更清楚 —— 一个集群就是一个节点,同时担任 control-plane 和 worker,并且控制平面是可调度的:

    let provisioner = try LinuxNodeProvisioner(
        clusterName: name,
        roles: [StandardRoles.controlPlane, StandardRoles.worker],
        ...
    )
    try await provisioner.provision(name: name, log: log)

    (Sources/ContainerK8s/Commands/K8sCreate.swift)

    所以 GUI 里没有"节点数量"这一项,是因为底层根本没有这个开关。

    目前支持的是多个集群,而不是一个集群里的多个节点。 你可以并行创建多个命名集群,各自独立、版本也可以不同:

    container k8s create --name dev
    container k8s create --name test

    Container Desktop 完整支持这种用法。如果你确实需要真正的多节点来测试调度、亲和性、节点故障之类的场景,kind、k3d 和 minikube 都支持多节点,可以作为补充。


    顺便说一个我在核对时发现的真实缺口:container k8s create 支持 --cni(应用自定义 CNI manifest),但 Container Desktop 目前没有把这个选项放到界面上。如果你用得到,我可以加进去 —— 告诉我一声就行。

    另外想请教一下:多节点对你的使用场景有多重要?如果是刚需,值得往上游 apple/container 提一个 feature request,这样更有机会被实现。


    English

    Thanks for the kind words, and for the question.

    Your understanding is correct — multi-node is not possible today, and this is not something missing from Container Desktop: the container k8s plugin itself is single-node only.

    Every option container k8s create accepts is --name, --rm, --cpus, --memory, --node-image, --cni, plus registry and image-fetch flags. There is no node-count parameter, and no add-node style subcommand — the plugin only has create / delete / list / load-image / start / write-config.

    Upstream makes it explicit: one cluster is one node, carrying both roles, with a schedulable control plane (the snippet above, from Sources/ContainerK8s/Commands/K8sCreate.swift).

    So the GUI has no "number of nodes" field because there is no such switch underneath it.

    What is supported is multiple clusters, not multiple nodes in one cluster — independent, and they can even run different Kubernetes versions side by side. Container Desktop fully supports that. If you genuinely need multi-node to test scheduling, affinity or node failure, kind, k3d and minikube all do multi-node.

    One real gap I did find while checking: container k8s create supports --cni for a custom CNI manifest, and Container Desktop does not surface it yet. Happy to add it if that is useful to you.

    And a question back: how important is multi-node for what you are doing? If it is a blocker, it is worth raising upstream at apple/container — that is where it would have to be implemented.

  2. sembsa commented on Sep 21, 2026

    @sembsa
    Owner

    补充一下:上面提到的 --cni 已经加好了,随 0.8.0 发布。

    创建 Kubernetes 集群时,"高级"一节里多了一个 CNI 清单字段,在节点镜像旁边,带文件选择按钮。留空则使用默认网络。

    关于节点数量:结论没有变化 —— 上游插件仍然是单节点,没有相关参数。如果多节点对你是刚需,值得去 apple/container 提 feature request,那边才是能实现它的地方。


    Just to follow up: the --cni support mentioned above is in, shipped with 0.8.0.

    Creating a Kubernetes cluster now has a CNI manifest field under "Advanced", next to the node image, with a file picker. Leave it empty for the default network.

    On node count, nothing has changed: the upstream plugin is still single-node and has no parameter for it. If multi-node is a blocker for you, apple/container is where it would have to be implemented.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions