Auto-Deploying Manifests
Any YAML placed in the manifests directory is applied automatically by k3s.
k3s watches a special folder and applies whatever YAML it finds there. This is the auto-deploying manifests feature, powered by the internal rancher/helm-controller and add-on system.
The magic folder
/var/lib/rancher/k3s/server/manifests/Drop a manifest in that directory and k3s applies it automatically, even across reboots. Remove the file and k3s tidies up the resources it created. This is great for baking apps into a machine image or provisioning edge devices.
Example
# Place a manifest and k3s deploys it for you
sudo cp web-app.yaml \
/var/lib/rancher/k3s/server/manifests/
# Watch it appear
kubectl get pods -w
# Deleting the file removes the resources
sudo rm /var/lib/rancher/k3s/server/manifests/web-app.yamlWhen to use it
- An operator places a namespace YAML file in /var/lib/rancher/k3s/server/manifests/ so k3s creates the namespace automatically on every boot.
- A team drops HelmChart CRD manifests into the auto-deploy directory to ensure monitoring tools are installed before any workload runs.
- A GitOps pipeline syncs curated manifests to the k3s manifests directory on the server, letting k3s handle the apply without an external controller.
More examples
Place a manifest for auto-deploy
Writes a Namespace manifest to the k3s manifests directory; k3s detects the file and applies it within seconds.
cat > /var/lib/rancher/k3s/server/manifests/my-namespace.yaml << 'EOF'
apiVersion: v1
kind: Namespace
metadata:
name: production
EOF
# k3s applies it immediately without a kubectl applyAdd a HelmChart to manifests
Copies a HelmChart CRD manifest into the auto-deploy directory and verifies k3s installed the chart.
cp my-helmchart.yaml /var/lib/rancher/k3s/server/manifests/
kubectl get helmchart -n kube-system
kubectl get pods -n monitoringList auto-deployed resources
Lists the files in the manifests directory and shows all kube-system resources to confirm auto-deployment ran.
ls /var/lib/rancher/k3s/server/manifests/
kubectl get all -n kube-system | grep -v '^$'
Discussion