This message was deleted.
# k3d
a
This message was deleted.
h
Does it work if you use the k3d command line instead?
The command does some additional set up as well IIRC
s
hi @high-morning-12231 i'm trying to see if this can run in CI, cloud build. it runs fine from OS X using the binary
Copy code
k3d cluster create test
INFO[0000] Prep: Network                                
INFO[0000] Created network 'k3d-test'                   
INFO[0000] Created image volume k3d-test-images         
INFO[0000] Starting new tools node...                   
INFO[0000] Pulling image '<http://ghcr.io/k3d-io/k3d-tools:5.5.1|ghcr.io/k3d-io/k3d-tools:5.5.1>' 
INFO[0001] Creating node 'k3d-test-server-0'            
INFO[0002] Starting Node 'k3d-test-tools'               
INFO[0002] Pulling image '<http://docker.io/rancher/k3s:v1.26.4-k3s1|docker.io/rancher/k3s:v1.26.4-k3s1>' 
INFO[0008] Creating LoadBalancer 'k3d-test-serverlb'    
INFO[0009] Pulling image '<http://ghcr.io/k3d-io/k3d-proxy:5.5.1|ghcr.io/k3d-io/k3d-proxy:5.5.1>' 
INFO[0011] Using the k3d-tools node to gather environment information 
INFO[0011] Starting new tools node...                   
INFO[0011] Starting Node 'k3d-test-tools'               
INFO[0012] Starting cluster 'test'                      
INFO[0012] Starting servers...                          
INFO[0012] Starting Node 'k3d-test-server-0'            
INFO[0016] All agents already running.                  
INFO[0016] Starting helpers...                          
INFO[0016] Starting Node 'k3d-test-serverlb'            
INFO[0022] Injecting records for hostAliases (incl. host.k3d.internal) and for 3 network members into CoreDNS configmap... 
INFO[0025] Cluster 'test' created successfully!         
INFO[0025] You can now use it like this:                
kubectl cluster-info
I guess I'll try to build my own image and mess w/ iptables there's nothing obvious in the
k3d cluster create --help
that would disable iptables or anything network related besides choosing a subnet cidr, is there ?
having some success w/ this docker-compose service setup in a cloud build job
Copy code
k3d-init:
    image: rancher/k3d
    command: ["run", "-d", "--privileged", "--name", "k3d", "--hostname", "k3d", "-p", "6443:6443", "rancher/k3d"]
    platform: linux/amd64
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - /cache:/cache
    networks:
      - cloudbuild
trying to build my own image using the k3d/Dockerfile but the build is stuck
nm just takes like 5 minutes
it's almost working now, but failing to pull the k3s-tools image:
Copy code
Step #3: k3d            | ERRO[0006] Failed to run tools container for cluster 'k3s-default' 
Step #3: k3d            | ERRO[0006] failed to gather environment information used for cluster creation: failed to run k3d-tools node for cluster 'k3s-default': failed to create node 'k3d-k3s-default-tools': runtime failed to create node 'k3d-k3s-default-tools': failed to create container for node 'k3d-k3s-default-tools': docker failed to pull image '<http://ghcr.io/k3d-io/k3d-tools:1afe3603|ghcr.io/k3d-io/k3d-tools:1afe3603>': docker failed to pull the image '<http://ghcr.io/k3d-io/k3d-tools:1afe3603|ghcr.io/k3d-io/k3d-tools:1afe3603>': Error response from daemon: manifest unknown 
Step #3: k3d            | ERRO[0006] Failed to create cluster >>> Rolling Back
Copy code
docker pull <http://ghcr.io/k3d-io/k3d-tools:1afe3603|ghcr.io/k3d-io/k3d-tools:1afe3603>
Error response from daemon: manifest unknown
how can i tell k3d to use a different tools image? 🤔
w
You can use the K3D_IMAGE_TOOLS and K3D_IMAGE_LOADBALANCER env vars
K3d doesn't do much about networking by itself. The error you posted initially looks like it's from the DinD startup script, so not coming from k3d.
s
interesting, so I forked the repo, added the ip tables for the k3d/Dockerfile, and that got me past the iptables issue. Now I just did a docker build -t <my-gcr-repo> . and so I dont get any of the k3d master branch CI magic, so perhaps that's why the k3d-tools image was misnamed?
<http://ghcr.io/k3d-io/k3d-tools:1afe3603|ghcr.io/k3d-io/k3d-tools:1afe3603>
is not a valid image, but
<http://ghcr.io/k3d-io/k3d-tools:sha-1afe3603|ghcr.io/k3d-io/k3d-tools:sha-1afe3603>
is valid
this is now creating the cluster in google cloud build, using a custom built k3d image
Copy code
k3d-init:
    image: <http://gcr.io/my-fork/k3d:latest|gcr.io/my-fork/k3d:latest>
    command: ["--verbose", "cluster", "create", "--no-lb", "--image", "rancher/k3s:latest"]
    depends_on:
      - k3d-version
    environment:
      - K3D_IMAGE_TOOLS=<http://ghcr.io/k3d-io/k3d-tools:latest|ghcr.io/k3d-io/k3d-tools:latest>
    platform: linux/amd64
    privileged: true
    container_name: k3d
    hostname: k3d
    ports:
      - "6443:6443"
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - /cache:/cache
      - /tmp:/tmp
    networks:
      - cloudbuild
138 Views