-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added master and worker scripts as part of node
- Loading branch information
coolsvap
committed
May 27, 2021
1 parent
4fc9d5a
commit de36538
Showing
5 changed files
with
48 additions
and
22 deletions.
There are no files selected for viewing
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/bin/sh | ||
# Use this script to initialize master | ||
|
||
kubeadm reset -f | ||
rm -rf ~/.kube /etc/cni/net.d /etc/kubernetes /var/lib/etcd /var/lib/kubelet /var/run/kubernetes /var/lib/cni /opt/cni | ||
iptables -F | ||
|
||
HOST_IP=`/sbin/ifconfig eth1 | egrep -o 'inet [0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | cut -d' ' -f2` | ||
ip route add 10.96.0.0/16 dev eth1 src ${HOST_IP} | ||
|
||
### init k8s | ||
kubeadm init --apiserver-advertise-address=${HOST_IP} --kubernetes-version=${KUBE_VERSION} --pod-network-cidr=${POD_NW_CIDR} --skip-token-print | ||
|
||
mkdir -p $HOME/.kube | ||
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config | ||
sudo chown $(id -u):$(id -g) $HOME/.kube/config | ||
|
||
cp -R $HOME/.kube /vagrant/ | ||
|
||
kubectl taint nodes --all node-role.kubernetes.io/master- | ||
case $NW_PLUGIN in | ||
"weave" ) kubectl apply -f "https://cloud.weave.works/k8s/net?k8s-version=$(kubectl version | base64 | tr -d '\n')" ;; | ||
"calico" ) kubectl apply -f https://docs.projectcalico.org/manifests/calico.yaml ;; | ||
*) echo "Running default with calico" && kubectl apply -f https://docs.projectcalico.org/manifests/calico.yaml ;; | ||
esac | ||
kubeadm token create --print-join-command --ttl 0 > /etc/.vagrantdata/kubeadm-join |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/bin/sh | ||
|
||
kubeadm reset -f | ||
rm -rf ~/.kube /etc/cni/net.d /etc/kubernetes /var/lib/etcd /var/lib/kubelet /var/run/kubernetes /var/lib/cni | ||
iptables -F | ||
|
||
HOST_IP=`/sbin/ifconfig eth1 | egrep -o 'inet [0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | cut -d' ' -f2` | ||
ip route add 10.96.0.0/16 dev eth1 src ${HOST_IP} | ||
|
||
$(cat /etc/.vagrantdata/kubeadm-join) |