minishift / minishift-centos-iso

CentOS based ISO as an alternative for boot2docker ISO
GNU Lesser General Public License v3.0
40 stars 33 forks source link

Issue #137 Set IP Address using hvkvp or settings file (using systemd) #164

Closed gbraad closed 7 years ago

gbraad commented 7 years ago

Settings are set on startup using hvkvp using minishift/minishift#1391, or using a configuration file.

/var/lib/minishift/networking

DEVICE=eth0
IPADDR=10.0.75.128
NETMASK=24
GATEWAY=10.0.75.1
DNS1=8.8.8.8
DNS2=8.8.4.4

This would allow Minishift to assign a static IP address to the instance.

Note: DHCP is enabled, as this is a fallback option, when the file is missing.

gbraad commented 7 years ago
PS C:\work\src\github.com\minishift\minishift\out\windows-amd64> .\minishift.exe delete --force
Deleting the Minishift VM...
Minishift VM deleted.
PS C:\work\src\github.com\minishift\minishift\out\windows-amd64> .\minishift.exe start --iso-url file://C:/Users/gbra
ad/.minishift/cache/iso/minishift-centos7-build.iso --network-ipaddress 10.0.75.124 --network-gateway=10.0.75.1 --net
work-nameserver 8.8.8.8 -v5
-- Checking if Hyper-V driver is installed ... OK
-- Checking if Hyper-V driver is configured to use a Virtual Switch ... OK
-- Checking if user is a member of the Hyper-V Administrators group ... OK
-- Starting local OpenShift cluster using 'hyperv' hypervisor ...
-- Minishift VM will be configured with ...
   Memory:    2 GB
   vCPUs :    2
   Disk size: 20 GB
-- Attempting to set network settings ...
   Device:      eth0
   IP Address:  10.0.75.124/24
   Gateway:     10.0.75.1
   Nameservers: 8.8.8.8
-- Starting Minishift VM ...+...+...+...+..+..+..+..+..+..+.+..+.+.+..+.+..+.+.+.+*.......................... OK
-- Checking for IP address ... OK
-- Checking if external host is reachable from the Minishift VM ...
   Pinging 10.0.75.1 ... OK
-- Checking HTTP connectivity from the VM ...
   Retrieving http://10.0.75.1:5000/v2/ ... OK
-- Checking if persistent storage volume is mounted ... OK
-- Checking available disk space ... 1% used OK
-- OpenShift cluster will be configured with ...
   Version: v3.6.0
-- Checking `oc` support for startup flags ...
   host-pv-dir ... OK
   host-volumes-dir ... OK
   routing-suffix ... OK
   host-config-dir ... OK
   host-data-dir ... OK
-- Running `oc` with: 'cluster up --use-existing-config --host-pv-dir /var/lib/minishift/openshift.local.pv --host-vo
lumes-dir /var/lib/minishift/openshift.local.volumes --routing-suffix 10.0.75.124.nip.io --host-config-dir /var/lib/m
inishift/openshift.local.config --host-data-dir /var/lib/minishift/hostdata'
Starting OpenShift using openshift/origin:v3.6.0 ...
Pulling image openshift/origin:v3.6.0
Pulled 0/4 layers, 2% complete
Pulled 1/4 layers, 52% complete
Pulled 2/4 layers, 72% complete
Pulled 3/4 layers, 83% complete
Pulled 4/4 layers, 100% complete
Extracting
Image pull complete
OpenShift server started.

The server is accessible via web console at:
    https://10.0.75.124:8443

You are logged in as:
    User:     developer
    Password: <any value>

To login as administrator:
    oc login -u system:admin

PS C:\work\src\github.com\minishift\minishift\out\windows-amd64> .\minishift.exe status
Minishift:  Running
Profile:    minishift
OpenShift:  Stopped
DiskUsage:  ERR of
PS C:\work\src\github.com\minishift\minishift\out\windows-amd64> .\minishift.exe status
Minishift:  Running
Profile:    minishift
OpenShift:  Stopped
DiskUsage:  12% of 18G
PS C:\work\src\github.com\minishift\minishift\out\windows-amd64> .\minishift.exe status
Minishift:  Running
Profile:    minishift
OpenShift:  Stopped
DiskUsage:  ERR of
PS C:\work\src\github.com\minishift\minishift\out\windows-amd64> .\minishift.exe status
Minishift:  Running
Profile:    minishift
OpenShift:  Stopped
DiskUsage:  ERR of
PS C:\work\src\github.com\minishift\minishift\out\windows-amd64> .\minishift.exe status
Minishift:  Running
Profile:    minishift
OpenShift:  Stopped
DiskUsage:  ERR of
PS C:\work\src\github.com\minishift\minishift\out\windows-amd64> .\minishift.exe status
Minishift:  Running
Profile:    minishift
OpenShift:  Stopped
DiskUsage:  12% of 18G
PS C:\work\src\github.com\minishift\minishift\out\windows-amd64>
gbraad commented 7 years ago

@praveenkumar Could you also have a look?

I guess I do not need to start NetworkManager at all, as the old LSB networking scripts are still available, and seems to actually throw an error when started this way.

gbraad commented 7 years ago

Removed systemctl start NetworkManager. Current failure likely due to DNS, as the http test and pulling the containers fails, but assigning an address worked with DHCP. needs more testing

gbraad commented 7 years ago

Restored to using NetworkManager, and tests pass (DNS is correctly assigned)

gbraad commented 7 years ago

image

Will also disable NetworkManager-wait-only and NetworkManager-dispatcher

gbraad commented 7 years ago

systemctl status does not report State: degraded anymore. However, the DEPEND and INFO remain for NetworkManager-wait-online.

gbraad commented 7 years ago

@LalatenduMohanty @praveenkumar @budhrg please review