Skip to content

Instantly share code, notes, and snippets.

@Hades32
Last active April 30, 2020 09:13
Show Gist options
  • Save Hades32/1db58c0e9c55496a8c8524574b83da82 to your computer and use it in GitHub Desktop.
Save Hades32/1db58c0e9c55496a8c8524574b83da82 to your computer and use it in GitHub Desktop.
Instant k3s cluster on Scaleway
#!/bin/bash
set -euo pipefail
server_name=$1
region=${2:-"par1"}
function fix_scw {
# there is currently a bug in scw that causes failures when (re)using servernames with '-' in it
rm ~/.scw-cache.db || true
}
fix_scw
scw --region="$region" stop --wait $server_name
fix_scw
scw --region="$region" rm -f $server_name
fix_scw
scw --region="$region" rmi volume:$server_name
fix_scw
#!/bin/bash
set -euo pipefail
# this scripts expects the following tools to be installed
# scw - https://github.com/scaleway/scaleway-cli
# k3sup - https://github.com/alexellis/k3sup
# kubectl - https://storage.googleapis.com/kubernetes-release/release/v1.16.0/bin/windows/amd64/kubectl.exe
server_name=$1
region=${2:-"par1"}
server_type=${3:-"START1-S"}
server_image=${4:-"e640c621"} # Ubuntu_Bionic_Beaver
function fix_scw {
# there is currently a bug in scw that causes failures when (re)using servernames with '-' in it
rm ~/.scw-cache.db || true
}
fix_scw
scw --region="$region" create --name="$server_name" --commercial-type="$server_type" $server_image
fix_scw
scw --region="$region" start -w $server_name
fix_scw
server_ip=$(scw --region="$region" inspect -f "{{ .PublicAddress.IP }}" server:$server_name)
k3sup install --ip=$server_ip --user=root --sudo=false # sudo=false is on to be merged PR. alternatively add sudo installation step
kubectl --kubeconfig=./kubeconfig get nodes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment