kubernetes/minikube

--static-ip not respected when run with --network with docker driver

Open

#19,284 opened on Jul 17, 2024

View on GitHub
ย (12 comments)ย (1 reaction)ย (1 assignee)Goย (31,799 stars)ย (5,222 forks)batch import
help wantedkind/bug

Description

What Happened?

I have a docker network previously created:

$ docker network inspect minikube_net
[
    {
        "Name": "minikube_net",
        "Id": "92ce6fe7b171ecdfbdec5274d619f0d652d391d2bb86460d4a5ef2d1e51957ee",
        "Created": "2024-07-17T07:46:01.295275401-07:00",
        "Scope": "local",
        "Driver": "bridge",
        "EnableIPv6": false,
        "IPAM": {
            "Driver": "default",
            "Options": {},
            "Config": [
                {
                    "Subnet": "192.168.100.0/25"
                }
            ]
        },
        "Internal": false,
        "Attachable": false,
        "Ingress": false,
        "ConfigFrom": {
            "Network": ""
        },
        "ConfigOnly": false,
        "Containers": {},
        "Options": {
            "com.docker.network.bridge.name": "br-minikube_net"
        },
        "Labels": {}
    }
]

If I run the following command the ip is not repected:

$ minikube start -p leotest --static-ip 192.168.100.20 --network minikube_net
๐Ÿ˜„  [leotest] minikube v1.33.1 on Ubuntu 22.04 (kvm/amd64)
โœจ  Using the docker driver based on existing profile
โ—  You cannot change the static IP of an existing minikube cluster. Please first delete the cluster.
๐Ÿ‘  Starting "leotest" primary control-plane node in "leotest" cluster
๐Ÿšœ  Pulling base image v0.0.44 ...
๐Ÿƒ  Updating the running docker "leotest" container ...
๐Ÿณ  Preparing Kubernetes v1.30.0 on Docker 26.1.1 ...
๐Ÿ”Ž  Verifying Kubernetes components...
    โ–ช Using image gcr.io/k8s-minikube/storage-provisioner:v5
๐ŸŒŸ  Enabled addons: storage-provisioner, default-storageclass
๐Ÿ„  Done! kubectl is now configured to use "leotest" cluster and "default" namespace by default
$ minikube ip -p leotest
172.17.0.6

But if I do not specify the network then, a new one is created and the ip is respected:

$ minikube start -p leotest --static-ip 192.168.200.20
๐Ÿ˜„  [leotest] minikube v1.33.1 on Ubuntu 22.04 (kvm/amd64)
โœจ  Automatically selected the docker driver. Other choices: none, ssh
๐Ÿ“Œ  Using Docker driver with root privileges
๐Ÿ‘  Starting "leotest" primary control-plane node in "leotest" cluster
๐Ÿšœ  Pulling base image v0.0.44 ...
๐Ÿ”ฅ  Creating docker container (CPUs=2, Memory=3900MB) ...
๐Ÿณ  Preparing Kubernetes v1.30.0 on Docker 26.1.1 ...
    โ–ช Generating certificates and keys ...
    โ–ช Booting up control plane ...
    โ–ช Configuring RBAC rules ...
๐Ÿ”—  Configuring bridge CNI (Container Networking Interface) ...
๐Ÿ”Ž  Verifying Kubernetes components...
    โ–ช Using image gcr.io/k8s-minikube/storage-provisioner:v5
๐ŸŒŸ  Enabled addons: storage-provisioner, default-storageclass
๐Ÿ„  Done! kubectl is now configured to use "leotest" cluster and "default" namespace by default
$ minikube ip -p leotest
192.168.200.20

Attach the log file

log.txt

Operating System

Ubuntu

Driver

Docker

Contributor guide

--static-ip not respected when run with --network with docker driver ยท kubernetes/minikube#19284 | Good First Issue