Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Reuse registry in multicluster #485

Closed
kuritka opened this issue Feb 8, 2021 · 0 comments · Fixed by #486
Closed

[BUG] Reuse registry in multicluster #485

kuritka opened this issue Feb 8, 2021 · 0 comments · Fixed by #486
Assignees
Labels
bug Something isn't working
Milestone

Comments

@kuritka
Copy link
Contributor

kuritka commented Feb 8, 2021

What did you do

I'm trying to reuse docker registry by two clusters within the same network :

	k3d registry create local-registry --image=docker.io/library/registry:2 --port=5000
	k3d cluster create --config=test-gslb1.yaml --registry-use=k3d-local-registry
	k3d cluster create --config=test-gslb2.yaml --registry-use=k3d-local-registry

The first cluster creates successfully while second one fails. The problem is docker doesn't allow to connect container twice into the same network.

Which version of k3d

k3d version v4.1.0
k3s version v1.20.2-k3s1 (default)
❯ k3d cluster create --config=test-gslb2.yaml --registry-use=k3d-local-registry --verbose
DEBU[0000] Selected runtime is 'docker.Docker'          
DEBU[0000] Validating file test-gslb2.yaml against default JSONSchema... 
DEBU[0000] JSON Schema Validation Result: &{errors:[] score:153} 
INFO[0000] Using config file test-gslb2.yaml            
DEBU[0000] Configuration:
agents: 3
apiversion: k3d.io/v1alpha2
image: rancher/k3s:latest
kind: Simple
labels:
- label: app=config-single-cluster-nolb
  nodeFilters:
  - agent[0]
name: test-gslb2
network: k3d-action-bridge-network
options:
  k3d:
    disablehostipinjection: false
    disableimagevolume: true
    disableloadbalancer: true
    disablerollback: false
    timeout: 60s
    wait: true
  k3s:
    extraagentargs: []
    extraserverargs:
    - --no-deploy=traefik,servicelb,metrics-server
  kubeconfig:
    switchcurrentcontext: true
    updatedefaultkubeconfig: true
  runtime:
    gpurequest: ""
ports:
- nodeFilters:
  - agent[0]
  port: 0.0.0.0:81:80
- nodeFilters:
  - agent[0]
  port: 0.0.0.0:444:443
- nodeFilters:
  - agent[0]
  port: 0.0.0.0:5054:53/udp
registries:
  config: ""
  create: false
  use:
  - k3d-local-registry
servers: 1
token: "" 
DEBU[0000] Additional CLI Configuration:
cli:
  api-port: ""
  env: []
  labels: []
  ports: []
  volumes: [] 
