Skip to content

How to run Kubernetes on a VPS with k3s

Lightweight Kubernetes on one or more AdAstra Cloud servers with k3s, deploying your first app and access via kubectl.

Updated: 2026-11-07 · 2 min read

Full Kubernetes needs a lot of resources, while k3s — a certified Kubernetes distribution in a single binary — runs even on small servers. One M server (4 vCPU, 8 GB RAM) is enough for a learning cluster; for production we recommend three servers or VDS.

Install the server (control plane)

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

k3s installs containerd, the Flannel network plugin, the Traefik ingress controller and local storage out of the box.

Join worker nodes

On the first server, get the token:

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

On each additional server, run this with the first server's IP and the token:

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

Open port 6443 in the firewall only for your nodes' addresses.

Manage it from your laptop

Copy the config to your computer and replace the address:

scp root@203.0.113.24:/etc/rancher/k3s/k3s.yaml ~/.kube/config
sed -i 's/127.0.0.1/203.0.113.24/' ~/.kube/config
kubectl get nodes

Your first app

app.yaml:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: hello
spec:
  replicas: 2
  selector:
    matchLabels: { app: hello }
  template:
    metadata:
      labels: { app: hello }
    spec:
      containers:
        - name: web
          image: nginx:stable
          ports: [{ containerPort: 80 }]
---
apiVersion: v1
kind: Service
metadata:
  name: hello
spec:
  selector: { app: hello }
  ports: [{ port: 80 }]
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: hello
spec:
  rules:
    - host: app.example.kz
      http:
        paths:
          - path: /
            pathType: Prefix
            backend:
              service: { name: hello, port: { number: 80 } }
kubectl apply -f app.yaml
kubectl get pods,svc,ingress

Point the DNS record for app.example.kz at the server's IP and Traefik will start serving traffic on port 80.

Next steps

  • HTTPS: install cert-manager to issue Let's Encrypt certificates automatically.
  • Storage: use PersistentVolumeClaims for data and S3 cloud storage for backups.
  • Monitoring: kube-prometheus-stack with Grafana.

Need a cluster of several VDS with dedicated cores? Message us and we'll suggest a configuration.