Graceful Shutdown of MongoDB Replicaset in Kubernetes

I don’t know (for now) how you would issue a command to remove the container itself in this case, but to clean shutdown mongod instances, you need to connect to the admin database on each instance and run db.shutdownServer().

There should be some scripting around for this purpose. have you tried to search for such?

PS: check my answer in your other post about how to one-line with mongo shell.