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

use better logic to determine ipv4 address of vagrant host in bridged network, fix typos #180

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion kubeadm-clusters/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ In this section we present various labs for building kubeadm clusters

* Vagrant and VirtualBox

For users of Windows and Mac x86, provision a 3 node cluster on your laptop.
For users of Windows, Linux, and Mac x86, provision a 3 node cluster on your laptop.

* [3 Node Cluster](./virtualbox/)

4 changes: 2 additions & 2 deletions kubeadm-clusters/virtualbox/Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ IP_NW = "192.168.56"
MASTER_IP_START = 11
NODE_IP_START = 20

# Host operating sysem detection
# Host operating system detection
module OS
def OS.windows?
(/cygwin|mswin|mingw|bccwin|wince|emx/ =~ RUBY_PLATFORM) != nil
Expand All @@ -41,7 +41,7 @@ module OS
end
end

# Determine host adpater for bridging in BRIDGE mode
# Determine host adapter for bridging in BRIDGE mode
def get_bridge_adapter()
if OS.windows?
return %x{powershell -Command "Get-NetRoute -DestinationPrefix 0.0.0.0/0 | Get-NetAdapter | Select-Object -ExpandProperty InterfaceDescription"}.chomp
Expand Down
4 changes: 2 additions & 2 deletions kubeadm-clusters/virtualbox/ubuntu/vagrant/setup-hosts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ NODE_IP_START=$5
if [ "$BUILD_MODE" = "BRIDGE" ]
then
# Determine machine IP from route table -
# Interface that routes to default GW that isn't on the NAT network.
MY_IP="$(ip route | grep default | grep -Pv '10\.\d+\.\d+\.\d+' | awk '{ print $9 }')"
# Interface that routes to default GW that isn't enp0s3 on the vagrant NAT network.
MY_IP="$(ip route | grep '^default' | awk '!/enp0s3/ { print $9 }')"

# From this, determine the network (which for average broadband we assume is a /24)
MY_NETWORK=$(echo $MY_IP | awk 'BEGIN {FS="."} ; { printf("%s.%s.%s", $1, $2, $3) }')
Expand Down