Last active
November 30, 2022 13:05
-
-
Save khusseini/7ec66d3f7f361674c46952bb0a42c978 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
#!/usr/bin/env bash | |
install_yq() { | |
wget https://github.com/mikefarah/yq/releases/download/${VERSION}/${BINARY} -O /usr/bin/yq &&\ | |
chmod +x /usr/bin/yq | |
} | |
if [[ ! -f /usr/bin/yq ]] | |
then | |
VERSION=v4https://gist.github.com/khusseini/7ec66d3f7f361674c46952bb0a42c978.18.1 | |
BINARY=yq_linux_amd64 | |
install_yq | |
fi | |
patch_config() { | |
yq -i '.spec.extensions.storage.type = "openebs_local_storage" | .spec.extensions.storage.create_default_storage_class = true' /etc/k0s/k0s.yaml | |
} | |
rm -f ~/.kube/cache | |
if [[ ! -f /usr/local/bin/k0s ]] | |
then | |
curl -sSLf https://get.k0s.sh | sudo sh | |
mkdir -p /etc/k0s | |
fi | |
echo "create k0s config" | |
k0s config create > /etc/k0s/k0s.yaml | |
echo "patch config" | |
patch_config | |
echo "install controller" | |
k0s install controller --single | |
echo "start k0s" | |
k0s start | |
echo "wait for k0s to start" | |
k0s kubectl wait node --all --for condition=ready | |
echo "install openebs" | |
k0s kubectl patch storageclass openebs-hostpath -p '{"metadata": {"annotations":{"storageclass.kubernetes.io/is-default-class":"true"}}}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment