Skip to content

[FEATURE] Ability to pass in --platform for docker client while creating clusters/nodes #1602

@cenk1cenk2

Description

@cenk1cenk2

Is your feature request related to a problem or a Pull Request

Please link to the issue/PR here and explain how your request is related to it.

Scope of your request

  • a new flag for a command
    • proposing a --platform argument here for commands cluster create and node create
  • config entry
    • proposing a config entry as follows
      options:
        platforms:
           - platform: linux/arm64/v8
             nodeFilters:
                 - server:*
                 - agent:*

Describe the solution you'd like

Currently k3d can not create an emulated environment in linux/amd64 environment for linux/arm64/v8 or similar since in https://github.com/k3d-io/k3d/blob/main/pkg/runtimes/docker/container.go#L54-L54, containers are created without the ocispecv1.Platform as nil. The docker go client does not directly support DOCKER_DEFAULT_PLATFORM environment variable to set this automatically like the CLI.

  • I would propose to implement a flag called --platform where this gets passed into cluster create and node create commands, where the user can set a platform for the created cluster or node.
  • This can be also added to the config file under options.runtime.platform. This should be also relevant to the master and worker nodes as well as loadbalancer and tool containers. However a nodeFilters mechanism can be implemented here, like the labels to make this more configurable.

Describe alternatives you've considered

  • Pulling and running the images with the designated architecture like rancher/k3s:v1.32.7-k3s1-arm64 does not work properly.

Notes

I can implement this as a contribution; however, I am not sure if this would be an appropriate merge request for the repository and would be accepted. Therefore, I am opening up an issue first to get your input on it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions