-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathk8s-install.sh
33 lines (26 loc) · 1.17 KB
/
k8s-install.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/bin/bash
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
echo "---------------------------------------------"
echo "-- cert-manager/k8s-install.sh"
echo "---------------------------------------------"
# Create namespace cert-manager if not exists
kubectl create namespace cert-manager --dry-run=client -o yaml | kubectl apply -f -
# Deploy cert-manager with helm
helm -n cert-manager upgrade --install cert-manager \
oci://registry-1.docker.io/bitnamicharts/cert-manager \
--set installCRDs=true
# Wait for cert-manager pods to be ready
kubectl -n cert-manager wait \
--for=condition=ready pod \
--selector=app.kubernetes.io/name=cert-manager \
--timeout=90s
# Wait for cert-manager CRD to be ready
kubectl wait --for condition=established --timeout=60s crd/clusterissuers.cert-manager.io
kubectl wait --for condition=established --timeout=60s crd/issuers.cert-manager.io
kubectl wait --for condition=established --timeout=60s crd/certificates.cert-manager.io
# Create mkcert issuer if available
if which mkcert >/dev/null; then
bash $SCRIPT_DIR/cluster-issuer/mkcert.sh
else
echo "mkcert not found, skip ClusterIssuer creation"
fi