awakia / catchup

Issue based repository to catch up technologies and movements
5 stars 0 forks source link

Google Compute Engine を使ってみる #49

Open awakia opened 8 years ago

awakia commented 8 years ago

Kubernetes の概要勉強用 https://github.com/awakia/catchup/issues/36

https://cloud.google.com/container-engine/ screen shot 2015-11-10 at 4 23 25 pm

料金: 各ノードの料金 + 6ノード以上の場合 $0.15HR/クラスタ HR/クラスタってどういうことだ??まぁとりあえず6も使わないので放置

awakia commented 8 years ago

image

awakia commented 8 years ago

standard-2 ぐらいでやってみたら良さそう

https://cloud.google.com/products/calculator/?hl=ja#id=c386205d-979b-4d9c-8db5-aec995ea56e3

screen shot 2015-11-10 at 4 02 02 pm

awakia commented 8 years ago

ベータのモニタリングも有効にしてみた

https://cloud.google.com/monitoring/get-started?hl=ja

screen shot 2015-11-10 at 4 05 11 pm

Endpoint Checkのビデオ https://www.youtube.com/watch?v=owjWUzA1XUo&feature=youtu.be

awakia commented 8 years ago

以下のスペックで作成

screen shot 2015-11-10 at 4 06 01 pm

awakia commented 8 years ago

ちなみに「その他」では以下の様なことが設定可能

screen shot 2015-11-10 at 4 07 08 pm

awakia commented 8 years ago

Google Cloud PlatformのCLI

Cloud SDK gcloudというのがある。

Install

https://cloud.google.com/sdk/#Quick_Start

curl https://sdk.cloud.google.com | bash

ここで、インストール場所を選択する。デフォルトで~以下。つまり自分は/Users/awakia/google-cloud-sdk/が作成された。

シェルのリロード

gcloud init

gcloud container

GKE (Google Container Engine) のクライアント

https://cloud.google.com/sdk/gcloud/reference/container/?hl=ja

gcloud docker

Google Container Registryのクライアント

が出来る

awakia commented 8 years ago

kubectl のインストール

$ gcloud components update kubectl
$ which kubectl
/Users/awakia/google-cloud-sdk/bin/kubectl

projectのkube-test-awakiaは、https://console.developers.google.com/project からProject IDを選ぶ。 conpute-zoneはhttps://cloud.google.com/compute/docs/zones?hl=ja#available から。

$ gcloud config set project kube-test-awakia
$ gcloud config set compute/zone asia-east1-a

までやる。以下はclusterを作ったあと

$ gcloud config set container/cluster cluster-1
$ gcloud container clusters get-credentials cluster-1

ここまでやるとkubectlのクレデンシャルが正しくセットされる。

参考: gcloud config list

Before

[app]
use_appengine_api = True
[core]
account = nao@wantedly.com
disable_usage_reporting = True
[meta]
active_config = default

After

[app]
use_appengine_api = True
[compute]
zone = asia-east1-a
[container]
cluster = cluster-1
[core]
account = nao@wantedly.com
disable_usage_reporting = True
project = kube-test-awakia
[meta]
active_config = default