Merge pull request #4460 from sub-mod/guestbook_ns

Adding guestbook example with latest json format for v1beta3 api
This commit is contained in:
Brian Grant
2015-02-23 16:58:20 -08:00
15 changed files with 402 additions and 0 deletions

View File

@@ -0,0 +1,14 @@
## GuestBook v1beta3 example
This example shows how to build a simple, multi-tier web application using Kubernetes and Docker.
The example consists of:
- A web frontend
- A redis master (for storage and a replicated set of redis slaves)
The web front end interacts with the redis master via javascript redis API calls.
The v1beta3 API is not enabled by default. The kube-apiserver process needs to run with the --runtime_config=api/v1beta3 argument. Use the following command to enable it:
$sudo sed -i 's|KUBE_API_ARGS="|KUBE_API_ARGS="--runtime_config=api/v1beta3 |' /etc/kubernetes/apiserver

View File

@@ -0,0 +1,37 @@
{
"kind":"ReplicationController",
"apiVersion":"v1beta3",
"metadata":{
"name":"frontend",
"labels":{
"name":"frontend"
}
},
"spec":{
"replicas":2,
"selector":{
"name":"frontend"
},
"template":{
"metadata":{
"labels":{
"name":"frontend"
}
},
"spec":{
"containers":[
{
"name":"php-redis",
"image":"kubernetes/example-guestbook-php-redis",
"ports":[
{
"containerPort":80,
"protocol":"TCP"
}
]
}
]
}
}
}
}

View File

@@ -0,0 +1,18 @@
{
"kind":"Service",
"apiVersion":"v1beta3",
"metadata":{
"name":"frontend",
"labels":{
"name":"frontend"
}
},
"spec":{
"port":80,
"containerPort":80,
"protocol":"TCP",
"selector":{
"name":"frontend"
}
}
}

View File

@@ -0,0 +1,18 @@
{
"kind":"Service",
"apiVersion":"v1beta3",
"metadata":{
"name":"redis-master",
"labels":{
"name":"redis-master"
}
},
"spec":{
"port":6379,
"containerPort":6379,
"protocol":"TCP",
"selector":{
"name":"redis-master"
}
}
}

View File

@@ -0,0 +1,37 @@
{
"kind":"ReplicationController",
"apiVersion":"v1beta3",
"metadata":{
"name":"redis-master",
"labels":{
"name":"redis-master"
}
},
"spec":{
"replicas":1,
"selector":{
"name":"redis-master"
},
"template":{
"metadata":{
"labels":{
"name":"redis-master"
}
},
"spec":{
"containers":[
{
"name":"master",
"image":"dockerfile/redis",
"ports":[
{
"containerPort":6379,
"protocol":"TCP"
}
]
}
]
}
}
}
}

View File

@@ -0,0 +1,37 @@
{
"kind":"ReplicationController",
"apiVersion":"v1beta3",
"metadata":{
"name":"redis-slave",
"labels":{
"name":"redis-slave"
}
},
"spec":{
"replicas":2,
"selector":{
"name":"redis-slave"
},
"template":{
"metadata":{
"labels":{
"name":"redis-slave"
}
},
"spec":{
"containers":[
{
"name":"slave",
"image":"brendanburns/redis-slave",
"ports":[
{
"containerPort":6379,
"protocol":"TCP"
}
]
}
]
}
}
}
}

View File

@@ -0,0 +1,18 @@
{
"kind":"Service",
"apiVersion":"v1beta3",
"metadata":{
"name":"redis-slave",
"labels":{
"name":"redis-slave"
}
},
"spec":{
"port":6379,
"containerPort":6379,
"protocol":"TCP",
"selector":{
"name":"redis-slave"
}
}
}