Kubernetes ClusterIP

Kubernetes ClusterIP

What is the clusterIP in Kubernetes?

Cluster IP is a virtual IP that is allocated by the Kubernetes to a service. It is Kubernetes internal IP.

A Cluster IP makes it accessible from any of the Kubernetes cluster’s nodes. The use of virtual IP addresses for this purpose makes it possible to have several pods expose the same port on the same node – All of these pods will be accessible via a unique IP address.

This IP is stable and never changes in the service lifecycle(unless deleted explicitly).


How to create a Cluster IP service

apiVersion: v1
kind: Service
  name: backend
  type: ClusterIP
    - targetPort: 80
      port: 80

image.png Creating the service image.png

How to check the services in Kubernetes

kubectl get svc


Hope you have got an idea about Kubernetes Cluster IP and why it is needed

Thank you !!!