I’ve created three ubuntu virtual machines (kubemaster, kubenode1, kubenode2)

I want to create a Kubernetes cluster with one master called kubemaster, and two nodes (kubenode1 & kubenode2)

chat.openai.com
Here's a step-by-step guide:

Prepare the Virtual Machines:
Make sure all three virtual machines (kubemaster, kubenode1, and kubenode2) are running Ubuntu.
Ensure that the virtual machines have network connectivity with each other.

Install Docker:
SSH into each virtual machine.
Run the following commands to install Docker:
------------------------------------------
sudo apt update
sudo apt install docker.io
sudo systemctl enable docker
sudo systemctl start docker
------------------------------------------

Disable Swap:
Run the following command to disable swap on each virtual machine:
------------------------------------------
sudo swapoff -a
------------------------------------------

Install Kubernetes Components:
SSH into each virtual machine.
Run the following commands to install Kubernetes components (Kubelet, Kubeadm, and Kubectl) on all machines:
------------------------------------------
sudo apt update
sudo apt install -y apt-transport-https ca-certificates curl
curl -fsSL https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo gpg --dearmor -o /usr/share/keyrings/kubernetes-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/kubernetes-archive-keyring.gpg] https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee /etc/apt/sources.list.d/kubernetes.list
sudo apt update
sudo apt install -y kubelet kubeadm kubectl
sudo apt-mark hold kubelet kubeadm kubectl
------------------------------------------

Initialize the Master Node:
On the kubemaster node, run the following command to initialize the cluster:
------------------------------------------
sudo kubeadm init --pod-network-cidr=192.168.0.0/16
------------------------------------------
Once the command completes, it will output a kubeadm join command with a token. 
********************************************************************************************
** Make a note of this command as you'll need it to join the worker nodes to the cluster. **
********************************************************************************************

Configure kubectl:
On the kubemaster node, run the following commands to configure kubectl:
------------------------------------------
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
------------------------------------------

Now you can use kubectl commands on the kubemaster node to manage the cluster.
Join Worker Nodes:
On each worker node (kubenode1 and kubenode2), run the kubeadm join command you noted earlier. 
It will look something like this:
------------------------------------------
sudo kubeadm join <kubemaster-ip>:<kubemaster-port> --token <token> --discovery-token-ca-cert-hash <hash>
------------------------------------------
Run this command on both worker nodes, one at a time.

Verify Cluster:
On the kubemaster node, run the following command to check the status of the nodes:
------------------------------------------
kubectl get nodes
------------------------------------------
You should see the master node (kubemaster) and the two worker nodes (kubenode1 and kubenode2) with the status "Ready."
**********************
** Congratulations! **
**********************
You have now successfully set up a Kubernetes cluster with one master node and two worker nodes. 
--You can start deploying and managing your applications on the cluster.