Skip to content

Local kind cluster ip change might cause issues #850

@jorgemoralespou

Description

@jorgemoralespou

Describe the bug

I have a local setup with a local educates kind cluster as well as the resolver, registry and 3 mirrors.
All of the educates, registry and mirrors are attached to the kind network.
When Docker Desktop is restarted, the IP assigned to these containers might change because they depend on the startup time, as all are marked as Restart: Always. So, if you have a cluster that was created and has an internal ip of 172.18.0.2 it might start now and get a different ip (e.g. 172.18.0.3) and then pods will be seen as Running but will not be marked as running. I noticed this in k9s as pods show up in red and nothing works.

To check the ip of the container do:

docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' educates-control-plane

To see the IP that was configured in the previous run do:

docker exec educates-control-plane grep "server:" /etc/kubernetes/kubelet.conf

If there's an ip mismatch then you have hit this problem. You can see what container has squatted the ip by doing:

docker network inspect kind -f '{{range .Containers}}{{.Name}} has IP {{.IPv4Address}}{{println}}{{end}}'

To fix the issue you need to:

disconnect the squatter container:

# Disconnect the container currently holding the IP
docker network disconnect kind <squatter-container>

Fix the educates-control-plane container ip:

# Example only - replace with your OLD IP found in Step 2
docker network disconnect kind educates-control-plane
docker network connect --ip 172.18.0.2 kind educates-control-plane
docker restart educates-control-plane

Connect back the squatter container:

# Disconnect the container currently holding the IP
docker network connect kind <squatter-container>

Solution proposed

Add a specific and high ip to the educates-control-plane container when run. (e.g.
docker run -d
--name
--network kind
--ip 172.18.0.200

This needs to be done from within the Educates CLI. We need to verify the subnet first. If your kind network is 172.18.0.0/16, then 172.18.0.200 is perfectly safe

Registry and mirror containers IP are not a problem (AFAICT) but we could implement the same on these, just to make sure that everything is consistent.

### Additional information

_No response_

Metadata

Metadata

Labels

area/cliIssues that have any relation with the CLIbugSomething isn't working

Type

No type

Projects

Status

Untriaged

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions