Use the example YAML files to deploy the Guestbook application with persistent data.
Redis Leader PVC
The file
redis-leader-pvc.yaml
is an example persistent volume claim that references a named storage class. To use this example, enter the name of the storage class.
kind: PersistentVolumeClaim apiVersion: v1 metadata: name: redis-leader-pvc spec: accessModes: - ReadWriteOnce storageClassName: tkgs-storage-class-name resources: requests: storage: 2Gi
Redis Follower PVC
The file
redis-follower-pvc.yaml
is an example persistent volume claim that references a named storage class. To use this example, enter the name of the storage class.
kind: PersistentVolumeClaim apiVersion: v1 metadata: name: redis-follower-pvc spec: accessModes: - ReadWriteOnce storageClassName: tkgs-storage-class-name resources: requests: storage: 2Gi
Redis Leader Deployment
The file
redis-leader-deployment.yaml
is an example Redis leader deployment with a persistent volume.
apiVersion: apps/v1 kind: Deployment metadata: name: redis-leader-deployment spec: selector: matchLabels: app: redis role: leader tier: backend replicas: 1 template: metadata: labels: app: redis role: leader tier: backend spec: containers: - name: leader image: redis:6.0.5 resources: requests: cpu: 100m memory: 100Mi ports: - containerPort: 6379 volumeMounts: - name: redis-leader-data mountPath: /data volumes: - name: redis-leader-data persistentVolumeClaim: claimName: redis-leader-pvc
Redis Follower Deployment
The file
redis-follower-deployment.yaml
is an example Redis follower deployment with a persistent volume.
apiVersion: apps/v1 kind: Deployment metadata: name: redis-follower-deployment labels: app: redis spec: selector: matchLabels: app: redis role: follower tier: backend replicas: 1 template: metadata: labels: app: redis role: follower tier: backend spec: containers: - name: follower image: gcr.io/google_samples/gb-redis-follower:v2 resources: requests: cpu: 100m memory: 100Mi env: - name: GET_HOSTS_FROM value: dns ports: - containerPort: 6379 volumeMounts: - name: redis-follower-data mountPath: /data volumes: - name: redis-follower-data persistentVolumeClaim: claimName: redis-follower-pvc
Redis Leader Service
The file
redis-leader-service.yaml
is an example Redis leader service.
apiVersion: v1 kind: Service metadata: name: redis-leader labels: app: redis role: leader tier: backend spec: ports: - port: 6379 targetPort: 6379 selector: app: redis role: leader tier: backend
Redis Follower Service
The file
redis-follower-service.yaml
is an example Redis follower service.
apiVersion: v1 kind: Service metadata: name: redis-follower labels: app: redis role: follower tier: backend spec: ports: - port: 6379 selector: app: redis role: follower tier: backend
Guestbook Frontend Deployment
The file
guestbook-frontend-deployment.yaml
is an example Guestbook frontend deployment.
apiVersion: apps/v1 kind: Deployment metadata: name: guestbook-frontend-deployment 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:v5 resources: requests: cpu: 100m memory: 100Mi env: - name: GET_HOSTS_FROM value: dns ports: - containerPort: 80
Guestbook Frontend Service
The file
guestbook-frontend-service.yaml
is an example Guestbook frontend load balancer service.
apiVersion: v1 kind: Service metadata: name: guestbook-frontend labels: app: guestbook tier: frontend spec: type: LoadBalancer ports: - port: 80 selector: app: guestbook tier: frontend