Skip to content
Hands-on IT IT Drills

Appendix A: Cheat Sheet

Everything important from Days 0–15 on a few pages. The number in parentheses is the day on which you practiced it. When in doubt, ranchermanager.docs.rancher.com, fleet.rancher.io, docs.rke2.io, docs.k3s.io and kubectl explain <typ>.<feld> are authoritative.

Start of the Day and Training Ground

source ~/rancher-lab/setup/env.sh                 # LAB, VM addresses from vms.env (0, 2)
export KUBECONFIG="$LAB/kube/rancher.yaml"         # local cluster = Rancher (3)
kubectl --kubeconfig "$LAB/kube/werk.yaml" …       # target cluster through Rancher (5)
R="https://rancher.$RANCHER.sslip.io"
H="Authorization: Bearer $(cat "$LAB/rancher-token")"     # API token (5)
Command Purpose Day
rdctl start --container-engine.name=containerd … Start Rancher Desktop without a window 0
nerdctl --namespace k8s.io build -t notes-api:0.2.0 … Build an image directly for k3s 1
curl -sfL https://get.k3s.io with INSTALL_K3S_VERSION Install k3s 2
k3s ctr images import datei.tar Get images into the cluster without a registry 2
helm install rancher rancher-stable/rancher --set hostname=… Install Rancher 3

Rancher Objects

Object Meaning Day
clusters.provisioning.cattle.io (fleet-default) Create or import a cluster 4, 5
clusters.management.cattle.io (c-m-…) Rancher’s view, labels for Fleet, k3sConfig 4, 9, 12
clusterregistrationtokens.management.cattle.io Import and node commands, placeholder {token} 4, 5
machines.cluster.x-k8s.io One node of a created cluster 5
projects.management.cattle.io Project with quota and defaults 6
projectroletemplatebindings.management.cattle.io Permissions in the project 6
globalrolebindings.management.cattle.io Global role, such as user-base 6
clusterrepos.catalog.cattle.io Helm catalog, per cluster 7
gitrepos.fleet.cattle.io, clustergroups.fleet.cattle.io GitOps with Fleet 8, 9
etcdsnapshots.rke.cattle.io etcd snapshot of a cluster 13
backups.resources.cattle.io, restores.resources.cattle.io Back up Rancher 13
tokens.management.cattle.io API tokens with ttl and clusterName 14

API Calls

# Log in and save the token (5)
curl -sk -X POST "$R/v3-public/localProviders/local?action=login" \
  -H 'Content-Type: application/json' \
  -d '{"username":"admin","password":"…","responseType":"json"}' | jq -r .token
# kubeconfig for a cluster (5)
curl -sk -X POST -H "$H" "$R/v3/clusters/$ID?action=generateKubeconfig" | jq -r .config
# Create a user (6)
curl -sk -X POST -H "$H" -H 'Content-Type: application/json' "$R/v3/users" -d '{…}'
# Install or upgrade an app (7)
API="$R/k8s/clusters/$ID/v1/catalog.cattle.io.clusterrepos/<repo>"
curl -sk -X POST -H "$H" -H 'Content-Type: application/json' "$API?action=install" \
  -d '{"charts":[{"chartName":…,"version":…,"releaseName":…,"values":{…}}],
       "namespace":…,"wait":true,"timeout":"600s"}'
# Versions that Rancher knows (12)
curl -sk -H "$H" "$R/v1-rke2-release/releases" | jq -r '.data[].id'

Fields in the Cluster Object

Field Effect Day
spec.kubernetesVersion, rkeConfig.machineGlobalConfig Version and RKE2 configuration 5
rkeConfig.registries.configs.<host> Login and CA for registries (caBundle: base64 PEM) 7
rkeConfig.upgradeStrategy.workerDrainOptions Drain before the upgrade 12
rkeConfig.etcdSnapshotCreate.generation Request a snapshot 13
rkeConfig.etcdSnapshotRestore {name, generation, restoreRKEConfig} Restore 13
localClusterAuthEndpoint.enabled Direct context without Rancher 14
defaultPodSecurityAdmissionConfigurationTemplateName Pod Security for the cluster 14

Fleet

# fleet.yaml (8, 9)
defaultNamespace: notes
helm:
  releaseName: notes
  repo: https://gitea…/api/packages/lab/helm      # or chart: oci://…
  chart: notes
  version: 0.3.1
  values: {…}
targetCustomizations:
  - name: k3s
    clusterSelector: {matchLabels: {provider.cattle.io: k3s}}
    helm: {values: {…}}
GitRepo field Purpose Day
targets: [{clusterName}] or [{clusterGroup}] Where to 8, 9
clientSecretName, helmSecretName, caBundle Access to Git and Helm repo 8
correctDrift.enabled Revert manual changes 8
paused Read commits, don’t apply them 8
paths Only these folders (without it: the whole repo) B
forceSyncGeneration Force a sync B

Failure Patterns

Symptom Cause Fix
cluster not found or invalid token on import {token} not replaced Token from Secret crt-token-default-token (4)
READY true, machines Provisioning Column turns green too early Wait for condition Ready (5)
Pods missing, serviceaccount "notes" not found Platform part missing namespace.yaml first (1, 2)
Namespace invisible to project member Created without projectId annotation Create with annotation (6)
Quota 0/0 in the new namespace Project budget exhausted Adjust budget or share (6)
x509: malformed certificate on the ClusterRepo PEM instead of DER openssl x509 -outform der (7)
ClusterRepo invisible in werk Created in the local cluster Create in the target cluster (7)
db-0 Pending, Helm timeout No StorageClass local-path or Longhorn beforehand (7)
GitRepo Modified Manual change in the cluster correctDrift (8)
Label has no effect on imported cluster Only on the provisioning object Set on the management cluster (9)
updates to statefulset spec … are forbidden StorageClass changed Default StorageClass, backup/restore (10)
Grafana “Page not found” through Rancher Proxy path kubectl port-forward (11)
GitPolling=False commit not found for branch Wrong branch spec.branch (15)
2/2, but commit has no effect Build job failed or paused Job log, WaitApplied (15)
db-0 stuck after etcd restore Volume still on the old node Delete the pod (13)
ServiceUnavailable through Rancher Rancher gone Context werk-werk1 (14)
local-path PVC Pending under restricted Helper pod not hardened Longhorn or exemption (14, 15)