From bc5df26e2f940f893f6592aa77244cc3c5b99b16 Mon Sep 17 00:00:00 2001 From: Rahul Prasad Date: Tue, 30 Jul 2019 18:50:35 +0530 Subject: [PATCH] Add --preemptible flag while creating instance Separate command is added to create instance with --preemptible flag which cost lesser but it will be shutdown automatically within 24 hrs. --- docs/03-compute-resources.md | 38 ++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/docs/03-compute-resources.md b/docs/03-compute-resources.md index bd92c3c..1ef15bc 100644 --- a/docs/03-compute-resources.md +++ b/docs/03-compute-resources.md @@ -114,6 +114,24 @@ for i in 0 1 2; do done ``` +__Use following command to create preemptible instance, which costs lower but it will be shutdown automtically within 24 hours__. +``` +for i in 0 1 2; do + gcloud compute instances create controller-${i} \ + --async \ + --boot-disk-size 200GB \ + --can-ip-forward \ + --image-family ubuntu-1804-lts \ + --image-project ubuntu-os-cloud \ + --machine-type n1-standard-1 \ + --private-network-ip 10.240.0.1${i} \ + --scopes compute-rw,storage-ro,service-management,service-control,logging-write,monitoring \ + --subnet kubernetes \ + --tags kubernetes-the-hard-way,controller \ + --preemptible +done +``` + ### Kubernetes Workers Each worker instance requires a pod subnet allocation from the Kubernetes cluster CIDR range. The pod subnet allocation will be used to configure container networking in a later exercise. The `pod-cidr` instance metadata will be used to expose pod subnet allocations to compute instances at runtime. @@ -139,6 +157,26 @@ for i in 0 1 2; do done ``` +__Use following command to create preemptible instance, which costs lower but it will be shutdown automtically within 24 hours__. +``` +for i in 0 1 2; do + gcloud compute instances create worker-${i} \ + --async \ + --boot-disk-size 200GB \ + --can-ip-forward \ + --image-family ubuntu-1804-lts \ + --image-project ubuntu-os-cloud \ + --machine-type n1-standard-1 \ + --metadata pod-cidr=10.200.${i}.0/24 \ + --private-network-ip 10.240.0.2${i} \ + --scopes compute-rw,storage-ro,service-management,service-control,logging-write,monitoring \ + --subnet kubernetes \ + --tags kubernetes-the-hard-way,worker \ + --preemptible +done +``` + + ### Verification List the compute instances in your default compute zone: