Skip to content

Commit 80c4e3d

Browse files
authored
update setupk8s-single-node-cluster.sh
1 parent 9eb5e76 commit 80c4e3d

File tree

1 file changed

+17
-9
lines changed

1 file changed

+17
-9
lines changed

scripts/setupk8s-single-node-cluster.sh

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,26 +6,34 @@ prepare_node() {
66
which docker
77
if [ $? -eq 0 ];then
88
echo "docker is already installed no action required.."
9-
sudo systemctl restart docker
9+
sudo systemctl restart docker.service
1010
else
1111
echo "docker is not installed.. continue to install"
1212
wget https://raw.githubusercontent.com/lerndevops/labs/master/scripts/installDocker.sh -P /tmp
13-
bash /tmp/installDocker.sh
13+
sudo bash /tmp/installDocker.sh
1414
fi
15+
which cri-dockerd
16+
if [ $? -eq 0 ];then
17+
echo "docker is already installed no action required.."
18+
sudo systemctl restart cri-docker.service
19+
else
20+
echo "docker is not installed.. continue to install"
21+
wget https://raw.githubusercontent.com/lerndevops/labs/master/scripts/installCRIDockerd.sh -P /tmp
22+
sudo bash /tmp/installCRIDockerd.sh
23+
fi
1524
which kubelet
1625
if [ $? -eq 0 ];then
1726
echo "kubernetes modules are already installed no action required.."
1827
else
1928
echo "kuberenetes modules are not installed.. continue to install"
20-
sudo wget https://raw.githubusercontent.com/lerndevops/labs/master/scripts/installK8S-v1-23.sh -P /tmp
21-
sudo chmod 755 /tmp/installK8S-v1-23.sh
22-
sudo bash /tmp/installK8S-v1-23.sh
29+
sudo wget https://raw.githubusercontent.com/lerndevops/labs/master/scripts/installK8S.sh -P /tmp
30+
sudo bash /tmp/installK8S.sh
2331
fi
2432

2533
}
2634
create_cluster() {
2735

28-
kubeadm init --ignore-preflight-errors=all
36+
kubeadm init --cri-socket unix:///var/run/cri-dockerd.sock --ignore-preflight-errors=all
2937
if [ $? -eq 0 ];then
3038
echo "kuberenetes master initilized successfully"
3139

@@ -35,9 +43,9 @@ create_cluster() {
3543

3644
if [ -f $HOME/.kube/config ];then
3745

38-
sudo kubectl apply -f "https://cloud.weave.works/k8s/net?k8s-version=$(kubectl version | base64 | tr -d '\n')"
39-
mnodename=`kubectl get nodes | grep master | awk '{print $1}'`
40-
kubectl taint node $mnodename node-role.kubernetes.io/master:NoSchedule-
46+
sudo kubectl apply -f https://raw.githubusercontent.com/projectcalico/calico/v3.24.1/manifests/calico.yaml
47+
mnodename=`kubectl get nodes | grep control-plane | awk '{print $1}'`
48+
kubectl taint node $mnodename node-role.kubernetes.io/control-plane:NoSchedule-
4149

4250
else
4351
echo "config file missing under user home.."

0 commit comments

Comments
 (0)