Piotr Skwarna Blog

Kubernetes Linux

Kubernetes on a VPS with one public IP: kubeadm, Gateway API and Let's Encrypt

kubeadmGateway APIEnvoy Gatewaycert-managerLet's EncryptUFW

You have a VPS with one public IP. You want real Kubernetes on it (not k3s, not minikube, but upstream kubeadm), and your apps should be reachable at https://<name>.k8s.skwarna.eu with valid certificates. No cloud load balancer, and no opening ports by hand for every app.

This guide covers the whole thing in two parts:

  1. The cluster: kubeadm + containerd + Flannel + metrics-server on a single node behind a firewall, plus three traps I fell into along the way.
  2. Exposing apps: wildcard DNS, the Gateway API implemented by Envoy Gateway (instead of the retired ingress-nginx), Let’s Encrypt certificates from cert-manager, and a way to get a “load balancer” without a load balancer.

The examples use my own domain, k8s.skwarna.eu; replace it with yours. The test app from this article is live: whoami.k8s.skwarna.eu shows the headers of your request as the pod in the cluster sees them. The server IP is 38.45.81.22.

Each part is installed by one script. A third one cleans up when you want to start from scratch:

Download install-k8s.sh

Download install-gateway.sh

Download reset-k8s.sh

The comments in the scripts are in Polish. Every script says what it is doing as it goes, and you can run any of them again safely.

What gets built

                    *.k8s.skwarna.eu  A  38.45.81.22
                                  │
 ┌────────────────────────────────▼───────────────────────────────────────┐
 │ VPS 38.45.81.22   UFW: deny incoming (except SSH)                      │
 │                                                                        │
 │  kube-proxy (iptables): dst 38.45.81.22:80/443 ───DNAT──┐              │
 │                                                         ▼              │
 │   ┌─────────────────────────┐     ┌───────────────────────────────┐    │
 │   │ Envoy (Gateway "web")   │────►│ HTTPRoute → Service → pod     │    │
 │   │ :80 → 301, :443 TLS     │     └───────────────────────────────┘    │
 │   └─────────────────────────┘                                          │
 │   cert-manager ◄──► Let's Encrypt        metrics-server, CoreDNS       │
 │                                                                        │
 │   control plane: etcd, apiserver :6443 (closed to the internet)        │
 │   kubelet + containerd, Flannel (pods 10.244.0.0/16)                   │
 └────────────────────────────────────────────────────────────────────────┘
ComponentVersion
OSUbuntu 26.04 (Debian works too)
Kuberneteskubeadm v1.37
Runtime / CNIcontainerd 2.2, Flannel
Metricsmetrics-server v0.9.1 (no --kubelet-insecure-tls)
Gateway APIEnvoy Gateway v1.9.3
Certificatescert-manager v1.21.3, Let’s Encrypt HTTP-01

Part 1: a kubeadm cluster on a VPS

Step 1: the VPS, and the firewall before anything else

The minimum is 2 vCPUs and 4 GB of RAM; 4 vCPUs and 8 GB is comfortable. With everything from this article installed, the node uses about 4 GB of memory, page cache included.

Firewall first, Kubernetes second. kubeadm exposes the API (6443), the kubelet (10250) and etcd (2379-2380) on the public IP, among others. On a VPS without a firewall, the whole internet sees them immediately. On Ubuntu, UFW is enough:

sudo ufw allow OpenSSH
sudo ufw enable
sudo ufw status verbose
Status: active
Default: deny (incoming), allow (outgoing), allow (routed)

To                         Action      From
--                         ------      ----
22/tcp (OpenSSH)           ALLOW IN    Anywhere
22/tcp (OpenSSH (v6))      ALLOW IN    Anywhere (v6)

Note the allow (routed) line: UFW’s default policy for forwarded traffic (FORWARD). Traffic to pods and to the gateway goes that way. More on that in part 2.

Step 2: installing the cluster with one script

chmod +x install-k8s.sh
sudo ./install-k8s.sh

All settings are environment variables at the top of the script:

