-
-
Notifications
You must be signed in to change notification settings - Fork 514
Closed
Labels
questionFurther information is requestedFurther information is requested
Description
Description:
Creating a Kubernetes cluster with k3d on NixOS fails during the server node startup, leaving the cluster creation incomplete.
Steps to Reproduce:
- Navigate to the directory containing
sample.sh.
Step 1 - Details
sample.sh
export NIXPKGS_ALLOW_UNFREE=1
nix-shell -E '
let
nixpkgs = import (fetchTarball "https://github.com/NixOS/nixpkgs/archive/nixos-unstable.tar.gz") {};
in
nixpkgs.mkShell {
buildInputs = with nixpkgs; [ k3d kubectl kubernetes-helm docker ];
shellHook = "export KUBECONFIG=kubeconfig";
}'
- Execute
sample.shon a NixOS environment. - Observe the cluster creation process stall at starting the server node.
Step 4: - Details
Error
k3d cluster create --api-port 6550 -p "8081:80@loadbalancer" --agents 2
INFO[0000] portmapping '8081:80' targets the loadbalancer: defaulting to [servers:*:proxy agents:*:proxy]
INFO[0000] Prep: Network
INFO[0000] Created network 'k3d-k3s-default'
INFO[0000] Created image volume k3d-k3s-default-images
INFO[0000] Starting new tools node...
INFO[0000] Starting Node 'k3d-k3s-default-tools'
INFO[0001] Creating node 'k3d-k3s-default-server-0'
INFO[0004] Pulling image 'docker.io/rancher/k3s:v1.21.7-k3s1'
INFO[0019] Creating node 'k3d-k3s-default-agent-0'
INFO[0019] Creating node 'k3d-k3s-default-agent-1'
INFO[0019] Creating LoadBalancer 'k3d-k3s-default-serverlb'
INFO[0019] Using the k3d-tools node to gather environment information
INFO[0019] HostIP: using network gateway 172.26.0.1 address
INFO[0019] Starting cluster 'k3s-default'
INFO[0019] Starting servers...
INFO[0019] Starting Node 'k3d-k3s-default-server-0'
Extra:
k3d cluster list --verbose --trace
DEBU[0000] DOCKER_SOCK=/var/run/docker.sock
DEBU[0000] Runtime Info:
&{Name:docker Endpoint:/var/run/docker.sock Version:20.10.25 OSType:linux OS:NixOS 23.05 (Stoat) Arch:x86_64 CgroupVersion:2 CgroupDriver:systemd Filesystem:extfs InfoName:nixos}
TRAC[0000] Listing Clusters...
TRAC[0000] TranslateContainerDetailsToNode: Checking for default object label app=k3d on container /k3d-k3s-default-serverlb
TRAC[0000] TranslateContainerDetailsToNode: Checking for default object label app=k3d on container /k3d-k3s-default-agent-1
TRAC[0000] TranslateContainerDetailsToNode: Checking for default object label app=k3d on container /k3d-k3s-default-agent-0
TRAC[0000] TranslateContainerDetailsToNode: Checking for default object label app=k3d on container /k3d-k3s-default-server-0
DEBU[0000] Found 4 nodes
TRAC[0000] Found node k3d-k3s-default-serverlb of role loadbalancer
TRAC[0000] Found node k3d-k3s-default-agent-1 of role agent
TRAC[0000] Found node k3d-k3s-default-agent-0 of role agent
TRAC[0000] Found node k3d-k3s-default-server-0 of role server
TRAC[0000] Filteres 4 nodes by roles (in: [server agent loadbalancer] | ex: [registry]), got 4 left
TRAC[0000] Found 4 cluster-internal nodes
TRAC[0000] Found cluster-internal node k3d-k3s-default-serverlb of role loadbalancer belonging to cluster k3s-default
TRAC[0000] Found cluster-internal node k3d-k3s-default-agent-1 of role agent belonging to cluster k3s-default
TRAC[0000] Found cluster-internal node k3d-k3s-default-agent-0 of role agent belonging to cluster k3s-default
TRAC[0000] Found cluster-internal node k3d-k3s-default-server-0 of role server belonging to cluster k3s-default
DEBU[0000] Found 1 clusters
NAME SERVERS AGENTS LOADBALANCER
k3s-default 1/1 0/2 true
Environment:
- OS: NixOS 23.05 (Stoat)
- k3d Version: k3d version v5.6.0 k3s version v1.21.7-k3s1 (default)
- kubectl Version: kubectl version Client Version: v1.29.3 Kustomize Version: v5.0.4-0.20230601165947-6ce0bf390ce3
- Docker Version: 20.10.25
Error Message:
INFO[0019] Starting Node 'k3d-k3s-default-server-0'
Workaround:
No known workaround exists currently. Users are unable to create Kubernetes clusters using k3d on NixOS until this issue is resolved.
Logs - Creating Sample Cluster on NIXOS
k3d cluster create sample
INFO[0000] Prep: Network
INFO[0000] Created network 'k3d-sample'
INFO[0000] Created image volume k3d-sample-images
INFO[0000] Starting new tools node...
INFO[0000] Starting Node 'k3d-sample-tools'
INFO[0001] Creating node 'k3d-sample-server-0'
INFO[0001] Creating LoadBalancer 'k3d-sample-serverlb'
INFO[0001] Using the k3d-tools node to gather environment information
INFO[0001] HostIP: using network gateway 172.28.0.1 address
INFO[0001] Starting cluster 'sample'
INFO[0001] Starting servers...
INFO[0001] Starting Node 'k3d-sample-server-0'
^C
[nix-shell:~/app]$ k3d cluster delete sample --verbose --trace
DEBU[0000] DOCKER_SOCK=/var/run/docker.sock
DEBU[0000] Runtime Info:
&{Name:docker Endpoint:/var/run/docker.sock Version:20.10.25 OSType:linux OS:NixOS 23.05 (Stoat) Arch:x86_64 CgroupVersion:2 CgroupDriver:systemd Filesystem:extfs InfoName:nixos}
DEBU[0000] Configuration:
{}
TRAC[0000] TranslateContainerDetailsToNode: Checking for default object label app=k3d on container /k3d-sample-serverlb
TRAC[0000] TranslateContainerDetailsToNode: Checking for default object label app=k3d on container /k3d-sample-server-0
TRAC[0000] Reading path /etc/confd/values.yaml from node k3d-sample-serverlb...
ERRO[0000] error getting loadbalancer config from k3d-sample-serverlb: runtime failed to read loadbalancer config '/etc/confd/values.yaml' from node 'k3d-sample-serverlb': Error response from daemon: Could not find the file /etc/confd/values.yaml in container 54f40f1d37d4f8e818979ab075f9ffe0007abc955019a8e157a73a2ba3aeba85: file not found
INFO[0000] Deleting cluster 'sample'
TRAC[0000] TranslateContainerDetailsToNode: Checking for default object label app=k3d on container /k3d-sample-serverlb
TRAC[0000] TranslateContainerDetailsToNode: Checking for default object label app=k3d on container /k3d-sample-server-0
DEBU[0000] Cluster Details: &{Name:sample Network:{Name:k3d-sample ID: External:false IPAM:{IPPrefix:invalid Prefix IPsUsed:[] Managed:false} Members:[]} Token:DXLYiwAZRCPUYDfwtOdy Nodes:[0xc00051fba0 0xc000017040] InitNode:<nil> ExternalDatastore:<nil> KubeAPI:<nil> ServerLoadBalancer:0xc000241920 ImageVolume:k3d-sample-images Volumes:[k3d-sample-images]}
DEBU[0000] Deleting node k3d-sample-serverlb ...
TRAC[0000] [Docker] Deleted Container k3d-sample-serverlb
DEBU[0000] Deleting node k3d-sample-server-0 ...
TRAC[0000] [Docker] Deleted Container k3d-sample-server-0
INFO[0000] Deleting cluster network 'k3d-sample'
INFO[0000] Deleting 1 attached volumes...
DEBU[0000] Deleting volume k3d-sample-images...
INFO[0000] Removing cluster details from default kubeconfig...
DEBU[0000] Using default kubeconfig 'kubeconfig'
DEBU[0000] Wrote kubeconfig to 'kubeconfig'
INFO[0000] Removing standalone kubeconfig file (if there is one)...
INFO[0000] Successfully deleted cluster sample!
Metadata
Metadata
Assignees
Labels
questionFurther information is requestedFurther information is requested