Last active
July 13, 2023 11:35
-
-
Save mickael-kerjean/c69f0b17fcee16b0442b78c5a920628e to your computer and use it in GitHub Desktop.
kubernetes install script
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
#!/bin/bash | |
set -e | |
# run like this: | |
# /bin/bash -c "$(curl -fsSL https://xxx)" | |
VERSION=1.27 | |
######################## | |
# docker stuff: https://kubernetes.io/docs/setup/production-environment/container-runtimes/ | |
apt-get -y install \ | |
apt-transport-https \ | |
ca-certificates \ | |
curl \ | |
gnupg-agent \ | |
software-properties-common | |
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - | |
add-apt-repository -y \ | |
"deb [arch=$(dpkg --print-architecture)] https://download.docker.com/linux/ubuntu \ | |
$(lsb_release -cs) \ | |
stable" | |
apt-get update && apt-get install -y \ | |
docker-ce \ | |
docker-ce-cli | |
cat > /etc/docker/daemon.json <<EOF | |
{ | |
"exec-opts": ["native.cgroupdriver=systemd"], | |
"log-driver": "json-file", | |
"log-opts": { | |
"max-size": "100m" | |
}, | |
"storage-driver": "overlay2" | |
} | |
EOF | |
mkdir -p /etc/systemd/system/docker.service.d | |
systemctl daemon-reload | |
systemctl restart docker | |
######################## | |
# cri-dockerd stuff: https://github.com/Mirantis/cri-dockerd | |
curl -LO "https://github.com/Mirantis/cri-dockerd/releases/download/v0.3.3/cri-dockerd-0.3.3.$(dpkg --print-architecture).tgz" | |
tar -zxf cri-dockerd-0.3.3.$(dpkg --print-architecture).tgz && cd cri-dockerd | |
curl -LO "https://raw.githubusercontent.com/Mirantis/cri-dockerd/master/packaging/systemd/cri-docker.socket" | |
curl -LO "https://raw.githubusercontent.com/Mirantis/cri-dockerd/master/packaging/systemd/cri-docker.service" | |
install -o root -g root -m 0755 cri-dockerd /usr/bin/cri-dockerd | |
install cri-docker.socket /etc/systemd/system/cri-docker.socket | |
install cri-docker.service /etc/systemd/system/cri-docker.service | |
systemctl daemon-reload | |
systemctl enable cri-docker.service | |
systemctl enable --now cri-docker.socket | |
######################## | |
# kubernetes stuff: https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/install-kubeadm/ | |
apt-get update && sudo apt-get install -y apt-transport-https curl | |
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add - | |
cat <<EOF | sudo tee /etc/apt/sources.list.d/kubernetes.list | |
deb https://apt.kubernetes.io/ kubernetes-xenial main | |
EOF | |
apt-get update | |
apt-get install -y kubelet=$VERSION.* kubeadm=$VERSION.* kubectl=$VERSION.* | |
apt-mark hold kubelet kubeadm kubectl | |
######################## | |
# Filesystem | |
apt-get install -y nfs-common sshfs | |
ssh-keygen -t rsa -q -f "$HOME/.ssh/id_rsa" -N "" | |
# ssh-copy-id root@116.203.202.210 | |
# echo "sshfs#root@116.203.202.210:/mnt/ /mnt/ fuse defaults,user,allow_other,reconnect,delay_connect,ConnectTimeout=5,ServerAliveInterval=5,IdentityFile=/root/.ssh/id_rsa 0 0" >> /etc/fstab |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
FILESYSTEM
check sshfs is fine:
add this to /etc/fstab:
and reboot
JOIN THE CLUSTER