自分で書いた備忘録がわかりにくすぎるので自分のためにまとめる
- 【GCP】Google Container Engineで Hello, World - DRYな備忘録
- 【kubectl】The connection to the server localhost:8080 was refused と叱られる - DRYな備忘録
手順
- ウェブコンソールでやること
- プロジェクトをつくる(名前:
otiai10-playground
とする) - コンテナクラスタをつくる(名前:
test-1
とする)
- プロジェクトをつくる(名前:
- gcloudのactivateと認証的なもの
- gcloud init
- gcloud config set project otiai10-playground
- gcloud config set compute/zone us-central1-a
- gcloud config set container/cluster test-1
- gcloud container clusters get-credentials test-1
- これだいじ
- ローカルでやること
- docker build イメージ焼く
- あたりまえだけどローカルでdocker runして動くかちゃんと確認する
- gcr.io(GCPのプライベートコンテナレジストリサービス)への操作
- gcloud docker push gcr.io/otiai10-playground/test-1:v3
- kubectl run test-1 --image=gcr.io/otiai10-playground/test-1:v3 --port=8080
- 確認
- 必要によっては
- kubectl expose deployment test-1 --type="LoadBalancer"
- kubectl get services (External IPが付与されるのを待つ)
DRY