Sha256: c968e840f59965ed2b964b982f9622fa3937e4e87be2903afb3d81a5b853f7ec

Contents?: true

Size: 1.05 KB

Versions: 51

Compression:

Stored size: 1.05 KB

Contents

---
title: Service
categories: dsl
---

## Example

Here's an example of a Service.

.kubes/resources/web/service.rb

```ruby
name "demo-web"
labels(role: "web")
namespace "default"

# Optional since these are the defaults
# port 80
# targetPort 80
#
# type "NodePort"
```

Produces:

.kubes/output/web/service.yaml

```yaml
---
apiVersion: v1
kind: Service
metadata:
  name: demo-web
  labels:
    app: demo
  namespace: demo
spec:
  ports:
  - port: 80
    protocol: TCP
    targetPort: 8080
  selector:
    app: demo
  type: NodePort
```

## DSL Methods

Here's a list of some of the methods:

kubectl explain service.spec

* clusterIP
* externalIPs
* externalName
* externalTrafficPolicy
* healthCheckNodePort
* ipFamily
* loadBalancerIP
* loadBalancerSourceRanges
* ports
* publishNotReadyAddresses
* selector
* sessionAffinity
* sessionAffinityConfig
* type

kubectl explain service.spec.ports

* nodePort
* port
* portName: : Note this field doesn't match the original field name. It's more qualified.
* protocol
* targetPort

{% include dsl/methods.md name="service" %}

Version data entries

51 entries across 51 versions & 1 rubygems

Version Path
kubes-0.9.3 docs/_docs/dsl/resources/service.md
kubes-0.9.2 docs/_docs/dsl/resources/service.md
kubes-0.9.1 docs/_docs/dsl/resources/service.md
kubes-0.9.0 docs/_docs/dsl/resources/service.md
kubes-0.8.10 docs/_docs/dsl/resources/service.md
kubes-0.8.9 docs/_docs/dsl/resources/service.md
kubes-0.8.8 docs/_docs/dsl/resources/service.md
kubes-0.8.7 docs/_docs/dsl/resources/service.md
kubes-0.8.6 docs/_docs/dsl/resources/service.md
kubes-0.8.5 docs/_docs/dsl/resources/service.md
kubes-0.8.4 docs/_docs/dsl/resources/service.md
kubes-0.8.3 docs/_docs/dsl/resources/service.md
kubes-0.8.2 docs/_docs/dsl/resources/service.md
kubes-0.8.1 docs/_docs/dsl/resources/service.md
kubes-0.8.0 docs/_docs/dsl/resources/service.md
kubes-0.7.10 docs/_docs/dsl/resources/service.md
kubes-0.7.9 docs/_docs/dsl/resources/service.md
kubes-0.7.8 docs/_docs/dsl/resources/service.md
kubes-0.7.7 docs/_docs/dsl/resources/service.md
kubes-0.7.6 docs/_docs/dsl/resources/service.md