Last active
March 16, 2021 13:42
-
-
Save guangbochen/6d3f18d4934940a90cc85741be3a8a79 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# init gcloud client | |
gcloud init | |
gcloud auth login | |
# create base disk | |
gcloud compute disks create gc-debian --image-project debian-cloud --image-family debian-9 --zone asia-east2-b | |
# create image with nested virtualization license | |
gcloud compute images create gc-debian-image \ | |
--source-disk gc-debian --source-disk-zone asia-east2-b \ | |
--licenses "https://compute.googleapis.com/compute/v1/projects/vm-options/global/licenses/enable-vmx" | |
# create instances | |
gcloud compute instances create gc-harvester-w1 --zone asia-east2-b --image=gc-debian-image --machine-type=n1-standard-4 --boot-disk-size=200GB | |
# connect to vm | |
gcloud compute ssh gc-harvester-w1 --zone=asia-east2-b | |
# install tools | |
sudo apt-get update && apt-get install qemu-system-x86 qemu-kvm qemu libvirt-dev virt-manager virtinst bridge-utils virt-viewer open-iscsi -y | |
# validate | |
$ sudo virt-host-validate qemu | |
# init the k3s master node | |
curl -sfL https://get.k3s.io | sh -s - server --tls-san=my-ip --node-external-ip=my-ip --token=rancher123 --no-deploy=local-storage,servicelb,traefik, | |
# join other k3 node | |
curl -sfL https://get.k3s.io | sh -s - agent --server=https://my_ip:6443 --token=rancher123 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment