GCP k8s 創建並啟用服務範例
紀錄google 雲端學習Lab的command
設定default region
1 |
|
設定default zone
1 |
|
創建cluster
1 |
|
- output
1
2
3
4
5
6
7
8NAME: lab-cluster
LOCATION: us-east1-d
MASTER_VERSION: 1.22.8-gke.202
MASTER_IP: 34.67.240.12
MACHINE_TYPE: e2-medium
NODE_VERSION: 1.22.8-gke.202
NUM_NODES: 3
STATUS: RUNNING
cluster授權
1 |
|
- output
1
2Fetching cluster endpoint and auth data.
kubeconfig entry generated for my-cluster.
deploy server to cluster
1 |
|
- output
會從google 抓 docker image 下來, 連結: https://console.cloud.google.com/gcr/images/google-samples/GLOBAL/hello-app:1.0/detailsexpose port1
deployment.apps/hello-server created
1
kubectl expose deployment hello-server --type=LoadBalancer --port 8080
- output
1
service/hello-server exposed
檢查服務
1 |
|
- output
1
2
3NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
hello-server loadBalancer 10.39.244.36 35.202.234.26 8080:31991/TCP 65s
kubernetes ClusterIP 10.39.240.1 433/TCP 5m13s
刪除cluster
1 |
|
GCP k8s 創建並啟用服務範例
https://shengshengyang.github.io/2023/12/09/gcp-k8s-create/