Last active
July 19, 2024 21:45
-
-
Save kate-goldenring/47950ccb30be2fa0180e276e82ac3593 to your computer and use it in GitHub Desktop.
Install SpinKube on MicroK8s on Ubuntu 20.04
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
#! /bin/bash | |
set -euox | |
shopt -s expand_aliases | |
SHIM_VERSION=${SHIM_VERSION:-v0.15.1} | |
OPERATOR_VERSION=${OPERATOR_VERSION:-0.2.0} | |
READINESS_TIMEOUT=${READINESS_TIMEOUT:-60s} | |
sudo snap install microk8s --classic | |
microk8s status --wait-ready | |
microk8s enable dns helm3 rbac | |
microk8s config > $HOME/.kube/config | |
export KUBECONFIG=$HOME/.kube/config | |
alias kubectl='microk8s kubectl' | |
alias helm='microk8s helm3' | |
install_cert_manager() { | |
# Install cert-manager CRDs | |
kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.14.3/cert-manager.crds.yaml | |
# Add and update Jetstack repository | |
helm repo add jetstack https://charts.jetstack.io | |
helm repo update | |
# Install the cert-manager Helm chart | |
helm upgrade --install \ | |
cert-manager jetstack/cert-manager \ | |
--namespace cert-manager \ | |
--create-namespace \ | |
--version v1.14.3 | |
# Wait for cert-manager to be ready | |
kubectl wait --for=condition=available --timeout=${READINESS_TIMEOUT} deployment/cert-manager-webhook -n cert-manager | |
} | |
install_kwasm_operator() { | |
# Add Helm repository if not already done | |
helm repo add kwasm http://kwasm.sh/kwasm-operator/ | |
# Install KWasm operator | |
helm upgrade --install \ | |
kwasm-operator kwasm/kwasm-operator \ | |
--namespace kwasm \ | |
--create-namespace \ | |
--set "kwasmOperator.installerImage=ghcr.io/spinkube/containerd-shim-spin/node-installer:$SHIM_VERSION" | |
# Provision all nodes | |
kubectl annotate node --all kwasm.sh/kwasm-node=true | |
} | |
install_spin_operator() { | |
# Apply basic Spin runtime class | |
kubectl apply -f https://github.com/spinkube/spin-operator/releases/download/v${OPERATOR_VERSION}/spin-operator.runtime-class.yaml | |
# Apply Spin CRDs | |
kubectl apply -f https://github.com/spinkube/spin-operator/releases/download/v${OPERATOR_VERSION}/spin-operator.crds.yaml | |
# Install Spin Operator with Helm | |
helm upgrade --install spin-operator \ | |
--namespace spin-operator \ | |
--create-namespace \ | |
--version ${OPERATOR_VERSION} \ | |
--wait \ | |
oci://ghcr.io/spinkube/charts/spin-operator | |
# Add the shim executor for the Spin operator | |
kubectl apply -f https://github.com/spinkube/spin-operator/releases/download/v${OPERATOR_VERSION}/spin-operator.shim-executor.yaml | |
# Wait for the Spin Operator to be ready | |
kubectl wait --for=condition=available --timeout=${READINESS_TIMEOUT} deployment/spin-operator-controller-manager -n spin-operator | |
} | |
install_cert_manager | |
install_kwasm_operator | |
install_spin_operator |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment