I wanted to know if there is any way that I can set a DNS for the Pod in the StatefulSet, so I can call them directly.
I have read the Kubernetes documentation, but I haven’t seen anything useful.
>Solution :
you can set a DNS name for Pods in a StatefulSet using the serviceName field in the StatefulSet's spec section.
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: my-statefulset
spec:
serviceName: my-dns-name # set the DNS name for the Pods