This generates a service manifest as described here

Generating a service is very simple and normally you just need to enable the service plugin. The service plugin depends on the deployment plugin and thus, every property of the service is automatically derived from the deployment definition.

Consider the nginx deployment from previous, we can fully derive the service:

import kubeyml.deployment._
import kubeyml.service._
import kubeyml.deployment.api._
import scala.concurrent.duration._
val deployment = deploy.namespace("yournamespace")
      livenessProbe = HttpProbe(HttpGet("/", port = 80, httpHeaders = List.empty), period = 10 seconds),
      readinessProbe = HttpProbe(HttpGet("/", port = 80, httpHeaders = List.empty), failureThreshold = 10)
    .addPorts(List(Port(None, 80))

  val service = Service.fromDeployment(deployment)

Which would generate the following service.yml file

kind: Service
apiVersion: v1
    name: nginx-deployment
    namespace: yournamespace
    type: NodePort
        app: nginx-deployment
    -   name: pn80
        protocol: TCP
        port: 80
        targetPort: 80

At the moment there’s little room for customisation. If you have a use-case you can open an issue or even better a pull request.

Sbt Properties

These are the available properties that you can customise from the sbt layer.

sbt key description default
portMappings Port mappings against the deployment (service to pod) Derived from deployment
service Key configuration for modifying the service properties Derived from deployment

You can also create your own instance of the service case class and see how far customisation can get you.

There’s no DSL for this yet.

Go to the service recipe for a full deployment example.