k3s-agent
Recipe card from the charly-infrastructure plugin (Images — the deployable catalog).
k3s-agent – k3s worker node
Section titled “k3s-agent – k3s worker node”Candy Properties
Section titled “Candy Properties”| Property | Value |
|---|---|
| Install files | charly.yml, task:, service:, secret_require:, env_require: |
| Depends on | /charly-infrastructure:k3s |
| Service | k3s-agent.service (system scope, enabled) |
What this candy does
Section titled “What this candy does”- Reads
K3S_CLUSTER_TOKENfrom the credential store (same secret the server consumes — auto-generated on the first server-or-agent deploy viaensureCandySecret; subsequent deploys read the persisted value, so agents and server automatically share the token without operator setup). - Requires
K3S_SERVER_URLfrom charly.yml env (e.g.,https://k3s-srv.lan:6443). - Writes
/etc/rancher/k3s/config.yamlwithserver:andtoken:. - Emits
/etc/systemd/system/k3s-agent.servicerunningk3s agent.
No join-token handoff, no kubeconfig retricheck — agents only need the server URL (declarative, known at author time) and the pre-shared token (from the credential store).
# charly.yml (assumes k3s-srv already up; see [/charly-infrastructure:k3s-server](/recipes/infrastructure/k3s-server/))
# The VM hardware template (a kind: vm entity — name-first node form).k3s-ag1-vm: vm: source: { kind: cloud_image, url: "…" } ram: 4G cpu: 2
# The disposable deploy: overlay the k3s-agent candy into the VM. `from:`# selects the template; disposable / add_candy / env live on the deploy node.k3s-ag1: vm: from: k3s-ag1-vm disposable: true add_candy: [k3s-agent] env: K3S_SERVER_URL: https://k3s-srv.lan:6443 # K3S_CLUSTER must match the cluster profile name registered by the server. K3S_CLUSTER: k3s-srvcharly bundle add vm:k3s-ag1The agent registers; a server-side kube: wait-nodes check step confirms the
join — the declarative kube: verb served out-of-process by candy/plugin-kube
(there is no host charly check kube command):
confirm-join: check: both nodes reach Ready once the agent joins kube: wait-nodes cluster: k3s-srv kube_count: 2 timeout: 3m context: [deploy]Build-scope:
/etc/rancher/k3s/config.yamlexists, mode 0600./etc/systemd/system/k3s-agent.serviceexists.
Deploy-scope (uses /charly-kubernetes:check-k8s). The cluster-probe verb is
the declarative kube: check verb (served out-of-process by candy/plugin-kube —
there is no host charly check kube command); the k8s spelling is reserved for
the deploy KIND only:
kube: wait-nodes name=${HOSTNAME}— this node reaches Ready on the server.
Related Candies
Section titled “Related Candies”/charly-infrastructure:k3s— Base candy installing the k3s binary (required dep)/charly-infrastructure:k3s-server— Control-plane node this agent joins/charly-kubernetes:check-k8s— Test verb used by the agent-joined check