Last active
December 17, 2020 10:21
-
-
Save buom/348b2b1c866d0ccaaca25c142a5a83f0 to your computer and use it in GitHub Desktop.
k8s-vbox-the-hard-way on MacOS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
brew cask install virtualbox | |
brew cask install vagrant | |
brew install coreutils | |
brew install gnu-sed | |
brew install gettext | |
brew link --force gettext |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/bin/hisk8s.sh b/bin/hisk8s.sh | |
index d162b82..eac581f 100755 | |
--- a/bin/hisk8s.sh | |
+++ b/bin/hisk8s.sh | |
@@ -8,6 +8,15 @@ | |
set -a # export all variables.... | |
set -u # break if there is any unbound variable | |
+shopt -s expand_aliases | |
+ | |
+platform=`uname | tr "[:upper:]" "[:lower:]"` | |
+ | |
+if [[ "$platform" == "darwin" ]]; then | |
+ alias sed=gsed | |
+ alias mv=gmv | |
+fi | |
+ | |
_vagrant() { #public: A wrapper for `vagrant` loop on all nodes. E.g, `_vagrant destroy -f` to destroy all nodes. | |
mkdir -pv "$D_MACHINES" | |
for _node in $MACHINES; do | |
@@ -353,7 +362,7 @@ _k8s_bootstrapping_lb_haproxy() { | |
done | |
while read -r _file; do | |
- \mv --backup=numbered -fv "$_file" "$_file.backup" | |
+ mv --backup=numbered -fv "$_file" "$_file.backup" | |
done < <(find "$D_ETC/haproxy/" -maxdepth 1 -mindepth 1 -type f -iname "*.cfg") | |
for _file in "$D_ETC/haproxy/"*.cfg.in; do | |
@@ -1113,15 +1122,15 @@ _wget_cfssl() { #private: Download cfssl binary to $D_CACHES/ directory | |
__wget \ | |
"https://pkg.cfssl.org/R1.2/cfssl_linux-amd64" \ | |
"https://pkg.cfssl.org/R1.2/cfssljson_linux-amd64" | |
- chmod -c 755 {cfssl,cfssljson}_linux-amd64 | |
+ chmod 755 {cfssl,cfssljson}_linux-amd64 | |
} | |
_wget_helm() { #private: Download helm binary to $D_CACHES/ directory | |
mkdir -pv "$D_CACHES/" | |
cd "$D_CACHES/" || return | |
- __wget https://storage.googleapis.com/kubernetes-helm/helm-"${K8S_HELM_TAG}"-linux-amd64.tar.gz | |
- tar xfvz helm-"${K8S_HELM_TAG}"-linux-amd64.tar.gz linux-amd64/helm | |
- mv linux-amd64/helm "./helm-${K8S_HELM_TAG}" | |
+ __wget https://storage.googleapis.com/kubernetes-helm/helm-"${K8S_HELM_TAG}"-${platform}-amd64.tar.gz | |
+ tar xfvz helm-"${K8S_HELM_TAG}"-${platform}-amd64.tar.gz ${platform}-amd64/helm | |
+ mv ${platform}-amd64/helm "./helm-${K8S_HELM_TAG}" | |
chmod 755 "./helm-${K8S_HELM_TAG}" | |
ls -la helm-* | |
} | |
@@ -1130,7 +1139,7 @@ _wget_kubectl() { #private: Download kubectl binary to $D_CACHES/ directory. | |
mkdir -pv "$D_CACHES/" | |
cd "$D_CACHES/" || return | |
__wget -O "./kubectl-${K8S_BUNDLE_TAG}" https://storage.googleapis.com/kubernetes-release/release/"${K8S_BUNDLE_TAG}"/bin/linux/amd64/kubectl | |
- chmod -c 755 "./kubectl-${K8S_BUNDLE_TAG}" | |
+ chmod 755 "./kubectl-${K8S_BUNDLE_TAG}" | |
ls -la kubectl-* | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/bin/Vagrantfile.rb b/bin/Vagrantfile.rb | |
index 4fe5d0a..26a0d3a 100644 | |
--- a/bin/Vagrantfile.rb | |
+++ b/bin/Vagrantfile.rb | |
@@ -77,11 +77,12 @@ Vagrant.configure("2") do |config| | |
pacman -Sy | |
# Restarting to recognize new nameserver settings. | |
- systemctl restart networking \ | |
- || systemctl restart systemd-networkd | |
+ # systemctl restart networking \ | |
+ # || systemctl restart systemd-networkd | |
# Who cares? | |
- systemctl restart systemd-resolved | |
+ # systemctl restart systemd-resolved | |
+ netplan apply | |
#{f_contents} | |
SHELL |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment