Merge pull request 'fix: harden kubeadm scripts for proxy and preflight issues' (#78) from stage into master
Some checks failed
Terraform Apply / Terraform Apply (push) Failing after 20m33s
Some checks failed
Terraform Apply / Terraform Apply (push) Failing after 20m33s
Reviewed-on: #78
This commit was merged in pull request #78.
This commit is contained in:
@@ -100,6 +100,8 @@ in
|
|||||||
(pkgs.writeShellScriptBin "th-kubeadm-init" ''
|
(pkgs.writeShellScriptBin "th-kubeadm-init" ''
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
|
unset http_proxy https_proxy HTTP_PROXY HTTPS_PROXY no_proxy NO_PROXY
|
||||||
|
|
||||||
iface="${config.terrahome.kubeadm.controlPlaneInterface}"
|
iface="${config.terrahome.kubeadm.controlPlaneInterface}"
|
||||||
if ! ip link show "$iface" >/dev/null 2>&1; then
|
if ! ip link show "$iface" >/dev/null 2>&1; then
|
||||||
iface="$(ip -o -4 route show to default | awk 'NR==1 {print $5}')"
|
iface="$(ip -o -4 route show to default | awk 'NR==1 {print $5}')"
|
||||||
@@ -139,9 +141,13 @@ in
|
|||||||
--leaderElection \
|
--leaderElection \
|
||||||
> /etc/kubernetes/manifests/kube-vip.yaml
|
> /etc/kubernetes/manifests/kube-vip.yaml
|
||||||
|
|
||||||
|
systemctl stop kubelet || true
|
||||||
|
kubeadm reset -f || true
|
||||||
|
|
||||||
kubeadm init \
|
kubeadm init \
|
||||||
--control-plane-endpoint "$vip:6443" \
|
--control-plane-endpoint "$vip:6443" \
|
||||||
--upload-certs \
|
--upload-certs \
|
||||||
|
--ignore-preflight-errors=NumCPU \
|
||||||
--pod-network-cidr "$pod_subnet" \
|
--pod-network-cidr "$pod_subnet" \
|
||||||
--service-cidr "$service_subnet" \
|
--service-cidr "$service_subnet" \
|
||||||
--service-dns-domain "$domain"
|
--service-dns-domain "$domain"
|
||||||
@@ -158,6 +164,7 @@ in
|
|||||||
|
|
||||||
(pkgs.writeShellScriptBin "th-kubeadm-join-control-plane" ''
|
(pkgs.writeShellScriptBin "th-kubeadm-join-control-plane" ''
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
unset http_proxy https_proxy HTTP_PROXY HTTPS_PROXY no_proxy NO_PROXY
|
||||||
if [ "$#" -lt 1 ]; then
|
if [ "$#" -lt 1 ]; then
|
||||||
echo "Usage: th-kubeadm-join-control-plane '<kubeadm join ... --control-plane --certificate-key ...>'"
|
echo "Usage: th-kubeadm-join-control-plane '<kubeadm join ... --control-plane --certificate-key ...>'"
|
||||||
exit 1
|
exit 1
|
||||||
@@ -194,16 +201,19 @@ in
|
|||||||
--leaderElection \
|
--leaderElection \
|
||||||
> /etc/kubernetes/manifests/kube-vip.yaml
|
> /etc/kubernetes/manifests/kube-vip.yaml
|
||||||
|
|
||||||
|
systemctl stop kubelet || true
|
||||||
eval "$1"
|
eval "$1"
|
||||||
'')
|
'')
|
||||||
|
|
||||||
(pkgs.writeShellScriptBin "th-kubeadm-join-worker" ''
|
(pkgs.writeShellScriptBin "th-kubeadm-join-worker" ''
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
unset http_proxy https_proxy HTTP_PROXY HTTPS_PROXY no_proxy NO_PROXY
|
||||||
if [ "$#" -lt 1 ]; then
|
if [ "$#" -lt 1 ]; then
|
||||||
echo "Usage: th-kubeadm-join-worker '<kubeadm join ...>'"
|
echo "Usage: th-kubeadm-join-worker '<kubeadm join ...>'"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
systemctl stop kubelet || true
|
||||||
eval "$1"
|
eval "$1"
|
||||||
'')
|
'')
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user