Kubernetes
    Visual Management

    Deploy Kubernetes with Lens on a VPS

    Set up a lightweight K3s cluster on your RamNode VPS and manage it visually with Lens Desktop — real-time metrics, Helm chart management, and workload control from an intuitive GUI.

    At a Glance

    ToolsK3s + Lens Desktop (or Freelens)
    Recommended Plan2 GB RAM dev/test, 4 GB+ production
    OSUbuntu 24.04 LTS
    Key FeatureVisual Kubernetes management with real-time metrics
    Estimated Setup Time30–45 minutes

    Prerequisites

    • A RamNode VPS with at least 2 GB RAM (Ubuntu 24.04 LTS)
    • SSH key-based authentication configured
    • A local workstation running macOS, Windows, or Linux
    • A domain name (optional, recommended for production)
    1

    Provision and Prepare Your VPS

    SSH in, update the system, and create a non-root user:

    Initial setup
    ssh root@YOUR_SERVER_IP
    apt update && apt upgrade -y
    adduser k8sadmin
    usermod -aG sudo k8sadmin

    Set Up SSH Key Auth

    From your local machine
    ssh-copy-id k8sadmin@YOUR_SERVER_IP
    Disable password auth on server
    sudo sed -i 's/^#*PasswordAuthentication.*/PasswordAuthentication no/' /etc/ssh/sshd_config
    sudo systemctl restart sshd
    Set hostname
    sudo hostnamectl set-hostname k3s-node
    echo "127.0.1.1 k3s-node" | sudo tee -a /etc/hosts
    2

    Install K3s

    K3s provides a single-binary Kubernetes installation including kubectl, containerd, Traefik, CoreDNS, and metrics-server.

    Install K3s
    curl -sfL https://get.k3s.io | sh -
    Verify installation
    sudo systemctl status k3s
    sudo kubectl get nodes
    sudo kubectl get pods -A

    Expected output: Your node should show Ready status with system pods for coredns, traefik, metrics-server, and local-path-provisioner all Running.

    3

    Configure the Firewall

    UFW rules for K3s
    sudo apt install ufw -y
    sudo ufw default deny incoming
    sudo ufw default allow outgoing
    sudo ufw allow 22/tcp
    sudo ufw allow 6443/tcp
    sudo ufw allow 80/tcp
    sudo ufw allow 443/tcp
    sudo ufw allow 8472/udp
    sudo ufw allow 10250/tcp
    sudo ufw enable

    Restrict API by IP (Recommended)

    Lock API to your IP
    sudo ufw delete allow 6443/tcp
    sudo ufw allow from YOUR_LOCAL_IP to any port 6443 proto tcp
    4

    Set Up Remote Kubeconfig

    Copy the K3s kubeconfig to your local machine and update the server address:

    Copy kubeconfig
    mkdir -p ~/.kube
    scp k8sadmin@YOUR_SERVER_IP:/etc/rancher/k3s/k3s.yaml ~/.kube/ramnode-k3s.yaml

    If you get a permission error:

    Fix permissions on server
    sudo cp /etc/rancher/k3s/k3s.yaml /home/k8sadmin/k3s.yaml
    sudo chown k8sadmin:k8sadmin /home/k8sadmin/k3s.yaml
    Update server address (macOS)
    sed -i '' 's/127.0.0.1/YOUR_SERVER_IP/g' ~/.kube/ramnode-k3s.yaml
    Update server address (Linux)
    sed -i 's/127.0.0.1/YOUR_SERVER_IP/g' ~/.kube/ramnode-k3s.yaml
    Verify remote access
    KUBECONFIG=~/.kube/ramnode-k3s.yaml kubectl get nodes
    5

    Install Lens Desktop

    Download Lens from k8slens.dev or use a package manager:

    macOS (Homebrew)
    brew install --cask lens
    Linux (Debian/Ubuntu)
    curl -fsSL https://downloads.k8slens.dev/keys/gpg | gpg --dearmor | sudo tee /usr/share/keyrings/lens-archive-keyring.gpg > /dev/null
    
    echo "deb [arch=amd64 signed-by=/usr/share/keyrings/lens-archive-keyring.gpg] https://downloads.k8slens.dev/apt/debian stable main" | sudo tee /etc/apt/sources.list.d/lens.list > /dev/null
    
    sudo apt update
    sudo apt install lens-desktop

    Open-Source Alternative: Freelens is a community-maintained fork providing core Lens functionality without a commercial license.

    6

    Connect Lens to Your K3s Cluster

    In Lens Desktop:

    • Click Catalog+Add from kubeconfig file
    • Browse to ~/.kube/ramnode-k3s.yaml
    • Select the cluster context and click Add Cluster

    Rename Context (Optional)

    kubeconfig context rename
    contexts:
    - context:
        cluster: ramnode-k3s
        user: ramnode-k3s-admin
      name: ramnode-k3s
    
    clusters:
    - cluster:
        server: https://YOUR_SERVER_IP:6443
        certificate-authority-data: <base64-data>
      name: ramnode-k3s
    7

    Enable Metrics and Monitoring

    K3s ships with metrics-server pre-installed:

    Verify metrics
    sudo kubectl top nodes
    sudo kubectl top pods -A

    Enable Lens Built-In Prometheus (Optional)

    Right-click the cluster → SettingsMetrics → choose Lens as the Prometheus source. Lens deploys a lightweight Prometheus into the lens-metrics namespace.

    Resource note: The built-in Prometheus adds ~200–300 MB RAM overhead. On a 2 GB plan, consider using the default metrics-server instead.

    8

    Deploy a Sample Application

    Create namespace and deploy Nginx
    kubectl create namespace demo
    kubectl -n demo create deployment nginx --image=nginx:latest --replicas=2
    kubectl -n demo expose deployment nginx --port=80 --type=ClusterIP

    In Lens, navigate to Workloads → Deployments to see the nginx deployment with 2/2 pods ready.

    Create an Ingress (Optional)

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

    Managing Workloads Through Lens

    FeatureDescription
    Log StreamingClick any pod → Logs tab. Filter by container, search, download.
    Shell AccessRight-click pod → Shell. Interactive terminal inside the container.
    Resource EditingDouble-click any resource to edit YAML and apply directly.
    ScalingRight-click deployment → Scale to adjust replicas in real time.
    Rolling RestartsRight-click deployment → Restart to trigger a rolling restart.
    10

    Helm Chart Management

    Add Helm repos
    helm repo add bitnami https://charts.bitnami.com/bitnami
    helm repo add jetstack https://charts.jetstack.io
    helm repo update

    In Lens: Helm → Charts to browse, install, and configure charts. Helm → Releases to upgrade, rollback, or uninstall.

    11

    Security Hardening

    TLS SANs for API Server

    Install with TLS SANs
    curl -sfL https://get.k3s.io | sh -s - --tls-san YOUR_SERVER_IP --tls-san k3s.yourdomain.com

    Restrict Kubeconfig Permissions

    Lock down kubeconfig
    chmod 600 ~/.kube/ramnode-k3s.yaml

    SSH Tunnel (Alternative to Exposing 6443)

    SSH tunnel
    ssh -L 6443:127.0.0.1:6443 k8sadmin@YOUR_SERVER_IP -N

    Then update your kubeconfig to point to https://127.0.0.1:6443. Keeps the API completely off the public internet.

    12

    Backup and Recovery

    Manual snapshot
    sudo k3s etcd-snapshot save --name pre-upgrade-snapshot

    Automated Daily Snapshots

    Cron job
    0 2 * * * /usr/local/bin/k3s etcd-snapshot save --name daily-$(date +\%Y\%m\%d)

    Snapshots stored in /var/lib/rancher/k3s/server/db/snapshots/.

    Restore from Snapshot

    Restore
    sudo systemctl stop k3s
    sudo k3s server --cluster-reset --cluster-reset-restore-path=/var/lib/rancher/k3s/server/db/snapshots/SNAPSHOT_NAME
    sudo systemctl start k3s

    Troubleshooting

    • Lens cannot connect — Verify port 6443 is open: sudo ufw status | grep 6443. Test with curl -k https://YOUR_SERVER_IP:6443/version.
    • Pods stuck in Pending — Check resources: kubectl describe node k3s-node and kubectl top nodes.
    • Metrics not showing — Confirm metrics-server is running: kubectl get pods -n kube-system | grep metrics. Wait 60s after connection.
    • K3s fails to start — Check logs: sudo journalctl -u k3s -f. Verify at least 512 MB RAM available.
    • High memory usage — Disable Lens Prometheus stack and rely on built-in metrics-server, or upgrade your VPS plan.