Skip to content



Kill all containerd tasks
for task in $(sudo ctr -n task ls | awk '{print $2}' | sed 1d); do sudo kill -9 $task; done
Delete all containerd containers
sudo ctr -n c rm $(sudo ctr -n c ls -q)
Delete all containerd images:
sudo ctr -n i rm $(sudo ctr -n i ls -q)


Copy secret from one namespace to another
kubectl get secret {source_secret} --namespace={source_namespace} -o yaml | sed 's/namespace: .*namespace: {target_namespace}' | kubectl apply -f -
###### List pods by label on current node
kubectl get pods -n {namespace} -o wide --field-selector spec.nodeName$(hostname) -l {label_key}={label_value}
Schedule Daemonset on specific node
# Apply:
kubectl -n {namespace} patch ds {daemonset_name} -p '{"spec": {"template" {"spec": {"nodeSelector": {"": "YOUR_NODE_HOSTNAME"}}}}}'

# Remove:
kubectl -n {namespace} patch ds {daemonset_name} --type json -p='[{"op": "remove", "path": "/spec/template/spec/nodeSelector/"}]'
Run ubuntu debug pod on current node
kubectl run -it ubuntu --image=ubuntu:latest --rm --overrides='{"spec": {"nodeSelector": {"": "'$(hostname)'"}}}' -- /bin/bash


Display HA Node Token
sudo cat /var/lib/rancher/k3s/server/node-token
View auto generated config.toml
cat /var/lib/rancher/k3s/agent/etc/containerd/config.toml