||
https://www.cloudskillsboost.google/focuses/10258?parent=catalog
gcloud compute instances create xxx \
--image-family debian-10 \
--image-project debian-cloud \
--machine-type f1-micro
--zone us-east1-b
*******
gcloud container clusters create xxx-cluster --zone us-east1-b
gcloud container clusters get-credentials xxx-cluster --zone us-east1-b
kubectl create deployment hello-server --image=gcr.io/google-samples/hello-app:2.0
kubectl expose deployment hello-server --type=LoadBalancer --port 8080
kubectl get service
----
gcloud compute instance-templates create n-template --metadata-from-file startup-script=startup.sh
gcloud compute target-pools create n-pool --region us-east1
gcloud compute instance-groups managed create n-group \
--size 2 --template n-template --target-pool n-pool --zone us-east1-b
gcloud compute firewall-rules create XXXXXX --allow tcp:80
gcloud compute health-checks create http http-basic-check --port 80
gcloud compute backend-services create web-backend-service \
--protocol=HTTP \
--port-name=http \
--health-checks=http-basic-check \
--global
gcloud compute backend-services add-backend web-backend-service \
--instance-group=n-group \
--instance-group-zone=us-east1-b \
--global
gcloud compute url-maps create web-map-http \
--default-service web-backend-service
gcloud compute target-http-proxies create http-lb-proxy \
--url-map web-map-http
gcloud compute addresses create lb-ipv4-1 --ip-version=IPV4 --global
gcloud compute forwarding-rules create http-content-rule \
--address=lb-ipv4-1\
--global \
--target-http-proxy=http-lb-proxy \
--ports=80
参考:
https://titangene.github.io/article/gcp-network-and-http-load-balancer.html
Archiver|手机版|科学网 ( 京ICP备07017567号-12 )
GMT+8, 2024-12-23 10:57
Powered by ScienceNet.cn
Copyright © 2007- 中国科学报社