how to create headless service in kubernetes.

In Kubernetes, we refer to a service that does not forward traffic or allocate an IP address as an Headless service. Headless Service are typical created to have fine control over what interacts or communicates with a given application.When using Headless Service it is up to the cluster administrator to configure how applications register to the service. To create an headless service is simple and all one needs to do is set the service type in the declarative YAML or JSON declarative file holding the service specification as ClusterIP: None. Below is an example of how to create one.

apiVersion: v1
kind: Service
metadata:
    name: headless-service
spec:
  selector:
      app: hello
  ClusterIP: None

One thought on “how to create headless service in kubernetes.”

Leave a Reply

Your email address will not be published. Required fields are marked *