aiguy
aiguy

Reputation: 691

Kubernetes services within cluster

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?

Upvotes: 1

Views: 99

Answers (1)

Suresh Vishnoi
Suresh Vishnoi

Reputation: 18353

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

Upvotes: 1

Related Questions