K3s is a production-grade Kubernetes distribution that runs in under 512 MB of RAM — making it practical on a Hong Kong VPS where full upstream Kubernetes would consume the entire server. Developed by Rancher, K3s bundles everything needed for a functional Kubernetes cluster into a single binary, perfect for teams that want Kubernetes’ declarative deployment model and ecosystem without the operational overhead of a full cluster.
Why K3s on a VPS (and When Not To)
Use K3s when: your team already knows Kubernetes; you want Helm chart deployments; you need Kubernetes-native tooling (kubectl, kustomize, ArgoCD); or you’re moving workloads between your VPS and a managed Kubernetes cluster (AKS, GKE).
Use Docker Compose instead when: your team is not already Kubernetes-familiar; your application is a handful of containers; you want simpler operations without YAML abstraction layers.
VPS Requirements
| Use Case | RAM | vCPU | Storage |
|---|---|---|---|
| Single-node K3s (dev/staging) | 2 GB | 2 | 40 GB NVMe |
| Single-node K3s (production) | 4 GB | 4 | 80 GB NVMe |
| Multi-node K3s (HA) | 4 GB × 3 nodes | 4 × 3 | 60 GB × 3 |
Step 1: Install K3s (Single Node)
apt update && apt upgrade -y
ufw allow 22/tcp && ufw allow 80/tcp && ufw allow 443/tcp
ufw allow 6443/tcp # Kubernetes API server
ufw enable
# Install K3s with Traefik disabled (we'll use our own ingress)
curl -sfL https://get.k3s.io | INSTALL_K3S_EXEC="server \
--disable traefik \
--disable servicelb \
--write-kubeconfig-mode 644" sh -
# Verify K3s is running
systemctl status k3s
kubectl get nodes
<code"># Expected output: # NAME STATUS ROLES AGE VERSION # hk-vps-1 Ready control-plane,master 60s v1.29.x+k3s1
Configure kubectl
<code"># On the VPS — kubectl is pre-configured kubectl get pods --all-namespaces # On your LOCAL machine — copy kubeconfig scp root@YOUR_VPS_IP:/etc/rancher/k3s/k3s.yaml ~/.kube/config-hkvps # Edit the file: change server: https://127.0.0.1:6443 # to: server: https://YOUR_VPS_IP:6443 export KUBECONFIG=~/.kube/config-hkvps kubectl get nodes # Should work from local machine
Step 2: Install Helm
<code">curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash helm version
Step 3: Install Ingress-Nginx
<code">helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx helm repo update helm install ingress-nginx ingress-nginx/ingress-nginx \ --namespace ingress-nginx \ --create-namespace \ --set controller.hostNetwork=true \ --set controller.kind=DaemonSet \ --set controller.service.type=ClusterIP # Wait for ingress controller to start kubectl -n ingress-nginx rollout status daemonset ingress-nginx-controller
Step 4: Install cert-manager for SSL
<code">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
# Wait for cert-manager to be ready
kubectl -n cert-manager rollout status deployment cert-manager
# Create ClusterIssuer for Let's Encrypt
cat << 'EOF' | kubectl apply -f -
apiVersion: cert-manager.io/v1
kind: ClusterIssuer
metadata:
name: letsencrypt-prod
spec:
acme:
server: https://acme-v02.api.letsencrypt.org/directory
email: admin@yourdomain.com
privateKeySecretRef:
name: letsencrypt-prod
solvers:
- http01:
ingress:
class: nginx
EOF
Step 5: Deploy an Application
<code">cat << 'EOF' | kubectl apply -f -
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: myapp
namespace: default
spec:
replicas: 2
selector:
matchLabels:
app: myapp
template:
metadata:
labels:
app: myapp
spec:
containers:
- name: myapp
image: your-registry/myapp:latest
ports:
- containerPort: 3000
env:
- name: NODE_ENV
value: production
resources:
requests:
memory: "128Mi"
cpu: "100m"
limits:
memory: "512Mi"
cpu: "500m"
livenessProbe:
httpGet:
path: /health
port: 3000
initialDelaySeconds: 10
periodSeconds: 30
readinessProbe:
httpGet:
path: /health
port: 3000
initialDelaySeconds: 5
periodSeconds: 10
---
apiVersion: v1
kind: Service
metadata:
name: myapp
namespace: default
spec:
selector:
app: myapp
ports:
- port: 80
targetPort: 3000
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: myapp
namespace: default
annotations:
kubernetes.io/ingress.class: nginx
cert-manager.io/cluster-issuer: letsencrypt-prod
nginx.ingress.kubernetes.io/proxy-read-timeout: "60"
spec:
tls:
- hosts:
- app.yourdomain.com
secretName: myapp-tls
rules:
- host: app.yourdomain.com
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: myapp
port:
number: 80
EOF
# Watch rollout
kubectl rollout status deployment/myapp
kubectl get ingress myapp
Step 6: Persistent Storage with Local Path Provisioner
K3s includes the local-path-provisioner by default — it creates persistent volumes backed by the VPS’s NVMe storage:
<code">cat << 'EOF' | kubectl apply -f -
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: postgres-pvc
spec:
accessModes:
- ReadWriteOnce
storageClassName: local-path
resources:
requests:
storage: 20Gi
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: postgres
spec:
replicas: 1
selector:
matchLabels:
app: postgres
template:
metadata:
labels:
app: postgres
spec:
containers:
- name: postgres
image: postgres:16-alpine
env:
- name: POSTGRES_PASSWORD
valueFrom:
secretKeyRef:
name: postgres-secret
key: password
volumeMounts:
- mountPath: /var/lib/postgresql/data
name: postgres-storage
volumes:
- name: postgres-storage
persistentVolumeClaim:
claimName: postgres-pvc
EOF
Step 7: Secrets Management
<code"># Create secrets (base64-encoded) kubectl create secret generic postgres-secret \ --from-literal=password=StrongDBPassword! kubectl create secret generic app-secrets \ --from-literal=jwt-secret=$(openssl rand -hex 32) \ --from-literal=redis-password=StrongRedisPass! # Reference in pod spec: # env: # - name: DB_PASSWORD # valueFrom: # secretKeyRef: # name: postgres-secret # key: password
Step 8: Rolling Updates and Rollback
<code"># Update image to new version kubectl set image deployment/myapp myapp=your-registry/myapp:v2.0.0 # Watch rolling update kubectl rollout status deployment/myapp # Check history kubectl rollout history deployment/myapp # Roll back to previous version kubectl rollout undo deployment/myapp # Roll back to specific revision kubectl rollout undo deployment/myapp --to-revision=2
Useful K3s Commands
<code"># Cluster status kubectl get nodes -o wide kubectl top nodes kubectl top pods --all-namespaces # Pod debugging kubectl describe pod POD_NAME kubectl logs POD_NAME -f kubectl exec -it POD_NAME -- /bin/sh # Certificate status kubectl get certificates --all-namespaces kubectl describe certificate myapp-tls -n default # K3s service management systemctl status k3s journalctl -u k3s -f
Multi-Node K3s for High Availability
<code"># On a SECOND Hong Kong VPS — join as worker node # Get the node token from the master cat /var/lib/rancher/k3s/server/node-token # Copy token value # On worker VPS: curl -sfL https://get.k3s.io | K3S_URL=https://MASTER_VPS_IP:6443 \ K3S_TOKEN=MASTER_NODE_TOKEN sh - # Verify on master: kubectl get nodes # NAME STATUS ROLES AGE # hk-vps-1 Ready control-plane,master 5m # hk-vps-2 Ready 30s
Conclusion
K3s on a Hong Kong VPS brings Kubernetes to environments where full upstream Kubernetes would be impractical — single-binary installation, under 512 MB overhead, and full kubectl/Helm compatibility. Teams migrating from managed cloud Kubernetes can deploy the same manifests on a K3s VPS with CN2 GIA routing, cutting infrastructure costs while maintaining the Kubernetes operational model their teams already know.
Run Kubernetes in Asia: Browse Server.HK Hong Kong VPS plans — a 4 GB plan comfortably runs K3s with ingress-nginx, cert-manager, and several application workloads.