VariableDefaultPurpose
K8S_VERSIONv1.37pkgs.k8s.io repo branch
POD_CIDR10.244.0.0/16pod network (Flannel’s default)
SERVICE_CIDR10.43.0.0/16Service network
PUBLIC_IPdetected from the default routeaddress the API is advertised on
API_SANemptyextra address in the API certificate, e.g. a VPN IP

What the script does, in order:

  1. Turns off swap (the kubelet requires it) and comments it out in /etc/fstab.

  2. Loads the overlay and br_netfilter modules, enables ip_forward and bridge-nf-call-iptables.

  3. Installs containerd with SystemdCgroup = true (the kubelet and the runtime must use the same cgroup driver).

  4. Adds the pkgs.k8s.io repo, installs kubelet, kubeadm and kubectl (with apt-mark hold) and pre-pulls the control plane images.

  5. Adds a UFW rule for the pod network (details in step 4).

  6. Runs kubeadm init from a config file, not flags:

    apiVersion: kubeadm.k8s.io/v1beta4
    kind: InitConfiguration
    localAPIEndpoint:
      advertiseAddress: 38.45.81.22
    ---
    apiVersion: kubeadm.k8s.io/v1beta4
    kind: ClusterConfiguration
    kubernetesVersion: v1.37.2
    networking:
      podSubnet: 10.244.0.0/16
      serviceSubnet: 10.43.0.0/16
    ---
    apiVersion: kubelet.config.k8s.io/v1beta1
    kind: KubeletConfiguration
    serverTLSBootstrap: true      # step 5
    

    Only a config file can set KubeletConfiguration, and kubeadm will not mix --config with flags like --pod-network-cidr.

  7. Installs Flannel.

  8. Removes the control-plane taint. There is only one node, so regular pods have to run on it too.

  9. Waits for Ready and copies the kubeconfig to /root/.kube/config and to the user who ran sudo.

  10. Installs metrics-server and prints the kubelet CSR that needs approval (step 5).

A few minutes later:

$ kubectl get nodes -o wide
NAME   STATUS   ROLES           AGE   VERSION   INTERNAL-IP    OS-IMAGE             CONTAINER-RUNTIME
vps1   Ready    control-plane   5m    v1.37.2   38.45.81.22   Ubuntu 26.04.1 LTS   containerd://2.2.2

$ kubectl get pods -A
NAMESPACE      NAME                              READY   STATUS    RESTARTS   AGE
kube-flannel   kube-flannel-ds-2n9jm             1/1     Running   0          5m
kube-system    coredns-559f6c778d-2bj74          1/1     Running   0          5m
kube-system    coredns-559f6c778d-2jx8d          1/1     Running   0          5m
kube-system    etcd-vps1                         1/1     Running   0          5m
kube-system    kube-apiserver-vps1               1/1     Running   0          5m
kube-system    kube-controller-manager-vps1      1/1     Running   0          5m
kube-system    kube-proxy-9mwrq                  1/1     Running   0          5m
kube-system    kube-scheduler-vps1               1/1     Running   0          5m
kube-system    metrics-server-6694d85c44-88gs9   1/1     Running   0          4m

That is how it looks when everything goes smoothly. Three things stopped me on the way. The script now works around all of them, but it is worth knowing where they come from.

Step 3: trap #1, a 403 over IPv6

The first run ended like this:

curl: (22) The requested URL returned error: 403
gpg: no valid OpenPGP data found.

And once that was worked around, while pulling images:

failed to pull image "registry.k8s.io/kube-apiserver:v1.37.2": ... 403 Forbidden

The Kubernetes project’s infrastructure (pkgs.k8s.io, registry.k8s.io) rejected my VPS’s IPv6 address. Over IPv4 everything worked:

$ U=https://registry.k8s.io/v2/pause/manifests/3.10.2
$ curl -4 -sI $U | head -1
HTTP/2 307
$ curl -6 -sI $U | head -1
HTTP/2 403

If your VPS has IPv6, check it with those two commands. The script forces IPv4 in three places anyway:

