Debug
Use case
You can use debug to gain access into containers of applications, databases or services.
You would use this debug shell to run commands for troubleshooting which cannot be run with a normal SSH command as the container keeps restarting.
Overview
The bns debug start
command is the one needed to create this shell.
It’s changing the command of the container with a "do nothing" command then opens a SSH connection where you can run whatever command you need, most probably the original entrypoint or command of the container and check the errors.
When you are done with debugging, you should run bns debug stop
to revert the Pod to original specs. If you identified some changes that needs to be made on Pod spec, go to environment configuration and add them there, then redeploy the whole environment or only this component, depending by case.
Requirements
The container image still needs to have /bin/sh, the "do nothing" command is:
/bin/sh -c "tail -f /dev/null"
Use a custom shell
By default, the /bin/sh
shell is used, but this can be overridden by passing in the --shell
argument.
bns debug start --component Qb02Ryw034 --shell /bin/bash
Multiple debug sessions
Currently you cannot open multiple debug sessions on a component. You will se an error telling there is another debug session in progress and on which container. You should first run bns debug down
then bns debug up
on the other container.
If the debug session in progress is on the same container you want now, then it will start only the SSH connection, will leave the Pod unchanged, with the temporary overwrites from the previous session.
If you really want to start a new debug session on the same container but with extra arguments, like --env
, like setting container cpu and memory resources and/or limits, or on a new container, you can pass --force-recreate-resource
argument, and will recreate the Pod applying the new debug temporary overwrites over the existing ones. This may break the bns debug down
, it may not revert the Pod to its original shape.
Updated 10 days ago