Creating a replicated deployment for the application and MongoDB

Follow these steps:

  1. To create an external disk, we'll use the following command:
$ gcloud compute disks create --size 1GB mongo-disk \--zone us-east1-c
  1. We'll first create the MongoDB deployment because the application expects the database's presence. A deployment object creates the desired number of pods indicated by our replica count. Notice the label given to the pods that are created. The Kubernetes system manages the pods, the deployment, and their linking to their corresponding services via label selectors. Navigate to /Chapter01/mysite-gke/db-deployment.yml:
apiVersion: apps/v1beta1 kind: Deployment metadata: name: mongo-deployment spec: replicas: 1 template: metadata: ...

Get Google Cloud Platform Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.