WhoWorkaround
curl (repo key)curl -4
apt/etc/apt/apt.conf.d/99force-ipv4: Acquire::ForceIPv4 "true";
containerd (images)/etc/gai.conf: precedence ::ffff:0:0/96 100 plus a systemd drop-in with GODEBUG=netdns=cgo

containerd needs two changes because it is written in Go, and Go’s built-in resolver ignores /etc/gai.conf. GODEBUG=netdns=cgo switches it to glibc’s getaddrinfo, which reads gai.conf and returns IPv4 before IPv6:

# /etc/systemd/system/containerd.service.d/prefer-ipv4.conf
[Service]
Environment=GODEBUG=netdns=cgo

This only works with a binary built with cgo. ldd /usr/bin/containerd should list libc.so.6, which is true for Ubuntu’s containerd package.

Step 4: trap #2, UFW blocks the pods

The node was Ready, but CoreDNS was stuck at 0/1 Running, with timeouts to 10.43.0.1:443 in its logs.

Pods talk to the API through the kubernetes Service (ClusterIP 10.43.0.1). kube-proxy rewrites that address (DNAT) to 38.45.81.22:6443, the node’s own public IP. So the packet lands in the host’s INPUT chain with a source address from the pod network. UFW with deny incoming does not know it and drops it.

The fix is one rule, which the script adds:

sudo ufw allow from 10.244.0.0/16 comment "k8s pods"

The API stays closed to the internet and is only open to pods. Checking from outside (another machine):

$ nc -zv -w3 38.45.81.22 6443
nc: connect to 38.45.81.22 port 6443 (tcp) timed out: Operation now in progress

Step 5: trap #3, metrics-server and the kubelet certificate

After installing metrics-server:

$ kubectl top nodes
error: Metrics API not available

Many guides answer this with the --kubelet-insecure-tls flag, which tells metrics-server not to check the kubelet’s certificate. It works, but it turns off TLS verification. It is better to fix the cause.

By default the kubelet has a self-signed certificate, so nobody trusts it. serverTLSBootstrap: true (set by the script in kubeadm init) makes the kubelet ask the cluster CA for a certificate: it sends a CSR with the kubernetes.io/kubelet-serving signer. Kubernetes does not approve these CSRs automatically, because a kubelet could put any address into the certificate. You approve it by hand, after checking the SANs:

$ kubectl get csr
NAME        AGE   SIGNERNAME                      REQUESTOR          CONDITION
csr-tf9pb   12s   kubernetes.io/kubelet-serving   system:node:vps1   Pending

$ kubectl get csr csr-tf9pb -o jsonpath='{.spec.request}' | base64 -d \
    | openssl req -noout -text | grep -A1 'Subject Alternative Name'
            X509v3 Subject Alternative Name:
                DNS:vps1, IP Address:38.45.81.22

$ kubectl certificate approve csr-tf9pb
certificatesigningrequest.certificates.k8s.io/csr-tf9pb approved

At the end the script finds this CSR itself and prints the command. After approval:

$ kubectl top nodes
NAME   CPU(cores)   CPU(%)   MEMORY(bytes)   MEMORY(%)
vps1   276m         6%       4167Mi          53%

Step 6: kubectl from your own computer

Port 6443 is closed, so copying admin.conf to your laptop is not enough. There are two safe ways.

An SSH tunnel, with no changes on the server:

scp root@38.45.81.22:/etc/kubernetes/admin.conf ~/.kube/vps1.yaml
ssh -fN -L 6443:127.0.0.1:6443 root@38.45.81.22
kubectl --kubeconfig ~/.kube/vps1.yaml config set-cluster kubernetes \
    --server=https://127.0.0.1:6443 --tls-server-name=kubernetes
kubectl --kubeconfig ~/.kube/vps1.yaml get nodes

--tls-server-name=kubernetes is needed because the API certificate does not include 127.0.0.1, but it does include the name kubernetes.

