Thank you, great, I resolved the issue once I change to StatefulSet.
On Wednesday, June 23, 2021 at 3:21:10 PM UTC+8 [email protected] wrote: > The statefulset keeps track of the pods (hence the word stateful), they > will get assigned the same name and they will keep the same hostname every > time they die and come back, > ie: a statefulset named foobar with two pods will always have two pods > named foobar-0 and foobar-1 > combined with a headless service, the pods are reachable at > foobar-{0/1}.<service_name>.<namespace>.svc.cluster.local > > On Wed, Jun 23, 2021 at 9:08 AM nina guo <[email protected]> wrote: > >> May I ask what's the difference once I change to Statefulset? >> >> On Wednesday, June 23, 2021 at 2:42:56 PM UTC+8 [email protected] >> wrote: >> >>> Hello, you can make use of Kubernetes Statefulset instead of deployment >>> in this case >>> >>> On Wed, Jun 23, 2021 at 8:20 AM nina guo <[email protected]> wrote: >>> >>>> Hi guys, >>>> >>>> I'm implementing alertmanager HA. >>>> >>>> alertmanager0: >>>> ----------------------------------------- >>>> containers: >>>> - name: alertmanager >>>> image: quay.io/prometheus/alertmanager:latest >>>> args: >>>> - "--config.file=/etc/alertmanager/config.yml" >>>> - "--storage.path=/alertmanager" >>>> - "--cluster.listen-address=0.0.0.0:9094" >>>> ----------------------------------------------- >>>> >>>> alertmanager1: >>>> -------------------------------------------- >>>> containers: >>>> - name: alertmanager >>>> image: quay.io/prometheus/alertmanager:latest >>>> args: >>>> - "--config.file=/etc/alertmanager/config.yml" >>>> - "--storage.path=/alertmanager" >>>> - "--cluster.listen-address=0.0.0.0:9095" >>>> - "--cluster.peer=internal_ip_of_alertmanager0:9094" >>>> >>>> alertmanager service: >>>> ------------------------------------------------- >>>> apiVersion: v1 >>>> kind: Service >>>> metadata: >>>> name: alertmanager >>>> namespace: monitoring >>>> spec: >>>> selector: >>>> app: alertmanager >>>> type: NodePort >>>> ports: >>>> - port: 9093 >>>> targetPort: 9093 >>>> nodePort: 31000 >>>> >>>> I have a question that if alertmanager0 restarts, then the internal ip >>>> will be changed. So I may have to update the deployment file and re-apply >>>> again. >>>> May I ask if there is a way to assign a DNS something like this to the >>>> internal IP address? >>>> >>>> >>>> -- >>>> You received this message because you are subscribed to the Google >>>> Groups "Prometheus Users" group. >>>> To unsubscribe from this group and stop receiving emails from it, send >>>> an email to [email protected]. >>>> To view this discussion on the web visit >>>> https://groups.google.com/d/msgid/prometheus-users/1cabcbca-7905-4337-807e-33b7359685c7n%40googlegroups.com >>>> >>>> <https://groups.google.com/d/msgid/prometheus-users/1cabcbca-7905-4337-807e-33b7359685c7n%40googlegroups.com?utm_medium=email&utm_source=footer> >>>> . >>>> >>> -- >> You received this message because you are subscribed to the Google Groups >> "Prometheus Users" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> > To view this discussion on the web visit >> https://groups.google.com/d/msgid/prometheus-users/fb12fdf7-0bb1-4670-b9d1-312d6ebd481an%40googlegroups.com >> >> <https://groups.google.com/d/msgid/prometheus-users/fb12fdf7-0bb1-4670-b9d1-312d6ebd481an%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> > -- You received this message because you are subscribed to the Google Groups "Prometheus Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/a0e93273-e5c4-4d17-bcf4-4ef7c6017549n%40googlegroups.com.

