https://rancher.com/ logo
Title
b

brash-businessperson-80975

08/19/2022, 11:06 PM
Does anyone know if you can use K3D to create multiple clusters from a single config file?
m

many-telephone-82541

08/20/2022, 8:18 AM
I'm guessing yes but with multiple command invocations or at least by using
for
loop
👍 1
w

wide-garage-9465

08/20/2022, 9:46 AM
Yep, what @many-telephone-82541 wrote. You at least need to overwrite the cluster name.
b

brash-businessperson-80975

08/21/2022, 2:58 AM
@many-telephone-82541 Yeah a
for
loop works, but I was hoping to use a command such as
k3d cluster create --config multi-clusters.yaml
using a config file such as
---
apiVersion: <http://k3d.io/v1alpha4|k3d.io/v1alpha4>
kind: Simple
metadata:
  name: cluster1
servers: 1
agents: 4
image: <http://docker.io/rancher/k3s:v1.22.7-k3s1|docker.io/rancher/k3s:v1.22.7-k3s1>
kubeAPI:
  hostPort: "30001"
ports:
  - port: 8081:80
    nodeFilters:
      - loadbalancer
  - port: 8444:443
    nodeFilters:
      - loadbalancer    

---
apiVersion: <http://k3d.io/v1alpha4|k3d.io/v1alpha4>
kind: Simple
metadata:
  name: cluster2
servers: 1
agents: 4
image: <http://docker.io/rancher/k3s:v1.22.7-k3s1|docker.io/rancher/k3s:v1.22.7-k3s1>
kubeAPI:
  hostPort: "30002"
ports:
  - port: 8082:80
    nodeFilters:
      - loadbalancer
  - port: 8445:443
    nodeFilters:
      - loadbalancer
w

wide-garage-9465

08/21/2022, 6:40 AM
That could be fairly simple to implement. Feel free to open a feature request for this. Back when I put in config file support, I was thinking of a ClusterList API type. That would be something for v6... If I will ever get to enough funding to spend more time on this... Or more contributors 🙂
b

brash-businessperson-80975

08/21/2022, 7:03 AM
@wide-garage-9465 Thanks for all your hard work and your suggestion. I will put in a feature request. Unfortunately I'm not familiar enough with Go or I would contribute to this feature.
❤️ 1
w

wide-garage-9465

08/21/2022, 8:47 PM
@brash-businessperson-80975 thanks for the coffee 🙏 Much appreciated 🙂
👍 3
1