A VPN (e.g. WireGuard). Install with API_SAN=<server's VPN IP> so the API certificate covers that address too, and set server: https://<VPN-IP>:6443 in the kubeconfig. The VPN interface has to be allowed in UFW (ufw allow in on wg0).

Reset: starting from scratch

sudo ./reset-k8s.sh          # kubeadm reset + CNI + kube-proxy rules; then install-k8s.sh again
sudo ./reset-k8s.sh purge    # the same + packages, containerd with images, repo, IPv4 workarounds, UFW rule

The script does not run iptables -F, which would also remove rules belonging to other services, such as a VPN’s NAT. Instead it strips only the KUBE-*, FLANNEL* and CNI-* chains from iptables-save.


Part 2: exposing apps to the world

Why not ingress-nginx

The community controller kubernetes/ingress-nginx was the default choice for years. In November 2025 the Kubernetes project announced its retirement, and since March 2026 it gets no new releases and no security fixes. The reasons were a lack of maintainers and a series of serious vulnerabilities (IngressNightmare, CVE-2025-1974: remote code execution through the controller’s admission webhook).

More important than the controller is the change of API. Ingress is frozen, and its successor is the Gateway API (stable since 2023), with a clear split of roles:

ResourceManaged byDescribes
GatewayClassvendor / adminwhich implementation handles gateways (here: Envoy Gateway)
Gatewaycluster adminports, protocols, TLS certificates
HTTPRouteapp teamhost, paths, which Service gets the traffic

Redirects, header changes and traffic splitting are part of the standard, not controller-specific annotations. There are several implementations: Envoy Gateway, Traefik, Cilium, Istio, NGINX Gateway Fabric, Kong. I picked Envoy Gateway because it was built for the Gateway API from day one and is a CNCF project.

In the clusterRole
Envoy Gateway (envoy-gateway-system)Gateway API controller, ships the CRDs
GatewayClass/eg + EnvoyProxy/public-ipsettings for Envoy’s Service (externalIPs)
Gateway/web (ns gateway)shared gateway: :80 plus one :443 listener per app
cert-manager + ClusterIssuer letsencrypt-prod / -stagingACME HTTP-01 certificates through the Gateway API
whoami (ns demo)test app

Step 7: wildcard DNS

Add a single record at your DNS provider:

*.k8s.skwarna.eu.   A   38.45.81.22

Check it (any name under k8s. must point at the server):

$ dig +short A whoami.k8s.skwarna.eu
38.45.81.22
$ dig +short A anything.k8s.skwarna.eu
38.45.81.22

The wildcard is only for DNS. Certificates are issued per host. A wildcard certificate needs DNS-01 validation through your DNS provider’s API, while HTTP-01 works everywhere.

Step 8: getting traffic to Envoy without a load balancer

This is the interesting part. For every Gateway, Envoy Gateway creates a Deployment running Envoy and a Service of type LoadBalancer. In a cloud the provider assigns the address; on a bare server the Service stays <pending> forever.

There are three ways out:

OptionProsCons
MetalLB with a one-IP poola “real” LoadBalanceran extra component for a single address
hostNetwork / hostPort on the Envoy podsimple in principleyou have to patch the Deployment, ports < 1024 need privileges, Envoy runs as non-root
externalIPs on the Serviceno new components, kube-proxy does ityou write the IP in by hand

I went with externalIPs. You put the server’s public IP into the Service, and kube-proxy adds an iptables rule that rewrites the destination (DNAT) of packets for 38.45.81.22:443 to the Envoy pod. Envoy Gateway lets you set this in an EnvoyProxy resource:

apiVersion: gateway.envoyproxy.io/v1alpha1
kind: EnvoyProxy
metadata:
  name: public-ip
  namespace: envoy-gateway-system
spec:
  provider:
    type: Kubernetes
    kubernetes:
      envoyService:
        type: LoadBalancer
        externalTrafficPolicy: Local          # the app sees the real client IP
        allocateLoadBalancerNodePorts: false  # no extra NodePorts
        patch:
          type: StrategicMerge
          value:
            spec:
              externalIPs:
                - 38.45.81.22
