k3s-server (Managed Controlplane)

Agentless Kubernetes control plane with ayedo/k8s/k3s-server: architecture, exposure via Envoy/NGINX/LoadBalancer, worker join on port 6443, and Day-2 ops.

k3s-server (Managed Controlplane)

The Polycrate block ayedo/k8s/k3s-server runs an agentless k3s control plane as a Kubernetes workload on an existing host cluster (Kubernetes-in-Kubernetes). A single pod provides kube-apiserver, kube-controller-manager, kube-scheduler, and (by default) embedded etcd — while external worker nodes join from outside on port 6443.

You can inspect current block versions, parameters, and examples directly via the public block catalog:

polycrate hub inspect ayedo/k8s/k3s-server

Architecture Overview

Host Cluster Namespace (e.g., acme-production-1)
├── Deployment k3s-server (replicas: 1, strategy: Recreate)
│   ├── controlplane       (k3s server --disable-agent)
│   ├── pod-data-handler   (syncs kubeconfig & metrics-tls Secrets)
│   └── audit-log          (API audit logs → stdout → VictoriaLogs)
├── PersistentVolumeClaim  (/var/lib/rancher/k3s: etcd, TLS certificates)
├── Secrets                (join token, kubeconfig, metrics-tls)
├── NetworkPolicy          (incl. optional API whitelisting)
└── Exposure               (Envoy Gateway+TLSRoute OR NGINX Ingress OR LoadBalancer)

Inside the control plane pod, the agent, Flannel, Traefik, ServiceLB, kube-proxy, and the built-in cloud controller are intentionally disabled — those responsibilities are handled by the worker nodes and the SDP components deployed on top (such as Cilium, Envoy Gateway, or NGINX Ingress).

Honest Assessment: Single-Pod Architecture and Upgrade Behavior

If you require a multi-master control plane with three independent control plane nodes, use On-Premises & Bare-Metal Cluster (k3s) instead.

Key Features

  • Datastore: Embedded etcd on a PVC (default), optional SQLite, or an external datastore
  • Security: Secrets encryption at rest (secretbox including rotation actions), OIDC integration (Keycloak/Authentik), Pod Security Admission, and EventRateLimit
  • Observability: API audit logging via sidecar to VictoriaLogs plus optional control plane metrics (VMPodScrape)
  • Backups: etcd snapshots stored locally on the PVC and optionally automated to S3 object storage
  • Air-Gap: Container images and pull secrets are completely overridable

API Exposure (Exactly One Path)

Configure either ingress.enabled: true or loadbalancer.enabled: true for Kubernetes API access — never both at the same time:

Exposure Path Block Configuration Typical Endpoint
Envoy Gateway (recommended) ingress.enabled: true, ingress.type: gateway TLSRoute via Envoy Gateway (SNI passthrough)
NGINX Ingress ingress.enabled: true, ingress.type: nginx SSL passthrough via NGINX Ingress (enable_ssl_passthrough)
Dedicated LoadBalancer loadbalancer.enabled: true, provider: cilium or metallb Dedicated LoadBalancer VIP on port 6443

You can optionally restrict Kubernetes API access to specific source IPs via api_access.whitelist_cidrs (see Network Access).

Example Configuration (Polycrate Workspace)

Find the desired block version using polycrate hub inspect ayedo/k8s/k3s-server. Sensitive values such as the join token must not be stored in plaintext in workspace.poly, but in the encrypted secrets.poly (see Workspace Encryption):

blocks:
  - name: k3s-server
    from: cargo.ayedo.cloud/ayedo/k8s/k3s-server
    config:
      namespace: acme-production-1
      persistence:
        storage_class: ceph-rbd
      loadbalancer:
        enabled: true
        provider: cilium
      ingress:
        enabled: false
      k3s:
        cluster_domain: "acme-production-1.k8s.example.com"
        # Provide the token encrypted via secrets.poly (at least 10 characters)

Installation and status check:

polycrate run k3s-server install
polycrate run k3s-server status

Joining Worker Nodes (Port 6443)

Worker nodes connect to the Kubernetes API on port 6443 using the configured bootstrap token:

curl -sfL https://get.k3s.io | \
  K3S_URL="https://api.acme-production-1.k8s.example.com:6443" \
  K3S_TOKEN="<your-join-token>" \
  sh -s - \
  --kubelet-arg "cloud-provider=external" \
  --node-label "role=worker"

Day-2 Operations

Task Command / Note
Check status polycrate run k3s-server status
Kubernetes upgrade Set the desired rancher/k3s image tag in the block configuration and run polycrate run k3s-server install
Rotate secrets encryption polycrate run k3s-server secrets-encryption-rotate
Inspect etcd snapshots Stored on the PVC under server/db/snapshots and optionally in the configured S3 bucket
Analyze API audit logs In Grafana Explore via the VictoriaLogs data source (kubernetes.container_name:"audit-log")
Uninstall polycrate run k3s-server uninstall

Further Reading