Loading…
Loading documentation...
Connect kubectl to your Servers Are Up K3s Kubernetes cluster, deploy a replicated service with probes and expose it with Traefik HTTPS.
Commands checked on 2026-11-12 with K3s v1.31 (Kubernetes 1.31), kubectl 1.31, Traefik v3.
Your workstation's kubectl will connect securely to a CNCF-certified K3s Kubernetes cluster on Servers Are Up, running a two-replica stateless Deployment with CPU/memory requests and limits, readiness and liveness probes, a ClusterIP Service, and a TLS-terminated Ingress route serving traffic on your custom domain.
kubectl (v1.30+) installed locally (kubectl version --client)./containers or Home > Create a resource (/dashboard/store), or a K3s node running on an Ubuntu 24.04 Linux VPS.k8s-app.example.com) pointed at your cluster's ingress IPv4 address (203.0.113.60), with inbound ports 80 and 443 enabled in Network > Firewall (/dashboard/network?tab=firewall).kubeconfig over an SSH tunnel or private VPNKeep TCP port 6443 (the Kubernetes API server) off the public internet whenever possible. Copy /etc/rancher/k3s/k3s.yaml from the control-plane host into ~/.kube/sau-k3s.yaml with 0600 permissions and bind a local SSH port forward (or use your environment's WireGuard mesh IP 172.30.1.20):
install -d -m 0700 ~/.kube
ssh -i ~/.ssh/id_sau_ed25519 -p 31001 ubuntu@203.0.113.60 "sudo cat /etc/rancher/k3s/k3s.yaml" \
| sed 's/127.0.0.1:6443/127.0.0.1:16443/' > ~/.kube/sau-k3s.yaml
chmod 0600 ~/.kube/sau-k3s.yaml
# Open a background local tunnel to the K3s API server
ssh -i ~/.ssh/id_sau_ed25519 -p 31001 -fN -L 16443:127.0.0.1:6443 ubuntu@203.0.113.60
export KUBECONFIG=~/.kube/sau-k3s.yaml
kubectl get nodes -o wide
Isolate application workloads outside default and kube-system. Save the following declarative manifest as k8s-web-app.yaml, defining a namespace, a two-replica rolling Deployment running as non-root UID 101, and a ClusterIP Service:
apiVersion: v1
kind: Namespace
metadata:
name: prod-web
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: web-frontend
namespace: prod-web
spec:
replicas: 2
revisionHistoryLimit: 5
strategy:
type: RollingUpdate
rollingUpdate:
maxUnavailable: 0
maxSurge: 1
selector:
matchLabels:
app.kubernetes.io/name: web-frontend
template:
metadata:
labels:
app.kubernetes.io/name: web-frontend
spec:
securityContext:
runAsNonRoot: true
seccompProfile:
type: RuntimeDefault
containers:
- name: web
image: nginxinc/nginx-unprivileged:1.27-alpine
ports:
- containerPort: 8080
name: http
resources:
requests:
cpu: 100m
memory: 128Mi
limits:
cpu: 500m
memory: 256Mi
readinessProbe:
httpGet:
path: /
port: http
initialDelaySeconds: 3
periodSeconds: 10
livenessProbe:
httpGet:
path: /
port: http
initialDelaySeconds: 10
periodSeconds: 20
---
apiVersion: v1
kind: Service
metadata:
name: web-frontend
namespace: prod-web
spec:
selector:
app.kubernetes.io/name: web-frontend
ports:
- name: http
port: 80
targetPort: http
Apply the manifest and watch the rollout finish with zero unavailable pods:
kubectl apply -f k8s-web-app.yaml
kubectl -n prod-web rollout status deployment/web-frontend
K3s ships with Traefik pre-installed as the cluster Ingress controller. Install cert-manager once per cluster to automate Let's Encrypt certificates, then create a ClusterIssuer and Ingress:
kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.16.1/cert-manager.yaml
kubectl -n cert-manager rollout status deployment/cert-manager-webhook
Save k8s-ingress.yaml and apply it:
apiVersion: cert-manager.io/v1
kind: ClusterIssuer
metadata:
name: letsencrypt-prod
spec:
acme:
email: ops@example.com
server: https://acme-v02.api.letsencrypt.org/directory
privateKeySecretRef:
name: letsencrypt-prod-account-key
solvers:
- http01:
ingress:
ingressClassName: traefik
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: web-frontend
namespace: prod-web
annotations:
cert-manager.io/cluster-issuer: letsencrypt-prod
spec:
ingressClassName: traefik
tls:
- hosts:
- k8s-app.example.com
secretName: k8s-app-tls
rules:
- host: k8s-app.example.com
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: web-frontend
port:
number: 80
kubectl apply -f k8s-ingress.yaml
Verify that both pods are 1/1 Running, the Certificate reaches Ready=True, and your HTTPS domain responds with HTTP/2 200:
kubectl -n prod-web get pods,svc,ingress,certificate
curl -fsSI https://k8s-app.example.com | head -n 5
Test zero-downtime rolling updates by bumping an annotation (kubectl -n prod-web rollout restart deployment/web-frontend) while running curl in another terminal—no requests drop because maxUnavailable: 0 waits for the new pod's readinessProbe before terminating an old pod.
Unable to connect to the server: EOF or certificate mismatch on 6443. If you connect over a public or VPN IP not listed in K3s's API server SANs, add tls-san: ["172.30.1.20"] to /etc/rancher/k3s/config.yaml and run sudo systemctl restart k3s, or connect through 127.0.0.1 over the SSH port-forward shown in Step 1.Certificate stays Ready=False in cert-manager. Run kubectl -n prod-web describe challenge—almost always DNS for k8s-app.example.com still points elsewhere or inbound port 80 is blocked in Network > Firewall (/dashboard/network?tab=firewall).CreateContainerConfigError: container has runAsNonRoot and image will run as root. Standard nginx:alpine runs master processes as UID 0; use nginxinc/nginx-unprivileged or set USER 1000 in your own Dockerfile.resources.requests and resources.limits on every container so a memory leak in one pod cannot evict coredns, traefik, or kubelet on the node./dashboard/container-registry) using namespace-scoped kubernetes.io/dockerconfigjson pull secrets./var/lib/rancher/k3s/server/db/snapshots) off-host to Home > Cloud storage & pub/sub (/dashboard/blob-storage).Every Servers Are Up virtual machine and container includes an integrated HTML5 browser-based SSH, RDP, and VNC console in your dashboard, default-off inbound firewall rules with per-IP allow-lists, and full programmatic control via REST API v1 and Model Context Protocol (MCP). Explore our Virtual Datacenter Plans or reach out to Servers Are Up Support.