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.
This commit is contained in:
Rahul Prasad
2019-07-30 18:50:35 +05:30
committed by GitHub
parent bf2850974e
commit bc5df26e2f

View File

@@ -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: