k8s guestbook example

This commit is contained in:
Vincent Fiduccia 2016-03-09 11:52:25 -07:00
parent c462456014
commit f0dfd83154
9 changed files with 145 additions and 0 deletions

View File

@ -0,0 +1,28 @@
apiVersion: v1
kind: ReplicationController
metadata:
name: ${FRONTEND_NAME}
labels:
name: ${FRONTEND_NAME}
spec:
replicas: ${FRONTEND_REPLICAS}
selector:
name: ${FRONTEND_NAME}
template:
metadata:
labels:
name: ${FRONTEND_NAME}
spec:
containers:
- name: php-redis
image: gcr.io/google_samples/gb-frontend:v3
env:
- name: GET_HOSTS_FROM
value: dns
# If your cluster config does not include a dns service, then to
# instead access environment variables to find service host
# info, comment out the 'value: dns' line above, and uncomment the
# line below.
# value: env
ports:
- containerPort: 80

View File

@ -0,0 +1,15 @@
apiVersion: v1
kind: Service
metadata:
name: ${SERVICE_NAME}
labels:
name: ${SERVICE_NAME}
spec:
# if your cluster supports it, uncomment the following to automatically create
# an external load-balanced IP for the frontend service.
type: LoadBalancer
ports:
# the port that this service should serve on
- port: "${SERVICE_PORT}"
selector:
name: ${FRONTEND_NAME}

View File

@ -0,0 +1,25 @@
.catalog:
name: "K8s Example Guestbook"
version: "1.0.0"
description: "It's a guestbook"
questions:
- variable: "SERVICE_NAME"
label: "Service Name"
required: true
default: "frontend"
type: "string"
- variable: "Service Port"
label: "What port to listen on"
required: true
type: "int"
default: 80
- variable: "FRONTEND_NAME"
label: "Frontend Name"
required: true
default: "frontend"
type: "string"
- variable: "Frontend Scale"
label: "Replicas for the frontend RC"
required: true
type: "int"
default: 3

View File

@ -0,0 +1,20 @@
apiVersion: v1
kind: ReplicationController
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: redis
ports:
- containerPort: 6379

View File

@ -0,0 +1,13 @@
apiVersion: v1
kind: Service
metadata:
name: redis-master
labels:
name: redis-master
spec:
ports:
# the port that this service should serve on
- port: "6379"
targetPort: "6379"
selector:
name: redis-master

View File

@ -0,0 +1,28 @@
apiVersion: v1
kind: ReplicationController
metadata:
name: redis-slave
labels:
name: redis-slave
spec:
replicas: 2
selector:
name: redis-slave
template:
metadata:
labels:
name: redis-slave
spec:
containers:
- name: worker
image: gcr.io/google_samples/gb-redisslave:v1
env:
- name: GET_HOSTS_FROM
value: dns
# If your cluster config does not include a dns service, then to
# instead access an environment variable to find the master
# service's host, comment out the 'value: dns' line above, and
# uncomment the line below.
# value: env
ports:
- containerPort: 6379

View File

@ -0,0 +1,12 @@
apiVersion: v1
kind: Service
metadata:
name: redis-slave
labels:
name: redis-slave
spec:
ports:
# the port that this service should serve on
- port: 6379
selector:
name: redis-slave

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

View File

@ -0,0 +1,4 @@
name: "K8s Example Guestbook"
description: "It's a guestbook"
version: 1.0.0
category: Test