---
apiVersion: gateway.networking.k8s.io/v1
kind: GatewayClass
metadata:
  name: eg
spec:
  controllerName: gateway.envoyproxy.io/gatewayclass-controller
  parametersRef:
    group: gateway.envoyproxy.io
    kind: EnvoyProxy
    name: public-ip
    namespace: envoy-gateway-system

What this means in practice:

  • Nothing listens on 80/443 on the host. ss -ltn shows nothing; iptables does the redirect.
  • Firewall. After DNAT the packet goes through the FORWARD chain, not INPUT. On Ubuntu with UFW and allow (routed) you do not need ufw allow 80,443. With deny (routed) you have to allow traffic to the pod network.
  • allocateLoadBalancerNodePorts: false. A LoadBalancer Service also gets NodePorts (30000–32767) by default, and through FORWARD they would be open to the internet.
  • externalTrafficPolicy: Local. No SNAT, so Envoy sees the client address and passes it on in X-Forwarded-For.
  • Envoy runs as non-root, so inside the container it listens on 10080/10443. The Service maps 80→10080 and 443→10443.

The rules kube-proxy added:

$ sudo iptables -t nat -S KUBE-SERVICES | grep 38.45.81.22
-A KUBE-SERVICES -d 38.45.81.22/32 -p tcp -m comment --comment "envoy-gateway-system/envoy-gateway-web-f0e3f882:http-80 external IP" -m tcp --dport 80 -j KUBE-EXT-XU7YVBL4WZNQZX5Y
-A KUBE-SERVICES -d 38.45.81.22/32 -p tcp -m comment --comment "envoy-gateway-system/envoy-gateway-web-f0e3f882:https-443 external IP" -m tcp --dport 443 -j KUBE-EXT-LANWK4E3EUG4GAH6

Step 9: cert-manager with Gateway API support

cert-manager installs from a plain manifest, but its Gateway API integration is off by default. A controller flag turns it on:

kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.21.3/cert-manager.yaml
kubectl -n cert-manager patch deployment cert-manager --type=json \
  -p '[{"op":"add","path":"/spec/template/spec/containers/0/args/-","value":"--enable-gateway-api"}]'

A ClusterIssuer with an HTTP-01 solver that uses the Gateway API:

apiVersion: cert-manager.io/v1
kind: ClusterIssuer
metadata:
  name: letsencrypt-prod
spec:
  acme:
    server: https://acme-v02.api.letsencrypt.org/directory
    privateKeySecretRef:
      name: letsencrypt-prod-account
    solvers:
      - http01:
          gatewayHTTPRoute:
            parentRefs:
              - name: web
                namespace: gateway
                kind: Gateway
                sectionName: http

When issuing a certificate, cert-manager starts a solver pod and a temporary HTTPRoute for /.well-known/acme-challenge/<token>, attached to the http listener of our gateway. Let’s Encrypt fetches that URL and issues the certificate.

The script also creates letsencrypt-staging. Use it while experimenting: the certificate is not trusted, but you stay clear of the production limits (5 duplicates per week).

Step 10: the shared web gateway and the HTTPS redirect

apiVersion: gateway.networking.k8s.io/v1
kind: Gateway
metadata:
  name: web
  namespace: gateway
  annotations:
    cert-manager.io/cluster-issuer: letsencrypt-prod
spec:
  gatewayClassName: eg
  listeners:
    - name: http
      protocol: HTTP
      port: 80
      allowedRoutes:
        namespaces:
          from: All
    - name: whoami                         # one HTTPS listener per app
      protocol: HTTPS
      port: 443
      hostname: whoami.k8s.skwarna.eu
      tls:
        mode: Terminate
        certificateRefs:
          - name: whoami-tls               # Secret created by cert-manager
      allowedRoutes:
        namespaces:
          from: All
---
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
  name: https-redirect
  namespace: gateway
spec:
  parentRefs:
    - name: web
      sectionName: http
  hostnames:
    - "*.k8s.skwarna.eu"
  rules:
    - filters:
        - type: RequestRedirect
          requestRedirect:
            scheme: https
            statusCode: 301

