【GCP】Qwiklabs の「GCP の基礎」を勉強しています~Kubernetes Engine: Qwik Start~

Kubernetes Engine: Qwik Start GCP
Kubernetes Engine: Qwik Start

Qwiklabs の「GCP の基礎」を進めていきたいと思います。

Kubernetes Engine: Qwik Start

概要

Google Kubernetes Engine(GKE)を使用してコンテナを作成し、アプリケーションをデプロイする方法を学びます。

コマンド

gcloud config set compute/zone us-central1-a

デフォルトのコンピューティングゾーンを us-central1-a に設定します。

gcloud container clusters create <クラスタ名>

Kubernetes Engine クラスタを作成します。

gcloud container clusters get-credentials <クラスタ名>

クラスタの認証情報を取得します。

kubectl create deployment hello-server --image=gcr.io/google-samples/hello-app:1.0

hello-app コンテナイメージから hello-server という新しい Deployment を作成します。

kubectl expose deployment hello-server --type=LoadBalancer --port 8080

アプリケーションを外部トラフィックに公開するための Kubernetes Service を作成します。
ウェブブラウザに下記のURLを入力してアプリケーションを表示できます。
http://<外部IPアドレス>:8080

kubectl get service

Kubernetes Service のリストを表示します。

gcloud container clusters delete <クラスタ名>

クラスタを削除します。

まとめ

Google Kubernetes Engine(GKE)を使用してコンテナを作成し、アプリケーションをデプロイする方法を学びました。
GKE のドキュメントも参照して、理解を深めていきましょう。

Google Kubernetes Engine documentation  |  Google Kubernetes Engine (GKE)  |  Google Cloud
Cloud container management.
https://www.papacoder.net/gcp-training-free-campaign/

コメント

タイトルとURLをコピーしました