Files

20 lines
703 B
Bash
Raw Permalink Normal View History

# bootstrap.sh
#!/bin/bash
# Wait for cluster to be ready
kubectl wait --for=condition=Ready nodes --all --timeout=300s
# Longhorn requires privileged pods and hostPath volumes
kubectl create namespace longhorn-system --dry-run=client -o yaml | kubectl apply -f -
kubectl label namespace longhorn-system \
pod-security.kubernetes.io/enforce=privileged \
pod-security.kubernetes.io/enforce-version=latest \
--overwrite
# Install Longhorn
kubectl apply -f https://raw.githubusercontent.com/longhorn/longhorn/v1.7.0/deploy/longhorn.yaml
# Set as default StorageClass
kubectl patch storageclass longhorn \
-p '{"metadata":{"annotations":{"storageclass.kubernetes.io/is-default-class":"true"}}}'