Upgrade to Pro — share decks privately, control downloads, hide ads and more …

GCPでコンテナをデプロイする、一歩手前の話

 GCPでコンテナをデプロイする、一歩手前の話

sakajunquality

October 13, 2018
Tweet

More Decks by sakajunquality

Other Decks in Technology

Transcript

  1. - Google Developers Experts (最近) - Software Engineer, SRE @

    Ubie株式会社 (最近) - 初沖縄! - 最近やってること #docker #kubernetes - 好きなこと #coffee #beer - 好きなGCPサービス #BigQuery #GKE #Cloud Build @sakajunquality
  2. - GCP 123 - Container ABC - Docker hoge hoge

    - Kubernetes foo bar Not Today’s Topic
  3. Steps to Deploy Container in GCP Application Source Code Container

    Image Container Running Environment Cloud Source Repositories Github Container Registry Compute Engine App Engine Kubernetes Engine
  4. Steps to Deploy Container in GCP Application Source Code Container

    Image Container Running Environment Cloud Source Repositories Github Container Registry Compute Engine App Engine Kubernetes Engine
  5. Steps to Deploy Container in GCP Application Source Code Container

    Image Container Running Environment Cloud Source Repositories Github Container Registry Compute Engine App Engine Kubernetes Engine Cloud Build
  6. Steps to Deploy Container in GCP Application Source Code Container

    Image Container Running Environment Cloud Source Repositories Github Container Registry Compute Engine App Engine Kubernetes Engine Cloud Build
  7. Steps to Deploy Container in GCP Application Source Code Container

    Image Container Running Environment Cloud Source Repositories Github Container Registry Compute Engine App Engine Kubernetes Engine Cloud Build Cloud Build
  8. Google Container Registry (GCR) - Private Container Registry - https://cloud.google.com/container-registry/

    - Native Docker Support - Vulnerabilities Analysis beta (Next’18 Tokyo)
  9. Vulnerabilities Analysis: Integration - Analysis events are published to Cloud

    Pub/Sub Topic - container-analysis-occurrences-v1beta1 - Usage example - Slack Notification - JIRA ticket - etc.
  10. GCR for Multi Project - Common Private Repository for Multiple

    Clusters GCR (Project A) Dev GKE (Project B) Prod GKE (Project C)
  11. GCR for Multi Project - Push Application Container to GCR

    GCR (Project A) Dev GKE (Project B) Prod GKE (Project C) my-app:v1
  12. GCR for Multi Project - Use the image in Dev

    Cluster GCR (Project A) Dev GKE (Project B) Prod GKE (Project C) my-app:v1 my-app:v1
  13. GCR for Multi Project - Use the same image in

    Prod GCR (Project A) Dev GKE (Project B) Prod GKE (Project C) my-app:v1 my-app:v1 my-app:v1
  14. GCR for Multi Project - Allow roles/storage.objectViewer to Compute SA

    of each project GCR (Project A) Dev GKE (Project B) Prod GKE (Project C)
  15. Google Cloud Build - Full-managed CI - https://cloud.google.com/cloud-build/ - Formanly

    Container Builder in GCR - Configuration - Dockerfile - cloudbuild.yaml
  16. Configuration: cloudbuild.yaml Building Docker Image and Push to GCR //

    cloudbuild.yaml steps: # build - name: 'gcr.io/cloud-builders/docker' args: [ 'build', '-t', 'gcr.io/$PROJECT_ID/my-app:$REVISION_ID', '.' ] # push images: ["push", "gcr.io/$PROJECT_ID/my-app:$REVISION_ID"]
  17. Configuration: Adding Test Building Docker Image and Push to GCR

    // cloudbuild.yaml steps: # build - name: 'gcr.io/cloud-builders/docker' args: [ 'build', '-t', 'gcr.io/$PROJECT_ID/my-nginx:$REVISION_ID', '.' ] # test - name: 'gcr.io/cloud-builders/docker' args: [ 'run', '--rm', 'gcr.io/$PROJECT_ID/my-nginx:$REVISION_ID', 'nginx', '-t' ] # push images: ["push", "gcr.io/$PROJECT_ID/my-nginx:$REVISION_ID"]
  18. Build Images - https://github.com/GoogleCloudPlatform/cloud-builders - Images Provided by Google -

    e.g. - gcr.io/cloud-builders/docker - gcr.io/cloud-builders/bash - gcr.io/cloud-builders/gcloud
  19. - Community Images - Build on you own - Kubernetes

    Tools like kustomize, helm etc. - e.g. - gcr.io/my-cool-project/kustomize - https://github.com/GoogleCloudPlatform/cloud-builders-community Community Image
  20. Notification / Integration - Build steps events are published to

    Cloud Pub/Sub Topic - cloud-builds - e.g. Slack Notification via Cloud Functions