Bobcares

Kubernetes Cluster Deployment on Proxmox 8 | How To?

by | Nov 12, 2024

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
    1. Kubernetes Cluster Deployment on Proxmox 8
    2. Steps for Kubernetes Cluster Deployment on Proxmox 8
    3. Conclusion

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.

Kubernetes cluster deployment 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.

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Never again lose customers to poor
server speed! Let us help you.

Privacy Preference Center

Necessary

Necessary cookies help make a website usable by enabling basic functions like page navigation and access to secure areas of the website. The website cannot function properly without these cookies.

PHPSESSID - Preserves user session state across page requests.

gdpr[consent_types] - Used to store user consents.

gdpr[allowed_cookies] - Used to store user allowed cookies.

PHPSESSID, gdpr[consent_types], gdpr[allowed_cookies]
PHPSESSID
WHMCSpKDlPzh2chML

Statistics

Statistic cookies help website owners to understand how visitors interact with websites by collecting and reporting information anonymously.

_ga - Preserves user session state across page requests.

_gat - Used by Google Analytics to throttle request rate

_gid - Registers a unique ID that is used to generate statistical data on how you use the website.

smartlookCookie - Used to collect user device and location information of the site visitors to improve the websites User Experience.

_ga, _gat, _gid
_ga, _gat, _gid
smartlookCookie
_clck, _clsk, CLID, ANONCHK, MR, MUID, SM

Marketing

Marketing cookies are used to track visitors across websites. The intention is to display ads that are relevant and engaging for the individual user and thereby more valuable for publishers and third party advertisers.

IDE - Used by Google DoubleClick to register and report the website user's actions after viewing or clicking one of the advertiser's ads with the purpose of measuring the efficacy of an ad and to present targeted ads to the user.

test_cookie - Used to check if the user's browser supports cookies.

1P_JAR - Google cookie. These cookies are used to collect website statistics and track conversion rates.

NID - Registers a unique ID that identifies a returning user's device. The ID is used for serving ads that are most relevant to the user.

DV - Google ad personalisation

_reb2bgeo - The visitor's geographical location

_reb2bloaded - Whether or not the script loaded for the visitor

_reb2bref - The referring URL for the visit

_reb2bsessionID - The visitor's RB2B session ID

_reb2buid - The visitor's RB2B user ID

IDE, test_cookie, 1P_JAR, NID, DV, NID
IDE, test_cookie
1P_JAR, NID, DV
NID
hblid
_reb2bgeo, _reb2bloaded, _reb2bref, _reb2bsessionID, _reb2buid

Security

These are essential site cookies, used by the google reCAPTCHA. These cookies use an unique identifier to verify if a visitor is human or a bot.

SID, APISID, HSID, NID, PREF
SID, APISID, HSID, NID, PREF