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
반응형
'IT > GCP' 카테고리의 다른 글
GCP 키 탈취시 조치 사항 (0) | 2022.12.17 |
---|---|
[Cloud Hero 2-3] 소프트웨어 공급망 보안: Cloud Build와 Cloud Deploy를 통한 컨테이너 앱 배포하기 (0) | 2022.11.24 |
[Cloud Hero 2-4] Kubernetes Engine으로 배포 관리 (0) | 2022.11.22 |
[Cloud Hero 2-2] Google Kubernetes Engine의 NGINX 인그레스 컨트롤러 (0) | 2022.11.22 |
[GCP Skills Boost] Spinnaker 및 Kubernetes Engine을 사용한 지속적 배포 파이프라인 (0) | 2022.11.22 |