setting up kubernetes in AWS EC2 instance

I am using this to start setting up my own kubernetes environment. 

https://hbayraktar.medium.com/how-to-install-kubernetes-cluster-on-ubuntu-22-04-step-by-step-guide-7dbf7e8f5f99

sudo apt update && sudo apt upgrade -y



Turn off swap

sudo swapoff -a
sudo sed -i '/ swap / s/^\(.*\)$/#\1/g' /etc/fstab


Setup required kernels parameters


sudo tee /etc/modules-load.d/containerd.conf <<EOF
overlay
br_netfilter
EOF

sudo modprobe overlay
sudo modprobe br_netfilter


Setup critical kernel parameters

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 the system 

sudo sysctl --system


Setup container runtime

sudo apt install -y curl gnupg2 software-properties-common apt-transport-https ca-certificates


Enable docker repository 

sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmour -o /etc/apt/trusted.gpg.d/docker.gpg
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"


Install containerd 

sudo apt update
sudo apt install -y containerd.io


containerd config default | sudo tee /etc/containerd/config.toml >/dev/null 2>&1

sudo sed -i 's/SystemdCgroup \= false/SystemdCgroup \= true/g' /etc/containerd/config.toml


Restart containerd 

sudo systemctl restart containerd
sudo systemctl enable containerd


Setup APT repository for kubernetes by setting it to use kubernetes version 1.30 - for more info


echo "deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v1.30/deb/ /" | sudo tee /etc/apt/sources.list.d/kubernetes.list
curl -fsSL https://pkgs.k8s.io/core:/stable:/v1.30/deb/Release.key | sudo gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg


Install kubeadm and kubelet


sudo apt update
sudo apt install -y kubelet kubeadm kubectl
sudo apt-mark hold kubelet kubeadm kubectl

Initialize the cluster 

sudo kubeadm init


kubeadm init would start other core kubectl components that includes kube-apiserver, kube-scheduler, etcd, kubelet, kube-controller-manager. 




Comments

Popular posts from this blog

The specified initialization vector (IV) does not match the block size for this algorithm