728x90

안녕하세요! Devfest Cloud Hero 세션에 오신 여러분 환영합니다.

이번 랩을 통해서 컨테이너를 동작시키고,

GKE 상에서 컨테이너 복제본을 시작하는 방법을 배워 보겠습니다.

 

리전 세팅하기

gcloud config set compute/zone us-central1-a

 

 

클러스터 생성하기

gcloud container clusters create hello-world

프로젝트 ID 설정하기

echo $DEVSHELL_PROJECT_ID

 

코드 다운로드

git clone https://github.com/GoogleCloudPlatform/nodejs-docs-samples.git

디렉토리 변경하기

cd nodejs-docs-samples/containerengine/hello-world/

Dockerfile 확인하기

cat Dockerfile

컨테이너 빌드하기

docker build -t gcr.io/$DEVSHELL_PROJECT_ID/hello-node:1.0 .

컨테이너 퍼블리싱하기

gcloud docker -- push gcr.io/$DEVSHELL_PROJECT_ID/hello-node:1.0

디플로이먼트 생성하기

kubectl create deployment hello-node --image=gcr.io/$DEVSHELL_PROJECT_ID/hello-node:1.0

디플로이먼트 외부로 노출하기

kubectl expose deployment hello-node --name=hello-node --type=LoadBalancer --port=80 --target-port=8080

 

감사합니다!

728x90
반응형