Last active
May 19, 2022 00:37
-
-
Save ragazzid/020f2efb5efca90fbb270135c97b8847 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
sudo apt -y install curl apt-transport-https | |
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add - | |
echo "deb https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee /etc/apt/sources.list.d/kubernetes.list | |
sudo apt update | |
sudo apt -y install vim git curl wget kubelet kubeadm | |
sudo apt-mark hold kubelet kubeadm | |
# Disabel swap | |
sudo sed -i '/ swap / s/^\(.*\)$/#\1/g' /etc/fstab | |
sudo swapoff -a | |
# Enable kernel modules | |
sudo modprobe overlay | |
sudo modprobe br_netfilter | |
# Add some settings to sysctl | |
sudo tee /etc/sysctl.d/kubernetes.conf<<EOF | |
net.bridge.bridge-nf-call-ip6tables = 1 | |
net.bridge.bridge-nf-call-iptables = 1 | |
net.ipv4.ip_forward = 1 | |
EOF | |
# Reload sysctl | |
sudo sysctl --system | |
# Install containerd | |
# Configure persistent loading of modules | |
sudo tee /etc/modules-load.d/containerd.conf <<EOF | |
overlay | |
br_netfilter | |
EOF | |
# Load at runtime | |
sudo modprobe overlay | |
sudo modprobe br_netfilter | |
# Ensure sysctl params are set | |
sudo tee /etc/sysctl.d/kubernetes.conf<<EOF | |
net.bridge.bridge-nf-call-ip6tables = 1 | |
net.bridge.bridge-nf-call-iptables = 1 | |
net.ipv4.ip_forward = 1 | |
EOF | |
# Reload configs | |
sudo sysctl --system | |
# Install required packages | |
sudo apt install -y curl gnupg2 software-properties-common apt-transport-https ca-certificates | |
# Install containerd | |
sudo apt update | |
sudo apt install -y containerd.io | |
# Configure containerd and start service | |
sudo mkdir -p /etc/containerd | |
containerd config default | tee /etc/containerd/config.toml | |
# restart containerd | |
sudo systemctl restart containerd | |
sudo systemctl disable containerd | |
# Pull imagens | |
sudo kubeadm config images pull --cri-socket /run/containerd/containerd.sock | |
# Flanneld needs to be available in all nodes | |
wget https://github.com/flannel-io/flannel/releases/download/v0.17.0/flanneld-amd64 -O /tmp/flanneld-amd64 | |
sudo mv /tmp/flanneld-amd64 /usr/bin/flanneld | |
echo 'sudo kubeadm init \--pod-network-cidr=10.244.0.0/16' | |
echo 'agr, bora pro flannel, pronto?' | |
echo 'agr bora por a instalacao' | |
echo 'kubectl apply -f https://raw.githubusercontent.com/flannel-io/flannel/master/Documentation/kube-flannel.yml' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment