// technology

How to Install and Configure Kubernetes (K3s) on a Linux VPS: Complete Guide to Container Orchestration

September 06, 2026 · by Alex M.

How to Install and Configure Kubernetes (K3s) on a Linux VPS: Complete Guide to Container Orchestration

Container orchestration has become an essential skill for any modern system administrator. Kubernetes is the industry standard, but its classic installation can be overwhelming for a single VPS. This is where K3s steps in — a lightweight, CNCF-certified Kubernetes distribution, ideal for production environments with limited resources.

In this guide you will learn how to install and configure K3s on a NVMe VPS or SSD VPS, from scratch to your first working deployment.


What Is K3s and Why Should You Choose It?

K3s is developed by Rancher Labs and packages the entire Kubernetes stack into a single ~70 MB binary. It removes rarely-used components and replaces etcd with SQLite (by default) or PostgreSQL/MySQL for larger clusters.

Advantages of K3s over classic Kubernetes:

  • ~50% lower RAM consumption
  • Full installation in under 2 minutes
  • Single binary — no complex external dependencies
  • ARM and x86_64 support
  • Perfect for CI/CD pipelines, edge computing, and dev/staging environments

If you need a more robust production cluster, consider a managed dedicated server for guaranteed resources and included technical support.


Prerequisites

Before you begin, make sure you have:

  • A VPS running Ubuntu 22.04 LTS or Debian 12 (recommended)
  • At least 2 vCPU and 2 GB RAM (4 GB recommended for real workloads)
  • Root access or a user with sudo privileges
  • Active SSH connection
  • Ports 6443 (API server) and 10250 open in the firewall

Step 1: Update the System and Prepare

Connect to your VPS and update packages:

sudo apt update && sudo apt upgrade -y

Install the necessary utilities:

sudo apt install -y curl wget git ufw

Enable UFW and configure basic rules:

sudo ufw allow ssh
sudo ufw allow 6443/tcp    # K3s API server
sudo ufw allow 10250/tcp   # Kubelet metrics
sudo ufw allow 80/tcp      # HTTP
sudo ufw allow 443/tcp     # HTTPS
sudo ufw enable

Note: If you plan to use multiple nodes in the cluster, also open port 8472/udp for Flannel VXLAN.


Step 2: Install K3s (Server/Master Node)

K3s installation is done with a single curl command:

curl -sfL https://get.k3s.io | sh -

The official script downloads the binary, creates a systemd service, and starts K3s automatically. Check the status:

sudo systemctl status k3s

You should see active (running). Also verify the Kubernetes node:

sudo kubectl get nodes

Expected output:

NAME        STATUS   ROLES                  AGE   VERSION
vps-demo    Ready    control-plane,master   2m    v1.29.4+k3s1

Step 3: Configure kubectl and kubeconfig

By default, the kubeconfig file is located at /etc/rancher/k3s/k3s.yaml. Copy it to your home directory to run kubectl without sudo:

mkdir -p ~/.kube
sudo cp /etc/rancher/k3s/k3s.yaml ~/.kube/config
sudo chown $(id -u):$(id -g) ~/.kube/config
export KUBECONFIG=~/.kube/config

Add the export to ~/.bashrc for persistence:

echo 'export KUBECONFIG=~/.kube/config' >> ~/.bashrc
source ~/.bashrc

Test it:

kubectl cluster-info

Step 4: Add a Worker Node (Optional)

If you have two VPS instances (e.g., a NVMe VPS for the master and an SSD VPS for the worker), you can scale out the cluster.

On the master node, get the join token:

sudo cat /var/lib/rancher/k3s/server/node-token

On the worker node, run:

curl -sfL https://get.k3s.io | K3S_URL=https://<MASTER_IP>:6443 K3S_TOKEN=<TOKEN> sh -

Verify on the master that the new node has joined:

kubectl get nodes

Step 5: Deploy Your First Application

Let's deploy a simple Nginx application to test the cluster.

Create a Deployment

kubectl create deployment nginx-demo --image=nginx:stable --replicas=2

Expose It as a Service

kubectl expose deployment nginx-demo --port=80 --type=NodePort

Check the Status

kubectl get pods
kubectl get services

Example output:

NAME                          READY   STATUS    RESTARTS   AGE
nginx-demo-7d6f8b9c5-4xkpz   1/1     Running   0          30s
nginx-demo-7d6f8b9c5-9qlmn   1/1     Running   0          30s

Find the assigned NodePort (e.g., 32456) and open http://<VPS_IP>:32456 in your browser.


Step 6: Install Helm — The Kubernetes Package Manager

Helm greatly simplifies deploying complex applications (cert-manager, Ingress controllers, etc.):

curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash

Verify:

helm version

Add the official stable repo:

helm repo add stable https://charts.helm.sh/stable
helm repo update

Step 7: Configure Ingress Controller and TLS

K3s ships with Traefik pre-installed as the default Ingress Controller. Verify:

kubectl get pods -n kube-system | grep traefik

To expose a web application with a custom domain, create a file ingress-demo.yaml:

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: nginx-ingress
  annotations:
    traefik.ingress.kubernetes.io/router.entrypoints: web
spec:
  rules:
  - host: demo.yourdomain.com
    http:
      paths:
      - path: /
        pathType: Prefix
        backend:
          service:
            name: nginx-demo
            port:
              number: 80

Apply it:

kubectl apply -f ingress-demo.yaml

For automatic TLS with Let's Encrypt, install cert-manager via Helm:

helm repo add jetstack https://charts.jetstack.io
helm repo update
helm install cert-manager jetstack/cert-manager \
  --namespace cert-manager \
  --create-namespace \
  --set installCRDs=true

This setup pairs perfectly with a valid SSL certificate for your domain.


Step 8: Monitoring and Resource Management

Kubernetes Dashboard

Install the Kubernetes Dashboard:

kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.7.0/aio/deploy/recommended.yaml

Create a ServiceAccount for access:

kubectl create serviceaccount dashboard-admin -n kubernetes-dashboard
kubectl create clusterrolebinding dashboard-admin \
  --clusterrole=cluster-admin \
  --serviceaccount=kubernetes-dashboard:dashboard-admin

Get the access token:

kubectl -n kubernetes-dashboard create token dashboard-admin

Useful Monitoring Commands

# Status of all pods
kubectl get pods --all-namespaces

# Resource usage (requires metrics-server)
kubectl top nodes
kubectl top pods

# Pod logs
kubectl logs <pod-name>

# Detailed description
kubectl describe pod <pod-name>

Step 9: Persistent Storage Configuration

K3s includes Local Path Provisioner by default — perfect for persistent volumes on a single node.

Create a PersistentVolumeClaim:

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: demo-pvc
spec:
  accessModes:
    - ReadWriteOnce
  storageClassName: local-path
  resources:
    requests:
      storage: 5Gi
kubectl apply -f pvc-demo.yaml
kubectl get pvc

K3s Security Tips for Production

The security of a Kubernetes cluster is just as important as the security of the server it runs on. Key measures:

  1. Restrict access to the API server — don't expose port 6443 publicly unless necessary
  2. Use RBAC — apply the principle of least privilege for services and users
  3. Enable Audit Logging — to track all cluster operations
  4. Update K3s regularlycurl -sfL https://get.k3s.io | sh - handles updates automatically
  5. Isolate namespaces — separate production and testing workloads
  6. Monitor with Grafana + Prometheus — for full infrastructure visibility

If you need help securing your infrastructure, CLIQHOST's server management services can take that responsibility off your hands.


Updating and Uninstalling K3s

Update

K3s can be updated by re-running the install script:

curl -sfL https://get.k3s.io | sh -

Uninstall

To fully uninstall K3s from the server node:

/usr/local/bin/k3s-uninstall.sh

For worker nodes:

/usr/local/bin/k3s-agent-uninstall.sh

Conclusion

K3s makes Kubernetes accessible even on modest infrastructure. By following the steps in this guide, you have installed a working cluster, deployed your first application, configured Ingress with Traefik, and laid the foundation for a secure and scalable production setup.

For a performant and stable K3s cluster, we recommend NVMe VPS hosting from CLIQHOST — with ultra-fast storage, guaranteed uptime, and 24/7 technical support. As your project grows, you can always scale up to a dedicated server or take advantage of our server management services.

Explore more guides and tutorials on the CLIQHOST blog.

👉 Have questions or want to find the right configuration for your project? Contact the CLIQHOST team — we're here to help.

SHARE
// what clients say

What Our Clients Say

Real reviews from customers who trust CLIQHOST for performance, reliability and expert technical support.

★★★★★

"We moved our online shop from a foreign host and the difference is night and day — pages load instantly and support replies in minutes, in Romanian."

AM
Andrei M.
eCommerce owner · Chișinău
★★★★★

"Migrated 12 client sites to CLIQHOST. Free migration, zero downtime, and the cPanel setup is exactly what my team needed. Highly recommend."

EV
Elena V.
Web agency · Bălți
★★★★★

"Our NVMe VPS handles traffic spikes without a sweat. Full root, local datacenter, and billing in MDL — everything we wanted from a provider."

DC
Dmitri C.
SaaS founder · Chișinău