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?
There are following ways to expose the pods.
purpose is inter-service communication
Internally expose
type=clusterIP
clusterIP: None
is used for database podsSometimes you don’t need or want load-balancing and a single service IP. headless-services
Externally expose
Exposing service to the customers.
type=NodePort
or type=LoadBalancer