mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-10 13:42:02 +00:00
Use example syncer tags instead of hard-coded examples in doc
This commit is contained in:
@@ -67,20 +67,25 @@ In Kubernetes a _[Service](../../docs/user-guide/services.md)_ describes a set o
|
||||
|
||||
Here is the service description:
|
||||
|
||||
<!-- BEGIN MUNGE: EXAMPLE hazelcast-service.yaml -->
|
||||
|
||||
```yaml
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
labels:
|
||||
metadata:
|
||||
labels:
|
||||
name: hazelcast
|
||||
name: hazelcast
|
||||
spec:
|
||||
ports:
|
||||
- port: 5701
|
||||
selector:
|
||||
selector:
|
||||
name: hazelcast
|
||||
```
|
||||
|
||||
[Download example](hazelcast-service.yaml)
|
||||
<!-- END MUNGE: EXAMPLE -->
|
||||
|
||||
The important thing to note here is the `selector`. It is a query over labels, that identifies the set of _Pods_ contained by the _Service_. In this case the selector is `name: hazelcast`. If you look at the Replication Controller specification below, you'll see that the pod has the corresponding label, so it will be selected for membership in this Service.
|
||||
|
||||
Create this service as follows:
|
||||
@@ -97,6 +102,8 @@ In Kubernetes a _[Replication Controller](../../docs/user-guide/replication-cont
|
||||
|
||||
Replication Controllers will "adopt" existing pods that match their selector query, so let's create a Replication Controller with a single replica to adopt our existing Hazelcast Pod.
|
||||
|
||||
<!-- BEGIN MUNGE: EXAMPLE hazelcast-controller.yaml -->
|
||||
|
||||
```yaml
|
||||
apiVersion: v1
|
||||
kind: ReplicationController
|
||||
@@ -131,6 +138,9 @@ spec:
|
||||
name: hazelcast
|
||||
```
|
||||
|
||||
[Download example](hazelcast-controller.yaml)
|
||||
<!-- END MUNGE: EXAMPLE -->
|
||||
|
||||
There are a few things to note in this description. First is that we are running the `quay.io/pires/hazelcast-kubernetes` image, tag `0.5`. This is a `busybox` installation with JRE 8 Update 45. However it also adds a custom [`application`](https://github.com/pires/hazelcast-kubernetes-bootstrapper) that finds any Hazelcast nodes in the cluster and bootstraps an Hazelcast instance accordingle. The `HazelcastDiscoveryController` discovers the Kubernetes API Server using the built in Kubernetes discovery service, and then uses the Kubernetes API to find new nodes (more on this later).
|
||||
|
||||
You may also note that we tell Kubernetes that the container exposes the `hazelcast` port. Finally, we tell the cluster manager that we need 1 cpu core.
|
||||
|
Reference in New Issue
Block a user