Author Topic: การใช้งาน kubernetes k8s บน GKE google kubernetest engine กับ docker images  (Read 3737 times)

golfreeze

  • Administrator
  • Hero Member
  • *****
  • Posts: 2140
    • View Profile
    • นั่งสมาธิ สติปัฏฐานสี่ พาเที่ยววัด แนะนำวัด แจกcd ธรรมะฟรี
    • Email
การใช้งาน kubernetes k8s บน GKE google kubernetest engine กับ docker images
https://cloud.google.com/kubernetes-engine/docs/tutorials/hello-app

You can create an image for the v2 version of your application by building the same source code and tagging it as v2 (or you can change the "Hello, World!" string to "Hello, Kubernetes Engine!" before building the image):

docker build -t gcr.io/${PROJECT_ID}/hello-app:v2 .
Then push the image to the Google Container Registry:

gcloud docker -- push gcr.io/${PROJECT_ID}/hello-app:v2
Now, apply a rolling update to the existing deployment with an image update:

kubectl set image deployment/hello-web hello-web=gcr.io/${PROJECT_ID}/hello-app:v2
Visit your application again at http://[EXTERNAL_IP], and observe the changes you made take effect.


golfreeze

  • Administrator
  • Hero Member
  • *****
  • Posts: 2140
    • View Profile
    • นั่งสมาธิ สติปัฏฐานสี่ พาเที่ยววัด แนะนำวัด แจกcd ธรรมะฟรี
    • Email
$ gcloud container clusters delete hello-cluster
ERROR: (gcloud.container.clusters.delete) One of [--zone, --region] must be supplied: Please specify location..


ถ้ารันลบ cluster ใน GKE ผ่าน command shell console ใน GCP แล้วเจอ error แบบด้านล่างนี้ แสดงว่ายังไม่ได้ประกาศ project_id และ zone ให้ทำการประกาศดังนี้

$ gcloud config set project ubontown-140103
Updated property [core/project].
$ gcloud config set compute/zone asia-east1-b
Updated property [compute/zone].

###After completing this tutorial, follow these steps to remove the following resources to prevent unwanted charges incurring on your account:

###Delete the Service: This step will deallocate the Cloud Load Balancer created for your Service:
$kubectl delete service hello-web

###Wait for the Load Balancer provisioned for the hello-web Service to be deleted: The load balancer is deleted asynchronously in the background when you run kubectl delete. Wait until the load balancer is deleted by watching the output of the following command:

$gcloud compute forwarding-rules list

แล้วทำการสั่งลบ cluster อีกครั้ง
$ gcloud container clusters delete hello-cluster