mirror of
https://codeberg.org/27/inception-of-things.git
synced 2025-12-31 21:56:41 +01:00
55 lines
1.7 KiB
Bash
Executable File
55 lines
1.7 KiB
Bash
Executable File
#!/usr/bin/env sh
|
|
|
|
k3d cluster create inception-of-things
|
|
|
|
# Setup a metrics-server to prevent dumb errors
|
|
# kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/components.yaml
|
|
# kubectl patch deployment metrics-server -n kube-system --type='json' \
|
|
# -p='[{"op": "add", "path": "/spec/template/spec/containers/0/args/-", "value": "--kubelet-insecure-tls"}]'
|
|
|
|
kubectl create namespace argocd
|
|
kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml
|
|
|
|
echo ">"
|
|
echo "> ArgoCD is starting (this takes around ~4 minutes)..."
|
|
echo ">"
|
|
|
|
kubectl wait --namespace argocd \
|
|
--for=condition=ready pod \
|
|
--selector=app.kubernetes.io/name=argocd-server \
|
|
--timeout=600s
|
|
|
|
echo 'ArgoCD is running'
|
|
sleep 10
|
|
|
|
SCRIPT_PATH="$(realpath "${BASH_SOURCE[0]}")"
|
|
SCRIPT_DIR="$(dirname "$SCRIPT_PATH")"
|
|
|
|
kubectl create namespace dev
|
|
kubectl apply -n argocd -f "$SCRIPT_DIR/../confs/argocd-app.yml"
|
|
echo '>'
|
|
echo '> App is starting (this takes around ~30 seconds)...'
|
|
echo '>'
|
|
|
|
kubectl wait --namespace dev \
|
|
--for=condition=ready pod \
|
|
--selector=app.kubernetes.io/name=app-deployment \
|
|
--timeout=300s
|
|
echo 'App imported in ArgoCD'
|
|
sleep 10
|
|
|
|
TRAEFIK_IP=$(kubectl get service -n kube-system traefik -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
|
|
echo Traefik ip is : $TRAEFIK_IP
|
|
if grep -q argo-app.com /etc/hosts; then
|
|
sudo sed -i "/argo-app.com/d" /etc/hosts
|
|
fi
|
|
echo "$TRAEFIK_IP argo-app.com" | sudo tee -a "/etc/hosts"
|
|
echo App is now reachable at argo-app.com
|
|
echo
|
|
|
|
echo "=== Login into ArgoCD with: ==="
|
|
echo Username: admin
|
|
echo -n "Password: "
|
|
kubectl -n argocd get secret argocd-initial-admin-secret -o jsonpath="{.data.password}" | base64 -d
|
|
echo "==============================="
|