Two things happen here automatically:

  1. The cert-manager.io/cluster-issuer annotation. cert-manager (the gateway-shim) finds every HTTPS listener with a hostname and certificateRefs and creates a Certificate named after the Secret (whoami-tls).
  2. The redirect does not break validation. The https-redirect route matches everything under / (prefix), while the solver’s route has an exact path. In the Gateway API an exact match wins, so the ACME challenge is served over HTTP and everything else gets a 301.

Step 11: the app and its HTTPRoute

A regular Deployment and Service, plus a route:

apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
  name: whoami
  namespace: demo
spec:
  parentRefs:
    - name: web
      namespace: gateway
      sectionName: whoami      # only this app's HTTPS listener
  hostnames:
    - whoami.k8s.skwarna.eu
  rules:
    - backendRefs:
        - name: whoami
          port: 80

The route lives in the app’s namespace (demo) and the gateway in gateway. allowedRoutes.namespaces.from: All on the listener makes that possible. This is the Gateway API’s split of roles in practice.

Running install-gateway.sh

chmod +x install-gateway.sh
sudo DOMAIN=k8s.skwarna.eu ./install-gateway.sh
# or first a dry run without Let's Encrypt limits:
sudo DOMAIN=k8s.skwarna.eu ISSUER=letsencrypt-staging ./install-gateway.sh

The script detects the public IP from the default route (or takes PUBLIC_IP=...) and checks that whoami.<DOMAIN> resolves to it. Then it runs steps 8–11 and waits until the gateway is Programmed and the certificate is Ready. You can run it again at any time (kubectl apply). At the end it prints a cheat sheet of commands for looking at everything it added to the cluster.

The whole run takes 2–3 minutes, mostly pulling images and waiting for Let’s Encrypt.

Checking it

The gateway has an address and is programmed:

$ kubectl get gateway,httproute -A
NAMESPACE   NAME                                    CLASS   ADDRESS        PROGRAMMED   AGE
gateway     gateway.gateway.networking.k8s.io/web   eg      38.45.81.22   True         2m8s

NAMESPACE   NAME                                                 HOSTNAMES                    AGE
demo        httproute.gateway.networking.k8s.io/whoami           ["whoami.k8s.skwarna.eu"]   2m8s
gateway     httproute.gateway.networking.k8s.io/https-redirect   ["*.k8s.skwarna.eu"]        2m8s

Envoy’s Service has an EXTERNAL-IP, even though there is no load balancer:

$ kubectl -n envoy-gateway-system get svc
NAME                         TYPE           CLUSTER-IP      EXTERNAL-IP    PORT(S)                                            AGE
envoy-gateway                ClusterIP      10.43.91.243    <none>         18000/TCP,18001/TCP,18002/TCP,19001/TCP,9443/TCP   2m45s
envoy-gateway-web-f0e3f882   LoadBalancer   10.43.128.255   38.45.81.22   80/TCP,443/TCP                                     2m8s

The certificate is issued:

$ kubectl get certificate -A
NAMESPACE   NAME         READY   SECRET       AGE
gateway     whoami-tls   True    whoami-tls   2m8s

From the outside, on another machine. HTTP redirects:

$ curl -I http://whoami.k8s.skwarna.eu
HTTP/1.1 301 Moved Permanently
location: https://whoami.k8s.skwarna.eu/

A Let’s Encrypt certificate, valid for 90 days:

$ echo | openssl s_client -connect whoami.k8s.skwarna.eu:443 \
    -servername whoami.k8s.skwarna.eu 2>/dev/null | openssl x509 -noout -subject -issuer -dates
subject=CN=whoami.k8s.skwarna.eu
issuer=C=US, O=Let's Encrypt, CN=YR2
notBefore=Nov 11 10:42:42 2026 GMT
notAfter=Feb  9 10:42:41 2027 GMT

The app sees the real client IP (X-Forwarded-For). RemoteAddr is the Envoy pod. Try it yourself in a browser: https://whoami.k8s.skwarna.eu shows your own address in X-Forwarded-For.

