Kubernetes services within cluster

4/18/2018

I am trying to set up a conventional web app with a database in Kubernetes. I have accomplished it by configuring 2 services and 2 deployments - one for the app and one for the database. Now I would like to make my database accessible only from the app pods, ie not expose it to outside world like a service. Is it possible using only Kubernetes configuration?

-- aiguy
kubernetes

1 Answer

4/19/2018

There are following ways to expose the pods.

purpose is inter-service communication

Internally expose

  • service type=clusterIP
  • Headless-service clusterIP: None is used for database pods

Sometimes you don’t need or want load-balancing and a single service IP. headless-services

Externally expose
Exposing service to the customers.

  • service type=NodePort or type=LoadBalancer
-- Suresh Vishnoi
Source: StackOverflow