Create K8s Cluster on AWS Ubuntu Instance
For for info: itinabroadservices@gmail.com
K8s Cluster setup steps as below.
sudo su
apt-get update
apt-get install apt-transport-https
apt install docker.io -y
docker --version
systemctl start docker
systemctl enable docker
curl -fsSL https://pkgs.k8s.io/core:/stable:/v1.32/deb/Release.key | sudo gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg
echo 'deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v1.32/deb/ /' | sudo tee /etc/apt/sources.list.d/kubernetes.list
apt-get update
apt-get install -y kubelet kubeadm kubectl kubernetes-cni
BOOTSTRAPPING THE MASTER NODE (IN MASTER)
kubeadm init
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
Alternatively, if you are the root user, you can run:
export KUBECONFIG=/etc/kubernetes/admin.conf
You should now deploy a pod network to the cluster.
Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at:
https://kubernetes.io/docs/concepts/cluster-administration/addons/
Deploying Flannel with kubectl
kubectl apply -f https://github.com/flannel-io/flannel/releases/latest/download/kube-flannel.yml
Then you can join any number of worker nodes by running the following on each as root:
kubeadm join 172.31.46.45:6443 --token mdvhwt.4rehpfsmrilcwqxx \
--discovery-token-ca-cert-hash sha256:0e526ff508220a683813404ba3f4b8851f82b9353ed7e8651391dbc246a536e8