GCP
인스턴스 만들기
gcloud compute instances create gcelab2 --machine-type n1-standard-2 --zone us-central1-c
gcloud compute ssh gcelab2 --zone us-central1-c
gcloud compute project-info describe --project XXXXXXXXX
export PROJECT_ID=XXXXXXXXXXX
export ZONE=us-central1-a
gcloud compute instances create gcelab2 --machine-type n1-standard-2 --zone $ZONE
구글 쿠버네티스 엔진 클러스터 만들기
gcloud container clusters create taeil-cluster
클러스터에 접속하기 위한 credentials 얻기
gcloud container clusters get-credentials taeil-cluster
hello-server이미지 받아와서디플로이하기
kubectl create deployment hello-server --image=gcr.io/google-samples/hello-app:1.0
로드밸런서와 서비스 접속 포트 지정
kubectl expose deployment hello-server --type=LoadBalancer --port 8080
hello-server서비스 확인
kubectl get service
브라우저 통해 접속
http://[EXTERNAL-IP]:8080
클러스터 지우기
gcloud container clusters delete taeil-cluster
L3기반 networks load balancers 구성
gcloud compute forwarding-rules create nginx-lb \
--region us-central1 \
--ports=80 \
--target-pool nginx-pool
gcloud compute forwarding-rules list
http://IP_ADDRESS/
L7기반 HTTP load balancers 구성
gcloud compute http-health-checks create http-basic-check
gcloud compute instance-groups managed \
set-named-ports nginx-group \
--named-ports http:80
gcloud compute backend-services create nginx-backend \
--protocol HTTP --http-health-checks http-basic-check --global
gcloud compute backend-services add-backend nginx-backend \
--instance-group nginx-group \
--instance-group-zone us-central1-a \
--global
gcloud compute url-maps create web-map \
--default-service nginx-backend
gcloud compute target-http-proxies create http-lb-proxy \
--url-map web-map
gcloud compute forwarding-rules create http-content-rule \
--global \
--target-http-proxy http-lb-proxy \
--ports 80
gcloud compute forwarding-rules list
http://IP_ADDRESS/
'Dev Diary' 카테고리의 다른 글
19/12/8 오늘 공부 (0) | 2019.12.08 |
---|---|
19/12/6 오늘 공부 (0) | 2019.12.06 |
19/12/4 오늘 공부 (0) | 2019.12.04 |
19/12/3 오늘 공부 (0) | 2019.12.04 |
19/12/2 오늘 공부 (0) | 2019.12.02 |
댓글