Setup Kubernetes Cluster Using Kubeadm [Multi-node]

DevopsCube
17 Apr 202316:20

Summary

TLDRThis tutorial provides a step-by-step guide on setting up a Kubernetes cluster using kubeadm, with a focus on the importance of hands-on experience for DevOps engineers. The video walks through deploying virtual machines, installing key Kubernetes components, and configuring the cluster control plane and worker nodes. The presenter also emphasizes using a self-hosted cluster for learning and certification preparation. Additionally, the tutorial covers key prerequisites, metrics server setup, and deploying an NGINX app, offering valuable insights into managing Kubernetes clusters efficiently.

Takeaways

  • 🚀 Kubernetes setup tutorial using kubeadm, focusing on creating a multi-node cluster for real-world project simulation.
  • 🔗 Links to necessary documentation and GitHub repository are provided in the description, with a blog for the latest updates.
  • 🛠️ kubeadm simplifies Kubernetes cluster setup, following best practices and providing hands-on experience with system complexities.
  • 📚 Self-hosted Kubernetes clusters offer valuable learning for DevOps engineers, especially for certification exams like CKA and CKS.
  • 💻 Prerequisites include two or more virtual machines (VMs), static IPs, and sufficient CPU/RAM for both master and worker nodes.
  • 📶 Ensure nodes can communicate on required ports and allow proper routing between subnets to avoid IP conflicts.
  • 🛑 Swap must be disabled on all nodes, and nodes should have CRI-O as the container runtime and kubeadm, kubelet, and kubectl installed.
  • 📄 Scripts provided automate setup tasks for both common node and master node configurations, making the process faster.
  • 📊 After setting up the cluster, install the Kubernetes metric server to track CPU and memory usage across nodes and pods.
  • 🌐 Final validation of the cluster includes deploying an NGINX app and verifying access via NodePort, ensuring the setup is successful.

Q & A

  • What is the purpose of using kubeadm in Kubernetes cluster setup?

    -Kubeadm is used to simplify the process of setting up a working Kubernetes cluster. It follows best practices for configuring the cluster components, making it faster and easier to deploy Kubernetes clusters.

  • Why is it recommended to use a self-hosted Kubernetes cluster for learning purposes?

    -A self-hosted Kubernetes cluster provides hands-on experience and exposes learners to the complexities of managing a cluster. This deeper understanding of the control plane and worker node components is essential for DevOps engineers and is especially useful when preparing for certifications like CKA or CKS.

  • What are the prerequisites for setting up a Kubernetes cluster using kubeadm?

    -The prerequisites include having at least two nodes: one master node and one worker node. The master node should have a minimum of 2 vCPUs and 2GB of RAM, while worker nodes require at least 1 vCPU and 2GB of RAM. Additionally, nodes should have an IP range in the 10.x or 172.x series with static IPs.

  • What is the significance of using the Calico Network plugin in this setup?

    -The Calico Network plugin is used to enable pod networking in the Kubernetes cluster. It ensures that there are non-overlapping node and pod IP addresses to avoid any routing conflicts, allowing the nodes and pods to communicate efficiently.

  • What is the purpose of running the 'common.sh' script on all nodes?

    -The 'common.sh' script installs necessary components like the container runtime (CRIO), kubelet, kubectl, and kubeadm. It also configures swap settings and sets up kubelet's extra arguments to ensure the correct IPs are used in multi-IP environments.

  • What does the 'master.sh' script do on the master node?

    -The 'master.sh' script sets up the control plane components by initializing kubeadm, configuring networking with the pod CIDR, pulling control plane images, and starting the kubelet service. It also sets up Calico for networking and allows the API server to be accessed via public or private IPs.

  • What is the process for adding worker nodes to the Kubernetes cluster?

    -Worker nodes are added to the cluster by running the 'kubeadm join' command on the worker nodes. This command, generated during the master node setup, allows the worker nodes to connect to the control plane. The TLS certificates required for secure communication between the master and worker nodes are automatically created.

  • Why is it necessary to install the Kubernetes metrics server?

    -The metrics server is required to collect and store resource usage data (CPU and memory) from each node in the cluster. Without it, commands like 'kubectl top' would return errors, making it difficult to monitor the performance of the cluster and its components.

  • How can you validate that the Kubernetes cluster is working properly after setup?

    -Validation is done by deploying a sample application (such as nginx) and exposing it using a NodePort service. Accessing the application from the public or private IP of the worker nodes on the specified port (e.g., 32000) confirms that the cluster is functioning correctly.

  • How can you manage the Kubernetes cluster from your local workstation?

    -To manage the cluster from your local workstation, you need to copy the 'admin.conf' file from the master node to your local machine’s '.kube' directory. This file contains the API server endpoint and authentication details, allowing kubectl commands to interact with the cluster remotely.

Outlines

plate

This section is available to paid users only. Please upgrade to access this part.

Upgrade Now

Mindmap

plate

This section is available to paid users only. Please upgrade to access this part.

Upgrade Now

Keywords

plate

This section is available to paid users only. Please upgrade to access this part.

Upgrade Now

Highlights

plate

This section is available to paid users only. Please upgrade to access this part.

Upgrade Now

Transcripts

plate

This section is available to paid users only. Please upgrade to access this part.

Upgrade Now
Rate This

5.0 / 5 (0 votes)

Related Tags
Kubernetes setupkubeadm tutorialDevOps guideCluster managementCloud deploymentContainer runtimeAWS serversNetworkingCertification prepTerraform script