Move everything out of src and reorganize scripts.

Fixed up some scripts to be more robust.  Changed the e2e test setup to use g1-small instances.  Fixed up documentation to reflect the new script locations.  Disabled the "curl | bash" cluster launch as it hasn't been well tested and doesn't include the cloudcfg tool yet.
This commit is contained in:
Joe Beda 2014-06-06 21:38:37 -07:00
parent 8b4132b190
commit dcf99202f4
1 changed files with 18 additions and 18 deletions

View File

@ -10,7 +10,7 @@ This example assumes that you have forked the repository and turned up a Kuberne
### Step One: Turn up the redis master. ### Step One: Turn up the redis master.
Create a file named redis-master.json, this file is describes a single task, which runs a redis key-value server in a container. Create a file named `redis-master.json`, this file is describes a single task, which runs a redis key-value server in a container.
```javascript ```javascript
{ {
@ -22,7 +22,7 @@ Create a file named redis-master.json, this file is describes a single task, whi
"image": "dockerfile/redis", "image": "dockerfile/redis",
"ports": [{ "ports": [{
"containerPort": 6379, "containerPort": 6379,
"hostPort": 6379 "hostPort": 6379
}] }]
}] }]
} }
@ -33,16 +33,16 @@ Create a file named redis-master.json, this file is describes a single task, whi
} }
``` ```
Once you have that task file, you can create the redis task in your Kubernetes cluster using the cloudcfg cli: Once you have that task file, you can create the redis task in your Kubernetes cluster using the `cloudcfg` cli:
```shell ```shell
./src/scripts/cloudcfg.sh -c redis-master.json create /tasks cluster/cloudcfg.sh -c redis-master.json create /tasks
``` ```
Once that's up you can list the tasks in the cluster, to verify that the master is running: Once that's up you can list the tasks in the cluster, to verify that the master is running:
```shell ```shell
./src/scripts/cloudcfg.sh list /tasks cluster/cloudcfg.sh list /tasks
``` ```
You should see a single redis master task. It will also display the machine that the task is running on. If you ssh to that machine, you can run You should see a single redis master task. It will also display the machine that the task is running on. If you ssh to that machine, you can run
@ -50,10 +50,10 @@ You should see a single redis master task. It will also display the machine tha
sudo docker ps sudo docker ps
``` ```
And see the actual task. (Note that initial ```docker pull``` may take a few minutes, depending on network conditions.) And see the actual task. (Note that initial `docker pull` may take a few minutes, depending on network conditions.)
### Step Two: Turn up the master service. ### Step Two: Turn up the master service.
A Kubernetes 'service' is named load balancer that proxies traffic to one or more containers. The services in a Kubernetes cluster are discoverable inside other containers via environment variables. Services find the containers to load balance based on task labels. The task that you created in Step One has the label "name=redis-master", so the corresponding service is defined by that label. Create a file named redis-master-service.json that contains: A Kubernetes 'service' is a named load balancer that proxies traffic to one or more containers. The services in a Kubernetes cluster are discoverable inside other containers via environment variables. Services find the containers to load balance based on task labels. The task that you created in Step One has the label `name=redis-master`, so the corresponding service is defined by that label. Create a file named `redis-master-service.json` that contains:
```javascript ```javascript
{ {
@ -65,16 +65,16 @@ A Kubernetes 'service' is named load balancer that proxies traffic to one or mor
} }
``` ```
Once you have that service description, you can create the service with the cloudcfg cli: Once you have that service description, you can create the service with the `cloudcfg` cli:
```shell ```shell
./src/scripts/cloudcfg.sh -c redis-master-service.json create /services cluster/cloudcfg.sh -c redis-master-service.json create /services
``` ```
Once created, the service proxy on each minion is configured to set up a proxy on the specified port (in this case port 10000). Once created, the service proxy on each minion is configured to set up a proxy on the specified port (in this case port 10000).
### Step Three: Turn up the replicated slave service. ### Step Three: Turn up the replicated slave service.
Although the redis master is a single task, the redis read slaves are a 'replicated' task, in Kubernetes, a replication controller is responsible for managing multiple instances of a replicated task. Create a file named redis-slave-controller.json that contains: Although the redis master is a single task, the redis read slaves are a 'replicated' task, in Kubernetes, a replication controller is responsible for managing multiple instances of a replicated task. Create a file named `redis-slave-controller.json` that contains:
```javascript ```javascript
{ {
@ -100,7 +100,7 @@ Although the redis master is a single task, the redis read slaves are a 'replica
Then you can create the service by running: Then you can create the service by running:
```shell ```shell
./src/scripts/cloudcfg.sh -c redis-slave-controller.json create /replicationControllers cluster/cloudcfg.sh -c redis-slave-controller.json create /replicationControllers
``` ```
The redis slave configures itself by looking for the Kubernetes service environment variables in the container environment. In particular, the redis slave is started with the following command: The redis slave configures itself by looking for the Kubernetes service environment variables in the container environment. In particular, the redis slave is started with the following command:
@ -112,7 +112,7 @@ redis-server --slaveof $SERVICE_HOST $REDISMASTER_SERVICE_PORT
Once that's up you can list the tasks in the cluster, to verify that the master and slaves are running: Once that's up you can list the tasks in the cluster, to verify that the master and slaves are running:
```shell ```shell
./src/scripts/cloudcfg.sh list /tasks cluster/cloudcfg.sh list /tasks
``` ```
You should see a single redis master task, and two redis slave tasks. You should see a single redis master task, and two redis slave tasks.
@ -131,17 +131,17 @@ Just like the master, we want to have a service to proxy connections to the read
} }
``` ```
This time the label query for the service is 'name=redis-slave'. This time the label query for the service is `name=redis-slave`.
Now that you have created the service specification, create it in your cluster with the cloudcfg cli: Now that you have created the service specification, create it in your cluster with the `cloudcfg` cli:
```shell ```shell
./src/scripts/cloudcfg.sh -c redis-slave-service.json create /services cluster/cloudcfg.sh -c redis-slave-service.json create /services
``` ```
### Step Five: Create the frontend service. ### Step Five: Create the frontend service.
This is a simple PHP server that is configured to talk to both the slave and master services depdending on if the request is a read or a write. It exposes a simple AJAX interface, and serves an angular based U/X. Like the redis read slaves it is a replicated service instantiated by a replication controller. Create a file named frontend-controller.json: This is a simple PHP server that is configured to talk to both the slave and master services depdending on if the request is a read or a write. It exposes a simple AJAX interface, and serves an angular based U/X. Like the redis read slaves it is a replicated service instantiated by a replication controller. Create a file named `frontend-controller.json`:
```javascript ```javascript
{ {
@ -167,13 +167,13 @@ This is a simple PHP server that is configured to talk to both the slave and mas
With this file, you can turn up your frontend with: With this file, you can turn up your frontend with:
```shell ```shell
./src/scripts/cloudcfg.sh -c frontend-controller.json create /replicationControllers cluster/cloudcfg.sh -c frontend-controller.json create /replicationControllers
``` ```
Once that's up you can list the tasks in the cluster, to verify that the master, slaves and frontends are running: Once that's up you can list the tasks in the cluster, to verify that the master, slaves and frontends are running:
```shell ```shell
./src/scripts/cloudcfg.sh list /tasks cluster/cloudcfg.sh list /tasks
``` ```
You should see a single redis master task, two redis slave and three frontend tasks. You should see a single redis master task, two redis slave and three frontend tasks.