$ curl https://whoami.k8s.skwarna.eu
Hostname: whoami-7489d99447-fq4xf
IP: 10.244.0.15
RemoteAddr: 10.244.0.14:42504
GET / HTTP/1.1
Host: whoami.k8s.skwarna.eu
User-Agent: curl/8.18.0
X-Envoy-External-Address: 198.51.100.7
X-Forwarded-For: 198.51.100.7
X-Forwarded-Proto: https

If a certificate will not issue, the chain of cert-manager resources shows where it got stuck:

kubectl get certificate,certificaterequest,order,challenge -A
kubectl describe challenge -A          # usually shows the cause (DNS, 404, timeout)
kubectl -n cert-manager logs deploy/cert-manager --tail=50

The next app

  1. Add a listener to the gateway (kubectl -n gateway edit gateway web):
        - name: myapp
          protocol: HTTPS
          port: 443
          hostname: myapp.k8s.skwarna.eu
          tls:
            certificateRefs:
              - name: myapp-tls
          allowedRoutes:
            namespaces:
              from: All
    
  2. In the app’s namespace, create an HTTPRoute with sectionName: myapp and hostnames: [myapp.k8s.skwarna.eu].

DNS is already there (wildcard), and cert-manager makes the certificate. A minute later the app is live over HTTPS.

Editing the shared gateway for every app is the limitation of this layout. The ListenerSet resource (Gateway API v1.5+) fixes it: an app adds its own listener without touching the Gateway. In cert-manager v1.21 ListenerSet support is still alpha, so for now I am sticking with editing the gateway.

Summary

The cluster:

  • Firewall before kubeadm init. On a VPS, anything listening on the public IP is visible to the whole internet.
  • The pod network needs access to the API through the firewall. Pod → kubernetes ClusterIP → DNAT to the public IP lands in INPUT.
  • IPv6 can block the install (403 from pkgs.k8s.io and registry.k8s.io). containerd, being a Go program, needs GODEBUG=netdns=cgo to respect gai.conf.
  • metrics-server without --kubelet-insecure-tls. serverTLSBootstrap: true and a manual CSR approval once a year.
  • kubectl from outside through an SSH tunnel or a VPN. Do not open 6443 to the world.

Apps:

  • ingress-nginx is retired. New installs should use the Gateway API.
  • On one server without a load balancer, externalIPs on Envoy’s Service is enough. kube-proxy does the DNAT, no MetalLB or hostNetwork needed.
  • Traffic after DNAT goes through FORWARD. Check your firewall’s policy for routed traffic and turn off NodePorts.
  • cert-manager needs --enable-gateway-api, and the Gateway API CRDs must be installed before it.
  • One wildcard in DNS plus a per-host HTTP-01 certificate: a new app is just a listener and an HTTPRoute.

An open question: does single-node Kubernetes make sense?

In a lab for learning and testing: yes. You get real, upstream Kubernetes with the same APIs, manifests and problems as a big cluster: firewall, certificates, CSRs, the Gateway API, cert-manager. It costs one VPS, and you can wipe the cluster and rebuild it with a script at any time.

In production: not necessarily. One node is one single point of failure:

  • etcd keeps a single copy of the data. Without backups (etcdctl snapshot save), a disk failure means losing the cluster state.
  • A server reboot, a kernel update or a Kubernetes upgrade takes down every app at once.
  • Replicas and PodDisruptionBudgets do little when all pods sit on the same machine.
  • The control plane eats a good share of a small VPS: etcd, the apiserver, CoreDNS and metrics-server take their cut before the first app starts.

If availability matters, use managed Kubernetes (EKS, GKE, AKS or smaller providers) or run at least three nodes with HA etcd. On the other hand, for a few simple services on one server, Docker Compose or k3s may be enough with far less overhead.

Where the line sits depends on how much downtime costs you versus the time spent on maintenance. I would like to hear your experience: single-node Kubernetes in production, did it work out or not?