Skip to content

Instantly share code, notes, and snippets.

@KhalidCK
Last active December 14, 2020 14:25
Show Gist options
  • Save KhalidCK/6d6e5a15f2d53774bd749bbf347aeceb to your computer and use it in GitHub Desktop.
Save KhalidCK/6d6e5a15f2d53774bd749bbf347aeceb to your computer and use it in GitHub Desktop.
micro K8s
##https://microk8s.io/docs
#https://medium.com/google-cloud/microk8s-on-google-cloud-platform-d8b7a71a3ef
INSTANCE=microkube
ZONE=europe-west1-b
gcloud compute instances create ${INSTANCE} \
--machine-type=e2-standard-2 \
--preemptible \
--zone=${ZONE} \
--tags=microk8s \
--metadata enable-oslogin=TRUE \
--image-family=ubuntu-2010 \
--image-project=ubuntu-os-cloud \
--metadata=startup-script='
!# /bin/bash
sudo snap install microk8s --classic --channel=1.19
sudo usermod -a -G microk8s $USER
sudo chown -f -R $USER ~/.kube
'
echo "give me a break .."
sleep 3
gcloud compute ssh ${INSTANCE} --zone=${ZONE} --command="sudo usermod -a -G microk8s $(whoami)"
echo "ssh & run microk8s start and add alias kubectl='microk8s kubectl' if needed"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment