K3d cluster create - 图1

K3d cluster create

k3d cluster create

Create a new cluster

Synopsis

Create a new k3s cluster with containerized nodes (k3s in docker). Every cluster will consist of one or more containers:

  • 1 (or more) server node container (k3s)
  • (optionally) 1 loadbalancer container as the entrypoint to the cluster (nginx)
  • (optionally) 1 (or more) agent node containers (k3s)
  1. k3d cluster create NAME [flags]

Options

  1. -a, --agents int Specify how many agents you want to create
  2. --agents-memory string Memory limit imposed on the agents nodes [From docker]
  3. --api-port [HOST:]HOSTPORT Specify the Kubernetes API server port exposed on the LoadBalancer (Format: [HOST:]HOSTPORT)
  4. - Example: `k3d cluster create --servers 3 --api-port 0.0.0.0:6550`
  5. -c, --config string Path of a config file to use
  6. -e, --env KEY[=VALUE][@NODEFILTER[;NODEFILTER...]] Add environment variables to nodes (Format: KEY[=VALUE][@NODEFILTER[;NODEFILTER...]]
  7. - Example: `k3d cluster create --agents 2 -e "HTTP_PROXY=my.proxy.com@server:0" -e "SOME_KEY=SOME_VAL@server:0"`
  8. --gpus string GPU devices to add to the cluster node containers ('all' to pass all GPUs) [From docker]
  9. -h, --help help for create
  10. --host-alias ip:host[,host,...] Add ip:host[,host,...] mappings
  11. --host-pid-mode Enable host pid mode of server(s) and agent(s)
  12. -i, --image string Specify k3s image that you want to use for the nodes
  13. --k3s-arg ARG@NODEFILTER[;@NODEFILTER] Additional args passed to k3s command (Format: ARG@NODEFILTER[;@NODEFILTER])
  14. - Example: `k3d cluster create --k3s-arg "--disable=traefik@server:0"`
  15. --k3s-node-label KEY[=VALUE][@NODEFILTER[;NODEFILTER...]] Add label to k3s node (Format: KEY[=VALUE][@NODEFILTER[;NODEFILTER...]]
  16. - Example: `k3d cluster create --agents 2 --k3s-node-label "my.label@agent:0,1" --k3s-node-label "other.label=somevalue@server:0"`
  17. --kubeconfig-switch-context Directly switch the default kubeconfig's current-context to the new cluster's context (requires --kubeconfig-update-default) (default true)
  18. --kubeconfig-update-default Directly update the default kubeconfig with the new cluster's context (default true)
  19. --lb-config-override strings Use dotted YAML path syntax to override nginx loadbalancer settings
  20. --network string Join an existing network
  21. --no-image-volume Disable the creation of a volume for importing images
  22. --no-lb Disable the creation of a LoadBalancer in front of the server nodes
  23. --no-rollback Disable the automatic rollback actions, if anything goes wrong
  24. -p, --port [HOST:][HOSTPORT:]CONTAINERPORT[/PROTOCOL][@NODEFILTER] Map ports from the node containers (via the serverlb) to the host (Format: [HOST:][HOSTPORT:]CONTAINERPORT[/PROTOCOL][@NODEFILTER])
  25. - Example: `k3d cluster create --agents 2 -p 8080:80@agent:0 -p 8081@agent:1`
  26. --registry-config string Specify path to an extra registries.yaml file
  27. --registry-create NAME[:HOST][:HOSTPORT] Create a k3d-managed registry and connect it to the cluster (Format: NAME[:HOST][:HOSTPORT]
  28. - Example: `k3d cluster create --registry-create mycluster-registry:0.0.0.0:5432`
  29. --registry-use stringArray Connect to one or more k3d-managed registries running locally
  30. --runtime-label KEY[=VALUE][@NODEFILTER[;NODEFILTER...]] Add label to container runtime (Format: KEY[=VALUE][@NODEFILTER[;NODEFILTER...]]
  31. - Example: `k3d cluster create --agents 2 --runtime-label "my.label@agent:0,1" --runtime-label "other.label=somevalue@server:0"`
  32. --runtime-ulimit NAME[=SOFT]:[HARD] Add ulimit to container runtime (Format: NAME[=SOFT]:[HARD]
  33. - Example: `k3d cluster create --agents 2 --runtime-ulimit "nofile=1024:1024" --runtime-ulimit "noproc=1024:1024"`
  34. -s, --servers int Specify how many servers you want to create
  35. --servers-memory string Memory limit imposed on the server nodes [From docker]
  36. --subnet 172.28.0.0/16 [Experimental: IPAM] Define a subnet for the newly created container network (Example: 172.28.0.0/16)
  37. --timeout duration Rollback changes if cluster couldn't be created in specified duration.
  38. --token string Specify a cluster token. By default, we generate one.
  39. -v, --volume [SOURCE:]DEST[@NODEFILTER[;NODEFILTER...]] Mount volumes into the nodes (Format: [SOURCE:]DEST[@NODEFILTER[;NODEFILTER...]]
  40. - Example: `k3d cluster create --agents 2 -v /my/path@agent:0,1 -v /tmp/test:/tmp/other@server:0`
  41. --wait Wait for the server(s) to be ready before returning. Use '--timeout DURATION' to not wait forever. (default true)

Options inherited from parent commands

  1. --timestamps Enable Log timestamps
  2. --trace Enable super verbose output (trace logging)
  3. --verbose Enable verbose output (debug logging)

SEE ALSO


Last update: June 30, 2023