Weitere ähnliche Inhalte Ähnlich wie GCPUG.TW meetup #28 - GKE上運作您的k8s服務 (20) GCPUG.TW meetup #28 - GKE上運作您的k8s服務2. We are from
GCPUG.TW~
大家好,我們是Google Cloud Platform
User Group (GCPUG) 台灣分支,我們是一
個Google Cloud Platform 相關技術的民間
社群,成立的宗旨在分享與交換Google
Cloud Platform 上的一些技術與使用經驗。
歡迎對 Google Cloud Platform 有興趣的朋
友們可以共襄盛舉。
3. Outline
● Google Container Engine (GKE) Introduction
● Cloud Source Repositories
● Container Registry service
● Container Builder with CICD
8. Should be ready...
● 連線您的GKE集群
gcloud container clusters get-credentials [cluster_name]
--zone [cluster_zone]--project [cluster_project]
● 連線了的GKE Dashboard
kubectl proxy http://127.0.0.1:8001/
15. Step 1: 建立您的專案
mkdir myproject
cd myproject
echo ‘Hello GKE!’ > index.html
Step 2: 建立Dockerfile
cat << EOF > Dockerfile
From nginx
Add . /usr/share/nginx/html
EOF
Lab 2 - Create your project
16. Step 3:
git init
git remote add google https://source.developers.google.com/p/[project-id]/r/[repo-name]
git add .
git commit -m “init”
git push --all google
Lab 2 - Create your project
19. What is Google
Container
Registry service?
● gcr.io
● Google代管的Container Registry
● 無限量空間
● 無需架設服務器
● 可以管理版本與Tag資訊
● 以GCP專案為存取範圍
● Build triggers
● Build history
20. ● 安裝gcloud sdk
curl https://sdk.cloud.google.com | bash
● 認證gcloud sdk
gcloud init
● 安裝kubectl模組
gcloud components install kubectl
使用gcr.io前置作業
21. Step 1:
docker build -t gcr.io/[my-project-id]/[image-name] .
or
docker tag nginx gcr.io/[my-project-id]/[image-name]
Step 2:
docker push gcr.io/[my-project-id]/[image-name]
or
gcloud docker -- push gcr.io/[my-project-id]/[image-name]
使用gcr.io
22. Lab 3 - Push your image to gcr.io
Step 1: 在Lab2的專案中,執行build動作
docker build -t gcr.io/[my-project-id]/myweb .
Step 2: 將image放到container registry
docker push gcr.io/[my-project-id]/myweb
27. Lab 4 - Auto Build Docker Image
Step 1:
設定build trigger,使用Tag = v0.1這樣的方式來Build image
Step 2:
設定完成,檢視log與Cloud Builer
Step 3: Push new tag
git tag v0.1
git push google v0.1