Is it possible to avoid those hashes in pod name?
> kubectl get pods
NAME READY STATUS RESTARTS AGE
nginx-ingress-nginx-controller-599c688b77-nbvds 1/1 Running 0 11d
pgadmin-756f5949ff-mbkk9 1/1 Running 0 11d
postgres-postgresql-0 1/1 Running 0 11d
redis-master-5d9cfb54f8-8pbgq 1/1 Running 43 4d
2
Answers
According to your requirement Statefulset can fulfil your needs. Using deployment this is not possible. Statefulset assigns name to pods in an incremental fashion like pgadmin-0,pgadmin-1 and so on. I would highly recommend check this docs section as statefulset comes up with very cool feature like rolling out pods in sequential manner and delete them also in one pod one at a time etc.
https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/
No it’s not possible to avoid the hash in pod name if you are using a deployment. You can add labels/annotations of your own and select or operate on pods with those labels.
Pods created by statefulset have a unique identity that is comprised of an ordinal i.e
redis-master-0
redis-master-1
redis-master-2
etc. If you are running stateful workload such as redis I would suggest using statefulset