From ba90c3ffec24b1e81037f9416cfd747026c77cef Mon Sep 17 00:00:00 2001 From: Tim Berry Date: Mon, 10 Jun 2019 16:28:08 +0100 Subject: [PATCH] Add guestbook deployment YAML --- .../guestbook/frontend-deployment.yaml | 30 +++++++++++++++++ Chapter_Two/guestbook/frontend-service.yaml | 14 ++++++++ .../guestbook/redis-master-deployment.yaml | 29 +++++++++++++++++ .../guestbook/redis-master-service.yaml | 16 ++++++++++ .../guestbook/redis-slave-deployment.yaml | 32 +++++++++++++++++++ .../guestbook/redis-slave-service.yaml | 15 +++++++++ 6 files changed, 136 insertions(+) create mode 100644 Chapter_Two/guestbook/frontend-deployment.yaml create mode 100644 Chapter_Two/guestbook/frontend-service.yaml create mode 100644 Chapter_Two/guestbook/redis-master-deployment.yaml create mode 100644 Chapter_Two/guestbook/redis-master-service.yaml create mode 100644 Chapter_Two/guestbook/redis-slave-deployment.yaml create mode 100644 Chapter_Two/guestbook/redis-slave-service.yaml diff --git a/Chapter_Two/guestbook/frontend-deployment.yaml b/Chapter_Two/guestbook/frontend-deployment.yaml new file mode 100644 index 0000000..cc3babc --- /dev/null +++ b/Chapter_Two/guestbook/frontend-deployment.yaml @@ -0,0 +1,30 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: frontend + labels: + app: guestbook +spec: + selector: + matchLabels: + app: guestbook + tier: frontend + replicas: 3 + template: + metadata: + labels: + app: guestbook + tier: frontend + spec: + containers: + - name: php-redis + image: gcr.io/google-samples/gb-frontend:v4 + resources: + requests: + cpu: 100m + memory: 100Mi + env: + - name: GET_HOSTS_FROM + value: dns + ports: + - containerPort: 80 diff --git a/Chapter_Two/guestbook/frontend-service.yaml b/Chapter_Two/guestbook/frontend-service.yaml new file mode 100644 index 0000000..ba3471c --- /dev/null +++ b/Chapter_Two/guestbook/frontend-service.yaml @@ -0,0 +1,14 @@ +apiVersion: v1 +kind: Service +metadata: + name: frontend + labels: + app: guestbook + tier: frontend +spec: + type: LoadBalancer + ports: + - port: 80 + selector: + app: guestbook + tier: frontend diff --git a/Chapter_Two/guestbook/redis-master-deployment.yaml b/Chapter_Two/guestbook/redis-master-deployment.yaml new file mode 100644 index 0000000..4a282dd --- /dev/null +++ b/Chapter_Two/guestbook/redis-master-deployment.yaml @@ -0,0 +1,29 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: redis-master + labels: + app: redis +spec: + selector: + matchLabels: + app: redis + role: master + tier: backend + replicas: 1 + template: + metadata: + labels: + app: redis + role: master + tier: backend + spec: + containers: + - name: master + image: k8s.gcr.io/redis:e2e + resources: + requests: + cpu: 100m + memory: 100Mi + ports: + - containerPort: 6379 diff --git a/Chapter_Two/guestbook/redis-master-service.yaml b/Chapter_Two/guestbook/redis-master-service.yaml new file mode 100644 index 0000000..a484014 --- /dev/null +++ b/Chapter_Two/guestbook/redis-master-service.yaml @@ -0,0 +1,16 @@ +apiVersion: v1 +kind: Service +metadata: + name: redis-master + labels: + app: redis + role: master + tier: backend +spec: + ports: + - port: 6379 + targetPort: 6379 + selector: + app: redis + role: master + tier: backend diff --git a/Chapter_Two/guestbook/redis-slave-deployment.yaml b/Chapter_Two/guestbook/redis-slave-deployment.yaml new file mode 100644 index 0000000..3588d3f --- /dev/null +++ b/Chapter_Two/guestbook/redis-slave-deployment.yaml @@ -0,0 +1,32 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: redis-slave + labels: + app: redis +spec: + selector: + matchLabels: + app: redis + role: slave + tier: backend + replicas: 2 + template: + metadata: + labels: + app: redis + role: slave + tier: backend + spec: + containers: + - name: slave + image: gcr.io/google_samples/gb-redisslave:v3 + resources: + requests: + cpu: 100m + memory: 100Mi + env: + - name: GET_HOSTS_FROM + value: dns + ports: + - containerPort: 6379 diff --git a/Chapter_Two/guestbook/redis-slave-service.yaml b/Chapter_Two/guestbook/redis-slave-service.yaml new file mode 100644 index 0000000..238fd63 --- /dev/null +++ b/Chapter_Two/guestbook/redis-slave-service.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Service +metadata: + name: redis-slave + labels: + app: redis + role: slave + tier: backend +spec: + ports: + - port: 6379 + selector: + app: redis + role: slave + tier: backend