Skip to content

Commit

Permalink
Merge pull request #5024 from rsokolowski/doc-fixit-empty-service-sel…
Browse files Browse the repository at this point in the history
…ector

Explain what are services without endpoints used for.
  • Loading branch information
smarterclayton committed Mar 4, 2015
2 parents fdea725 + af0ade5 commit da46d04
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions docs/services.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,39 @@ TCP port 9376 on any `pod` with the "app=MyApp" label. To access this
`service`, a client can simply connect to $MYAPP_SERVICE_HOST on port
$MYAPP_SERVICE_PORT.

## Service without selector

Services, in addition to providing clean abstraction to access pods, can also
abstract any kind of backend:
- you want to have an external database cluster in production, but in test you
use your own databases.
- you want to point your service to a service in another [`namespace`](namespaces.md)
or on another cluster.
- you are migrating your workload to Kubernetes and some of your backends run
outside of Kubernetes.

In any of these scenarios you can define a service without a selector:

```json
"kind": "Service",
"apiVersion": "v1beta1",
"id": "myapp",
"port": 8765
```

then you can explicitly map the service to a specific endpoint(s):

```json
"kind": "Endpoints",
"apiVersion": "v1beta1",
"id": "myapp",
"endpoints": ["173.194.112.206:80"]
```

Access to the service without a selector works the same as if it had selector. The
traffic will be routed to endpoints defined by the user (`173.194.112.206:80` in
case of this example).

## How do they work?

Each node in a Kubernetes cluster runs a `service proxy`. This application
Expand Down

0 comments on commit da46d04

Please sign in to comment.