<!-- END MUNGE: EXAMPLE ../../examples/blog-logging/counter-pod.yaml -->
This pod specification has one container which runs a bash script when the container is born. This script simply writes out the value of a counter and the date once per second and runs indefinitely. Let’s create the pod in the default
<!-- END MUNGE: EXAMPLE ../../cluster/saltbase/salt/fluentd-gcp/fluentd-gcp.yaml -->
This pod specification maps the directory on the host containing the Docker log files, `/var/lib/docker/containers`, to a directory inside the container which has the same path. The pod runs one image, `gcr.io/google_containers/fluentd-gcp:1.6`, which is configured to collect the Docker log files from the logs directory and ingest them into Google Cloud Logging. One instance of this pod runs on each node of the cluster. Kubernetes will notice if this pod fails and automatically restart it.
<!-- END MUNGE: EXAMPLE cassandra-controller.yaml -->
There are a few things to note in this description. First is that we are running the ```kubernetes/cassandra``` image. This is a standard Cassandra installation on top of Debian. However it also adds a custom [```SeedProvider```](https://svn.apache.org/repos/asf/cassandra/trunk/src/java/org/apache/cassandra/locator/SeedProvider.java) to Cassandra. In Cassandra, a ```SeedProvider``` bootstraps the gossip protocol that Cassandra uses to find other nodes. The ```KubernetesSeedProvider``` 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)
...
...
@@ -132,7 +132,7 @@ spec:
```
[Download example](cassandra-service.yaml)
<!-- END MUNGE: EXAMPLE -->
<!-- END MUNGE: EXAMPLE cassandra-service.yaml -->
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=cassandra```. If you look back at the Pod specification above, you'll see that the pod has the corresponding label, so it will be selected for membership in this Service.
...
...
@@ -242,7 +242,7 @@ spec:
```
[Download example](cassandra-controller.yaml)
<!-- END MUNGE: EXAMPLE -->
<!-- END MUNGE: EXAMPLE cassandra-controller.yaml -->
Most of this replication controller definition is identical to the Cassandra pod definition above, it simply gives the resplication controller a recipe to use when it creates new Cassandra pods. The other differentiating parts are the ```selector``` attribute which contains the controller's selector query, and the ```replicas``` attribute which specifies the desired number of replicas, in this case 1.
<!-- END MUNGE: EXAMPLE rabbitmq-controller.yaml -->
Running `$ kubectl create -f examples/celery-rabbitmq/rabbitmq-controller.yaml` brings up a replication controller that ensures one pod exists which is running a RabbitMQ instance.
...
...
@@ -168,7 +168,7 @@ spec:
```
[Download example](celery-controller.yaml)
<!-- END MUNGE: EXAMPLE -->
<!-- END MUNGE: EXAMPLE celery-controller.yaml -->
There are several things to point out here...
...
...
@@ -239,7 +239,7 @@ spec:
```
[Download example](flower-service.yaml)
<!-- END MUNGE: EXAMPLE -->
<!-- END MUNGE: EXAMPLE flower-service.yaml -->
It is marked as external (LoadBalanced). However on many platforms you will have to add an explicit firewall rule to open port 5555.
On GCE this can be done with:
...
...
@@ -280,7 +280,7 @@ spec:
```
[Download example](flower-controller.yaml)
<!-- END MUNGE: EXAMPLE -->
<!-- END MUNGE: EXAMPLE flower-controller.yaml -->
This will bring up a new pod with Flower installed and port 5555 (Flower's default port) exposed through the service endpoint. This image uses the following command to start Flower:
<!-- END MUNGE: EXAMPLE redis-master-controller.yaml -->
Change to the `<kubernetes>/examples/guestbook` directory if you're not already there. Create the redis master pod in your Kubernetes cluster by running:
...
...
@@ -222,7 +222,7 @@ spec:
```
[Download example](redis-master-service.yaml)
<!-- END MUNGE: EXAMPLE -->
<!-- END MUNGE: EXAMPLE redis-master-service.yaml -->
Create the service by running:
...
...
@@ -296,7 +296,7 @@ spec:
```
[Download example](redis-slave-controller.yaml)
<!-- END MUNGE: EXAMPLE -->
<!-- END MUNGE: EXAMPLE redis-slave-controller.yaml -->
and create the replication controller by running:
...
...
@@ -347,7 +347,7 @@ spec:
```
[Download example](redis-slave-service.yaml)
<!-- END MUNGE: EXAMPLE -->
<!-- END MUNGE: EXAMPLE redis-slave-service.yaml -->
This time the selector for the service is `name=redis-slave`, because that identifies the pods running redis slaves. It may also be helpful to set labels on your service itself as we've done here to make it easy to locate them with the `kubectl get services -l "label=value"` command.
...
...
@@ -398,7 +398,7 @@ spec:
```
[Download example](frontend-controller.yaml)
<!-- END MUNGE: EXAMPLE -->
<!-- END MUNGE: EXAMPLE frontend-controller.yaml -->
Using this file, you can turn up your frontend with:
...
...
@@ -501,7 +501,7 @@ spec:
```
[Download example](frontend-service.yaml)
<!-- END MUNGE: EXAMPLE -->
<!-- END MUNGE: EXAMPLE frontend-service.yaml -->
#### Using 'type: LoadBalancer' for the frontend service (cloud-provider-specific)
<!-- END MUNGE: EXAMPLE hazelcast-service.yaml -->
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.
...
...
@@ -139,7 +139,7 @@ spec:
```
[Download example](hazelcast-controller.yaml)
<!-- END MUNGE: EXAMPLE -->
<!-- END MUNGE: EXAMPLE hazelcast-controller.yaml -->
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).
Note that we've defined a volume mount for `/var/lib/mysql`, and specified a volume that uses the persistent disk (`mysql-disk`) that you created.
Once you've edited the file to set your database password, create the pod as follows, where `<kubernetes>` is the path to your Kubernetes installation:
...
...
@@ -187,7 +187,7 @@ spec:
```
[Download example](mysql-service.yaml)
<!-- END MUNGE: EXAMPLE -->
<!-- END MUNGE: EXAMPLE mysql-service.yaml -->
Start the service like this:
...
...
@@ -242,7 +242,7 @@ spec:
```
[Download example](wordpress.yaml)
<!-- END MUNGE: EXAMPLE -->
<!-- END MUNGE: EXAMPLE wordpress.yaml -->
Create the pod:
...
...
@@ -283,7 +283,7 @@ spec:
```
[Download example](wordpress-service.yaml)
<!-- END MUNGE: EXAMPLE -->
<!-- END MUNGE: EXAMPLE wordpress-service.yaml -->
Note the `type: LoadBalancer` setting. This will set up the wordpress service behind an external IP.
Note also that we've set the service port to 80. We'll return to that shortly.