- ref : 도커/쿠버네티스를 활용한 컨테이너 개발 실전 입문
- All source used in this folder come from the ref.
- gcloud : https://cloud.google.com/sdk/gcloud/reference
- gsutil : https://cloud.google.com/storage/docs/gsutil/
- gcp cli install: https://cloud.google.com/sdk/docs/install-sdk?hl=ko
$docker run -it --rm --net host -v ~/cloud-workspace/google-gcp-access:/shared:rw google/cloud-sdk:latest /bin/bash
- auth list
gcloud auth list
- login
gcloud auth login
- project create or set configuration
gcloud projects create project-cloud-test --set-as-default
- if not working well, then access to web site and create in the site directly
gcloud config set project project-cloud-test # project in accountn@googlemail.com
gcloud config set compute/region asia-northeast3 # region
gcloud config set compute/zone asia-northeast3-a # zone in that region
- GKE cluster create
gcloud container clusters create swever-cloud --project=project-cloud-test --cluster-version=1.15.12-gke.2 \
--machine-type=n1-standard-1 \
--num-nodes=1 \
--subnetwork=default
-
example output
NAME LOCATION MASTER_VERSION MASTER_IP MACHINE_TYPE NODE_VERSION NUM_NODES STATUS
swever-cloud asia-northeast3 1.15.12-gke.2 34.64.158.235 n1-standard-1 1.15.12-gke.2 3 RUNNING
gcloud compute project-info describe --project project-cloud-test
gcloud container clusters describe swever-cloud
- gcloud로 클러스터를 제어할 수 있도록 kubectl 인증정보를 설정/가져오기
gcloud container clusters get-credentials swever-cloud
==> 확인:
kubectl get nodes
-
example output root@e1dedd3c0179:/shared# kubectl get nodes
NAME STATUS ROLES AGE VERSION
gke-swever-cloud-default-pool-347ceff4-lckr Ready 40m v1.15.12-gke.2
gke-swever-cloud-default-pool-88f406bb-f3bg Ready 40m v1.15.12-gke.2
gke-swever-cloud-default-pool-e402882d-0w7p Ready 40m v1.15.12-gke.2
-
웹 브라우저 대시보드에서 확인할 수 있도록...
: ref: https://kubernetes.io/ko/docs/tasks/access-application-cluster/web-ui-dashboard/
kubectl apply -f https://raw.githubusercontent.com/kubetm/kubetm.github.io/master/sample/practice/appendix/gcp-kubernetes-dashboard.yaml
kubectl proxy --port=8001
gcloud auth login
gcloud config set project project-cloud-test # project in accountn@googlemail.com
gcloud config set compute/region asia-northeast3 # region
gcloud config set compute/zone asia-northeast3-a # zone in that region
gcloud container clusters get-credentials swever-cloud
kubectl get nodes
gcloud endpoints services delete map.endpoints.project-cloud-test.cloud.goog --project=project-cloud-test
gcloud endpoints services delete www.endpoints.project-cloud-test.cloud.goog --project=project-cloud-test
gcloud projects delete project-cloud-test
You can undo this operation for a limited period by running the command below.
$ gcloud projects undelete project-cloud-test