This is a known issue in Kubernetes runner. See https://docs.drone.io/runner/kubernetes/overview/, section “Known Issues / Differences”, the first bullet. You have to read /run/drone/env file in a container and the value of io.drone.build.number will give you the step number.
This is because Kubernetes runner, when executing a pipeline, creates a pod with containers for all defined steps (once a pod starts, no new containers can be added to it). Initially all these containers start with a tiny placeholder image… It does nothing, it just waits. When a step is ready for execution, the runner changes its container image, but can’t change environment variables. Environment variables remain with the same values as when the pod started. So, to work around this Kubernetes restriction, we have read /run/drone/env file to get values that change during pipeline execution.