My first thought was using the downward API, but that doesn't seem to expose the scale of a deployment / statefulset. I was hoping to be able to avoid adding it in as a separate environment variable manually, or having to rely on pods all discovering each other to determine the scale if possible.
Use-case: Deploying many pods for an application that connects to an external service. Said service does some form of consistent hashing (I believe is the right term?) for sending the data to clients, so clients that connect send an id number from 0 - N-1 and a total number of clients N. In this case, the deployment/statefulset scale would be N.