-
Notifications
You must be signed in to change notification settings - Fork 2
/
k8s-install.sh
44 lines (38 loc) · 1019 Bytes
/
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
34
35
36
37
38
39
40
41
42
43
44
#!/bin/bash
DEVBOX_HOSTNAME=${DEVBOX_HOSTNAME:-dev.localhost}
DEVBOX_INGRESS=${DEVBOX_INGRESS:-traefik}
DEVBOX_ISSUER=${DEVBOX_ISSUER:-mkcert}
# Add helm repo
helm repo add jenkins https://charts.jenkins.io
# Update helm repos
helm repo update
# Create namespace jenkins if not exists
kubectl create namespace jenkins --dry-run=client -o yaml | kubectl apply -f -
# Deploy with helm
helm -n jenkins upgrade --install jenkins jenkins/jenkins
# Create IngressRoute with dynamic hostname
cat <<EOF | kubectl -n jenkins apply -f -
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: jenkins
annotations:
cert-manager.io/cluster-issuer: "${DEVBOX_ISSUER}"
spec:
ingressClassName: ${DEVBOX_INGRESS}
rules:
- host: jenkins.$DEVBOX_HOSTNAME
http:
paths:
- pathType: Prefix
path: "/"
backend:
service:
name: jenkins
port:
number: 8080
tls:
- hosts:
- jenkins.$DEVBOX_HOSTNAME
secretName: jenkins-cert
EOF