DEBU[0000] ========== Simple Config ==========
{TypeMeta:{Kind:Simple APIVersion:k3d.io/v1alpha2} Name:test-gslb2 Servers:1 Agents:3 ExposeAPI:{Host: HostIP: HostPort:} Image:rancher/k3s:latest Network:k3d-action-bridge-network ClusterToken: Volumes:[] Ports:[{Port:0.0.0.0:81:80 NodeFilters:[agent[0]]} {Port:0.0.0.0:444:443 NodeFilters:[agent[0]]} {Port:0.0.0.0:5054:53/udp NodeFilters:[agent[0]]}] Labels:[{Label:app=config-single-cluster-nolb NodeFilters:[agent[0]]}] Options:{K3dOptions:{Wait:true Timeout:1m0s DisableLoadbalancer:true DisableImageVolume:true NoRollback:false PrepDisableHostIPInjection:false NodeHookActions:[]} K3sOptions:{ExtraServerArgs:[--no-deploy=traefik,servicelb,metrics-server] ExtraAgentArgs:[]} KubeconfigOptions:{UpdateDefaultKubeconfig:true SwitchCurrentContext:true} Runtime:{GPURequest:}} Env:[] Registries:{Use:[k3d-local-registry] Create:false Config:}}
========================== 
DEBU[0000] Port Exposure Mapping didn't specify hostPort, choosing one randomly... 
DEBU[0000] Got free port for Port Exposure: '56983'     
DEBU[0000] ========== Merged Simple Config ==========
{TypeMeta:{Kind:Simple APIVersion:k3d.io/v1alpha2} Name:test-gslb2 Servers:1 Agents:3 ExposeAPI:{Host: HostIP:0.0.0.0 HostPort:56983} Image:rancher/k3s:latest Network:k3d-action-bridge-network ClusterToken: Volumes:[] Ports:[{Port:0.0.0.0:81:80 NodeFilters:[agent[0]]} {Port:0.0.0.0:444:443 NodeFilters:[agent[0]]} {Port:0.0.0.0:5054:53/udp NodeFilters:[agent[0]]}] Labels:[{Label:app=config-single-cluster-nolb NodeFilters:[agent[0]]}] Options:{K3dOptions:{Wait:true Timeout:1m0s DisableLoadbalancer:true DisableImageVolume:true NoRollback:false PrepDisableHostIPInjection:false NodeHookActions:[]} K3sOptions:{ExtraServerArgs:[--no-deploy=traefik,servicelb,metrics-server] ExtraAgentArgs:[]} KubeconfigOptions:{UpdateDefaultKubeconfig:true SwitchCurrentContext:true} Runtime:{GPURequest:}} Env:[] Registries:{Use:[k3d-local-registry] Create:false Config:}}
========================== 
DEBU[0000] Disabling the load balancer                  
DEBU[0000] ===== Cluster Config =====
&{TypeMeta:{Kind: APIVersion:} Cluster:{Name:test-gslb2 Network:{Name:k3d-action-bridge-network External:true} Token: Nodes:[0xc00016cb40 0xc00016cc80 0xc00016cdc0 0xc00016cf00] InitNode:<nil> ExternalDatastore:<nil> KubeAPI:0xc0003b7f80 ServerLoadBalancer:<nil> ImageVolume:} ClusterCreateOpts:{PrepDisableHostIPInjection:false DisableImageVolume:true WaitForServer:true Timeout:1m0s DisableLoadBalancer:true K3sServerArgs:[--no-deploy=traefik,servicelb,metrics-server] K3sAgentArgs:[] GPURequest: NodeHooks:[] GlobalLabels:map[app:k3d] GlobalEnv:[] Registries:{Create:<nil> Use:[0xc000146780] Config:<nil>}} KubeconfigOpts:{UpdateDefaultKubeconfig:true SwitchCurrentContext:true}}
===== ===== ===== 
DEBU[0000] '--kubeconfig-update-default set: enabling wait-for-server 
INFO[0000] Prep: Network                                
INFO[0000] Network with name 'k3d-action-bridge-network' already exists with ID '63f11e509c49dd2ccbc44459981c5c81f353a1840a6dd9f2a0c7374de71a9cb6' 
DEBU[0000] Trying to find registry k3d-local-registry   
WARN[0000] Failed to connect to network 'k3d-action-bridge-network': Connection failed 
WARN[0000] Error response from daemon: endpoint with name k3d-local-registry already exists in network k3d-action-bridge-network 
ERRO[0000] Failed Cluster Preparation: Failed to connect registry node 'k3d-local-registry' to cluster network: Failed to connect to one or more networks 
ERRO[0000] Failed to create cluster >>> Rolling Back    
INFO[0000] Deleting cluster 'test-gslb2'                
ERRO[0000] No nodes found for given cluster             
FATA[0000] Cluster creation FAILED, also FAILED to rollback changes! 
@kuritka kuritka added the bug Something isn't working label Feb 8, 2021
@iwilltry42 iwilltry42 self-assigned this Feb 8, 2021
@iwilltry42 iwilltry42 added this to the v4.1.2 milestone Feb 8, 2021
rancherio-gh-m pushed a commit that referenced this issue Feb 9, 2021
Author: MichalK <kuritka@gmail.com>
Date:   Tue Feb 9 17:45:15 2021 +0100

    [Fix] Reuse registry in multicluster (fixes #485,@kuritka) (#486, @kuritka)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants