-
Notifications
You must be signed in to change notification settings - Fork 129
/
Copy pathconfigure-https
executable file
·71 lines (60 loc) · 1.72 KB
/
configure-https
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/bin/bash
set -v
DIR="$(dirname "$0")"
. "${DIR}/config"
# FIXME: Does not work 100% yet.
# Configure HTTPS with Knative Serving
# Ref: https://knative.dev/docs/serving/using-a-tls-cert/
# Install cert manager
# Ref: https://cert-manager.io/docs/installation/kubernetes/
kubectl apply --validate=false -f \
"https://github.com/jetstack/cert-manager/releases/download/v${KNATIVE_VERSION}/cert-manager.yaml"
kubectl wait --for=condition=Available -n cert-manager deployments/cert-manager-webhook
# ClusterIssuer for HTTP-01 challenge
# Ref: https://knative.dev/docs/serving/using-auto-tls/
kubectl apply -f - <<EOF
apiVersion: cert-manager.io/v1alpha2
kind: ClusterIssuer
metadata:
name: letsencrypt-http01-issuer
spec:
acme:
privateKeySecretRef:
name: letsencrypt
server: https://acme-v02.api.letsencrypt.org/directory
solvers:
- http01:
ingress:
class: istio
EOF
# Install networking-certmanager deployment
kubectl apply -f \
"https://github.com/knative/net-certmanager/releases/download/v${KNATIVE_VERSION}/release.yaml"
# (Optional) Install networking-ns-cert component
kubectl apply -f \
"https://github.com/knative/serving/releases/download/v${KNATIVE_VERSION}/serving-nscert.yaml"
# Configure config-certmanager ConfigMap
kubectl apply -f - <<EOF
apiVersion: v1
kind: ConfigMap
metadata:
name: config-certmanager
namespace: knative-serving
labels:
networking.knative.dev/certificate-provider: cert-manager
data:
issuerRef: |
kind: ClusterIssuer
name: letsencrypt-http01-issuer
EOF
# Turn on Auto TLS
kubectl apply -f - <<EOF
apiVersion: v1
kind: ConfigMap
metadata:
name: config-network
namespace: knative-serving
data:
autoTLS: Enabled
httpProtocol: Enabled
EOF