简体   繁体   中英

Kubernetes with a fixed hostname for pods

we have a need for an external clients to connect to the POD via static hostname running on Kubernetes containers/sessions. The issue is that whenever we restart a session we get a new hostname generated for that container. Is there a way we can get a fixed hostname for the pods, such that it doesn't change every time we restart??

$ kubectl get pods
NAME                                                              READY   STATUS             RESTARTS   AGE
anaconda-app-0072b5a97aad4bc5ba708a405609ad2e-74757d95fd-4cfms    2/2     Running            521        18d
anaconda-app-048b92d480d34da3a6602eace5f4c1c4-84d5669674-drx2c    1/2     CrashLoopBackOff   5086       77d
anaconda-app-0a529b10874e4c79a361050897bf3a00-64fdf8967f-ctc9z    2/2     Running            521        18d
anaconda-app-128b6866e59a408d937768835c04666c-5b774b8977-rhbp7    1/2     CrashLoopBackOff   5087       18d

If we can get a static name for the pods whenever the session is restarted that would be awesome, such that we can give one single static IP/hostname to the clienst?

consider running a statefulset with one replica. host name remains same for statefulset

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM