use custom-kubectl-context for k3d setup,

connect to correct health endpoint
This commit is contained in:
bom 2021-11-10 12:18:17 +01:00
parent 507a5f8913
commit 1fa6758b66
5 changed files with 24 additions and 11 deletions

View file

@ -1,9 +1,3 @@
# Requirements
* Restic (install with: `sudo apt install restic` )
* (optional) AWS-CLI
# Usage
`setup-local-s3.sh [BUCKET_NAME]`:

View file

@ -1,4 +1,4 @@
apiVersion: cert-manager.io/v1alpha2
apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
name: localstack-cert

View file

@ -0,0 +1,17 @@
# Set the default kube context if present
DEFAULT_KUBE_CONTEXTS="$HOME/.kube/config"
if test -f "${DEFAULT_KUBE_CONTEXTS}"
then
export KUBECONFIG="$DEFAULT_KUBE_CONTEXTS"
fi
# Additional contexts should be in ~/.kube/custom-contexts/
CUSTOM_KUBE_CONTEXTS="$HOME/.kube/custom-contexts"
mkdir -p "${CUSTOM_KUBE_CONTEXTS}"
OIFS="$IFS"
IFS=$'\n'
for contextFile in `find "${CUSTOM_KUBE_CONTEXTS}" -type f -name "*.yml"`
do
export KUBECONFIG="$contextFile:$KUBECONFIG"
done
IFS="$OIFS"

View file

@ -4,6 +4,9 @@ function main()
./start-k3d.sh
source kubectl.sh
kubectl config use-context k3d-nextcloud
kubectl apply -f https://github.com/jetstack/cert-manager/releases/download/v1.5.4/cert-manager.yaml
kubectl apply -f localstack.yaml
@ -17,15 +20,14 @@ function main()
echo
echo "[INFO] Waiting for localstack health endpoint"
until curl --connect-timeout 3 -s -f -o /dev/null "k3stesthost/health"
until curl --connect-timeout 3 -s -f -o /dev/null --insecure "https://k3stesthost/health"
do
sleep 5
sleep 1
done
echo
kubectl get secret localstack-secret -o jsonpath="{.data.ca\.crt}" | base64 --decode > ca.crt
#aws --endpoint-url=http://localhost s3 mb s3://$bucket_name
export RESTIC_PASSWORD="test-password"
restic init --cacert ca.crt -r s3://k3stesthost/$bucket_name

View file

@ -1 +1 @@
k3d cluster create nextcloud --k3s-arg '--tls-san cloudhost@loadbalancer' --port 8080:80@loadbalancer --port 8443:443@loadbalancer --api-port 6443
KUBECONFIG=~/.kube/custom-contexts/k3d-config.yml k3d cluster create nextcloud --k3s-arg '--tls-san cloudhost@loadbalancer' --port 80:80@loadbalancer --port 443:443@loadbalancer --api-port 6443 --kubeconfig-update-default