In order to debug Rancher it is first necessary to recompile it with debug symbols.
- install Rancher as usual
- determine the current app version (eg.
v2.7.5
):
helm --namespace cattle-system list
- determine the new version for the component debug deployment (eg.
v2.7.5-dbg
) - recompile with debugging symbols, eg.
cd rancher
export VERSION=v2.7.5-dbg
DEBUG=true TAG=$VERSION make quick
- either push built images onto a registry, or import them into your cluster nodes manually. If you are using k3d:
export CLUSTER=upstream
k3d image import --mode direct --cluster $CLUSTER $(cat ./dist/images)
- upgrade the installation to the latest build
helm -n cattle-system upgrade --version $VERSION --reuse-values --set rancherImageTag=$VERSION --set-json 'extraEnv=[{"name":"CATTLE_DEV_MODE","value":"true"}],livenessProbe={"initialDelaySeconds":30,"periodSeconds":3600}' rancher ./bin/chart/dev/$(ls -t ./bin/chart/dev | head -n1)
(make sure you add any additional extraEnv
you might want to the command above, as they are overridden)
- run
./util/debug-rancher.sh