To setup Kubernetes Cluster Deployment on Proxmox 8, we can follow the below steps explained in this article. At Bobcares, we assist our customers with several queries on a daily basis as part of our Kubernetes Support Services.
Overview
Kubernetes Cluster Deployment on Proxmox 8
Kubernetes is one of the most popular platforms for building scalable, efficient applications, especially in enterprise environments. It streamlines the deployment and management of containerized applications, making it essential for modern development. By mastering Kubernetes, not only do we gain valuable skills, but we also open up new career opportunities, particularly in cloud-based services.
Prerequisites for Kubernetes on Proxmox 8.
To start with Kubernetes on Proxmox 8, we need:
- Proxmox VE 8: Installed and configured on a physical server.
- Proxmox-compatible hardware: Sufficient CPU, memory, and storage to run multiple virtual machines for the Kubernetes nodes.
- Network setup: Configured for Kubernetes cluster communication (bridged networking or VLANs recommended).
- SSH keys: Generated for streamlined remote management of nodes.
Steps for Kubernetes Cluster Deployment on Proxmox 8
Step 1: Set Up Virtual Machines for Kubernetes Nodes
For an efficient Kubernetes setup, we’ll need at least one master node and one or more worker nodes. For high availability, use three master nodes.
1. Create a VM Template:
In Proxmox, create a new VM and install a suitable operating system (such as Ubuntu Server 22.04 or CentOS).
Configure the OS and install basic tools (e.g., curl, vim, ssh).
Once setup is complete, convert the VM into a template.
2. Clone VMs for Kubernetes Nodes:
Clone the template to create VMs for each Kubernetes node (e.g., k8s-master-01, k8s-worker-01).
Assign resources to each node (e.g., 2 vCPUs and 4GB RAM for master nodes, at least 2GB RAM for worker nodes).
Ensure each node has a unique IP for cluster communication.
Step 2: Configure Networking for Kubernetes Nodes
A stable network setup is crucial for seamless inter-node communication in Kubernetes.
1. Set Up Bridge Networking:
In Proxmox, create a bridge network (e.g., vmbr0) if not already configured.
Go to Datacenter > Network, create a Linux bridge, and configure it to allow communication between VMs.
2. Assign Static IPs:
Assign each VM a static IP on the bridge network or use DHCP reservations for consistency in network settings.
Step 3: Install Kubernetes on Each Node
1. Install Container Runtime:
Kubernetes supports multiple runtimes, but containerd is popular for simplicity.
Run the following on each VM:
sudo apt update sudo apt install -y containerd
2. Install Kubernetes Tools (kubeadm, kubelet, kubectl):
Install required Kubernetes components on each VM with these commands:
sudo apt update sudo apt install -y apt-transport-https curl curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add - sudo apt-add-repository "deb http://apt.kubernetes.io/ kubernetes-xenial main" sudo apt update sudo apt install -y kubelet kubeadm kubectl sudo apt-mark hold kubelet kubeadm kubectl
Step 4: Initialize the Kubernetes Cluster on the Master Node
1. On the master node:
Initialize kubeadm:
Initialize the cluster with:
sudo kubeadm init --pod-network-cidr=10.244.0.0/16
Copy the join command with the token generated at the end of the initialization to add worker nodes later.
2. Configure kubectl:
Set up kubectl for the root user with:
mkdir -p $HOME/.kube sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config sudo chown $(id -u):$(id -g) $HOME/.kube/config
3. Deploy a Pod Network:
Install a pod network (such as Calico or Flannel) to enable networking between containers.
Step 5: Join Worker Nodes to the Kubernetes Cluster
1. On each worker node:
Run the Join Command:
Use the command generated on the master node to join each worker node to the cluster:
sudo kubeadm join :6443 --token --discovery-token-ca-cert-hash sha256:
2. Verify Node Addition:
On the master node, run the following command to confirm that worker nodes have joined:
kubectl get nodes
Step 6: Verify and Manage the Kubernetes Cluster
1. Check Cluster Health:
Run kubectl get nodes and kubectl get pods -A to ensure nodes and pods are operational.
2. Deploy a Test Application:
Deploy a test application like Nginx to confirm that everything is working:
kubectl create deployment nginx --image=nginx kubectl expose deployment nginx --type=NodePort --port=80
3. Access the application by navigating to the NodePort URL.
[Need to know more? Get in touch with us if you have any further inquiries.]
Conclusion
Setting up a Kubernetes cluster on Proxmox 8 gives us a robust environment for deploying and managing scalable applications. With these steps, we’ll be well-prepared to dive deeper into Kubernetes, enhance the skills, and expand the career possibilities in containerized environments.
var google_conversion_label = "owonCMyG5nEQ0aD71QM";
0 Comments