If you have a Kubernetes-ready Ubuntu Server, you’re all set to dive into the world of container orchestration. Let’s get started with the essential steps:
-
Deploying the Master Node:
- If you’re creating a new Kubernetes cluster, you’ll need to initialize at least one Kubernetes master node. Run the following commands on the VM or bare-metal server you wish to use as the master:
kubeadm init --pod-network-cidr=10.100.20.0/24 - Make note of the output; it contains information on how to join worker nodes to the cluster. Optionally, you can administer the cluster remotely with
kubectl. - Create a password for the
kadminuser and create a Kubernetes config file for the user:sudo passwd kadmin su -s /bin/bash - kadmin mkdir -p $HOME/.kube sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config sudo chown $(id -u):$(id -g) $HOME/.kube/config exit - Create the network as the root user:
kubectl apply -f [^1^][5]
- If you’re creating a new Kubernetes cluster, you’ll need to initialize at least one Kubernetes master node. Run the following commands on the VM or bare-metal server you wish to use as the master:
-
Joining a Worker Node to the Cluster:
- Now that you have your Kubernetes master created, it’s time to join a worker node to the master and create your cluster.
- Replace
$token,$ip:port, and$cert-hashin the command below with the information provided from the output ofkubeadm initwhen you created your master node:kubeadm join $ip:port --token $token --discovery-token-ca-cert-hash $cert-hash - You can run
kubectl get nodeson the Kubernetes master node (if configured for thekadminuser) or any workstation with thekubectlcontext pointed to this cluster to monitor the progress of node(s) joining your cluster.
Remember, Kubernetes is a powerful tool for managing containerized applications. Enjoy exploring and orchestrating your workloads!