简体   繁体   中英

Two services for the same Pod on GKE

Question

Is it problematic to create two Services for the same pod, one for internal access and the other for external access?

Context

I have a simple app running on GKE.

There are two pods, each with one container:

  1. flask-pod, which runs a containerized flask app
  2. postgres-pod, which runs a containerized postgres DB

The flask app accesses the postgres DB through a ClusterIP Service around the postgres DB.

Concern

I also have connected a client app, TablePlus (running on my machine), to the postgres DB through a LoadBalancer Service. Now I have 2 separate services to access my postgres DB. Is this redundant, or can this cause problems?

Thanks for your help.

It is perfectly fine. If you look at StatefulSets, you define one headless service that is used for internal purpose and another service to allow access from clients.

This approach is absolutely valid, there is nothing wrong with it. You can create as many Services per Pod as you like.

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