Create new project
![](https://images.viblo.asia/9c9e550b-2bbd-4787-8879-338537d07c29.png)
You can use Google Cloud CLI, download at https://dl.google.com/dl/cloudsdk/channels/rapid/GoogleCloudSDKInstaller.exe
![](https://images.viblo.asia/e38c74c3-b98c-4f76-97cc-0c22244c94f2.png)
Enable Compute Engine API
![](https://images.viblo.asia/918a09d9-0dbc-49bb-990b-52506927c67a.png)
https://cloud.google.com/compute/docs/regions-zones
You can use
asia-southeast1-a
: Jurong West, Singapore, APAC (code 30
)
asia-southeast1-b
: Jurong West, Singapore, APAC
asia-southeast1-c
: Jurong West, Singapore, APAC
![](https://images.viblo.asia/1caf88b4-a685-44e6-8023-a92285702492.png)
Create network
![](https://images.viblo.asia/39fd4c3d-1e43-4533-8c40-59769f9232ce.png)
Create filewall rules for internal connection
![](https://images.viblo.asia/4ed82144-5692-48e4-ab8b-b8126776c0c0.png)
Create filewall rules for external connection
![](https://images.viblo.asia/61254c87-5f27-4111-a1c3-ec6ba7111c95.png)
Create kubernetes controller
![](https://images.viblo.asia/b4b5b384-dce0-4445-9a1b-40561852debe.png)
Get public IP address
![](https://images.viblo.asia/1a8b21d7-9dd0-4a29-967b-9e16c64ecde5.png)
Mapping kubernetes controller with public IP
![](https://images.viblo.asia/5b3e282a-2094-47e9-a9d0-d2ef2a8b6851.png)
Run commands
gcloud auth login
gcloud config set compute/region asia-southeast1
gcloud config set compute/zone asia-southeast1-a
gcloud config set project my-project-337503
gcloud compute networks create kubernetes-cluster --subnet-mode custom
gcloud compute networks subnets create kubernetes --network kubernetes-cluster --range 10.240.0.0/24
gcloud compute firewall-rules create kubernetes-cluster-allow-internal --allow tcp,udp,icmp --network kubernetes-cluster --source-ranges 10.240.0.0/24,10.244.0.0/16
gcloud compute firewall-rules create kubernetes-cluster-allow-external --allow tcp:22,tcp:6443,icmp --network kubernetes-cluster --source-ranges 0.0.0.0/0
gcloud compute addresses create kubernetes-controller --region $(gcloud config get-value compute/region)
gcloud compute addresses create kubernetes-controller --region asia-southeast1
gcloud compute address list
gcloud compute instances create controller --async --boot-disk-size 200GB --can-ip-forward --image-family ubuntu-2004-lts --image-project ubuntu-os-cloud --machine-type n1-standard-1 --private-network-ip 10.240.0.10 --scopes compute-rw,storage-ro,service-management,service-control,logging-write,monitoring --subnet kubernetes --address 34.124.180.248
for i in 0 1;
do gcloud compute instances create worker-${i} --async --boot-disk-size 200GB --can-ip-forward --image-family ubuntu-2004-lts --image-project ubuntu-os-cloud --machine-type n1-standard-1 --private-network-ip 10.240.0.2${i} --scopes compute-rw,storage-ro,service-management,servicecontrol,logging-write,monitoring --subnet kubernetes;
done
If you catch error
![](https://images.viblo.asia/5158403a-f69f-4511-9a60-b50bcb43937a.png)
![](https://images.viblo.asia/27996a50-e259-4ea4-b1b9-15aebf6153fb.png)
Install Docker
![](https://images.viblo.asia/b06ae0f5-b1a3-48dd-a8c7-413125d5fa87.png)
![](https://images.viblo.asia/caf9bc59-d023-4a73-b734-6a2d0ecc3b0f.png)
Install Docker
![](https://images.viblo.asia/3e8ca47a-f5ff-4119-b03c-7f936771a552.png)
gcloud compute ssh controller
sudo apt-get update && sudo apt-get install -y apt-transport-https ca-certificates curl software-propertiescommon
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
apt-cache madison docker-ce
sudo apt-get update && sudo apt-get install -y docker-ce=5:20.10.12~3-0~ubuntu-focal docker-ce-cli=5:20.10.12~3-0~ubuntu-focal
Nguồn: viblo.asia