kompose creating headles services

12/21/2017

I have a docker-compose.yml file we have been using to set up our development environment.

The file declares some services, all of them more or less following the same pattern:

services:

   service_1:
      image: some_image_1
      enviroment:
        - ENV_VAR_1
        - ENV_VAR_2
     depends_on:
        - another_service_of_the_same_compose_file

In the view of migrating to kubernetes, when running:

kompose convert -f docker-compose.yml 

produces, for each service, a pair of deployment/service manifests.

My main question, is, why for all services, the spec declaration is like this:

spec:
  clusterIP: None
  ports:
  - name: headless
    port: 55555
    targetPort: 0
  selector:
    io.kompose.service: service_1

Why is it creating headless services?

(I would really appreciate a bit on elaboration on what is and what's the necessity of a headless service cause the documentation kind of confused me).

Many thx.

-- pkaramol
docker-compose
kubernetes

0 Answers