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

v3/networking: --network flag to attach to existing networks #220

Closed
iwilltry42 opened this issue Apr 11, 2020 · 1 comment
Closed

v3/networking: --network flag to attach to existing networks #220

iwilltry42 opened this issue Apr 11, 2020 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@iwilltry42
Copy link
Member

iwilltry42 commented Apr 11, 2020

Overview

There was already some work done on using a --network flag in the master-v3 branch.
The simple goal is to be able to skip the creation of a cluster network and attach a new k3d cluster to an existing network.

Cases

  1. Attaching to a pre-defined docker network (host, bridge, none)
  • ✔️ here, we cannot use Aliases in the endpoint settings
    • this does not seem to much of an issue and k3d works just fine without aliases
  • ℹ️ --network none is not expected to work and doesn't make to much sense to use it anyway
  • --network host only supports a single-node cluster (only one master)
  • 🚫 --network bridge fails to attach worker nodes to master
    time="2020-04-14T16:04:09.458596900Z" level=error msg="failed to get CA certs at https://127.0.0.1:45441/cacerts: Get https://127.0.0.1:45441/cacerts: read tcp 127.0.0.1:50948->127.0.0.1:45441: read: connection reset by peer"
    
    • Possible Solution: fetch IP from master node after creation and use this for connecting (K3S_URL) instead of the container name, as it seems like DNS doesn't work as expected here
  1. Attaching to a user-defined network which is not managed by k3d
  • ✔️ skip network deletion attempts when deleting the cluster
    • this is the case already, since we're not deleting the network if the cluster nodes have the label k3d.cluster.network.external=true
  1. Attaching to a user-defined network which is managed by k3d (i.e. belongs to a different cluster)
  • ❓ how do we handle the network once the "owner"-cluster is deleted?
    • Currently, the network will stay if there are still containers connected to it. Even, if we delete the other cluster and thus leave the network with no attached containers, it will persist.
      • Idea 1: When deleting a cluster, delete the network, if it's managed by k3d (check label) and there are no connected containers (docker will tell you), even if the network is not "owned" by the deleted cluster
      • Idea 2: leave it like it is right now and add a k3d prune or k3d cleanup command to remove unused resources

Open questions in general:

  • ❓ Do we only attach the cluster to the existing network or do we create a new cluster network and attach the cluster to the existing network (this would make the cluster more "resilient" against deletion of the external network)?

Related items

@iwilltry42
Copy link
Member Author

iwilltry42 commented May 28, 2020

--network flag present in v3.0.0 (See https://k3d.io/internals/networking/)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant