Skip to content

Instantly share code, notes, and snippets.

@csantanapr
Last active December 16, 2021 23:38
Show Gist options
  • Save csantanapr/e4a60089a911e8e51e8d46c1d2195c0b to your computer and use it in GitHub Desktop.
Save csantanapr/e4a60089a911e8e51e8d46c1d2195c0b to your computer and use it in GitHub Desktop.
Install Knative using Operator
#!/usr/bin/env bash
set -eo pipefail
set -u
## INSTALL OPERATOR (is install in default namespace, to use another namespace need to modify the yaml)
n=0
until [ $n -ge 3 ]; do
kubectl apply -f https://storage.googleapis.com/knative-nightly/operator/latest/operator.yaml > /dev/null && break
echo "Kourier failed to install on first try"
n=$[$n+1]
sleep 10
done
while ! kubectl wait crd --timeout=30s --for=condition=Established --all 2>/dev/null; do sleep 30; done
while ! kubectl wait pod --timeout=30s --for=condition=Ready -l '!job-name' -n default 2>/dev/null; do sleep 30; done
## INSTALL OPERATOR CR Serving Only
cat <<EOF | kubectl apply -f -
apiVersion: v1
kind: Namespace
metadata:
name: knative-serving
EOF
cat <<EOF | kubectl apply -f -
apiVersion: operator.knative.dev/v1alpha1
kind: KnativeServing
metadata:
name: knative-serving
namespace: knative-serving
spec:
version: 1.0.1
ingress:
kourier:
enabled: true
config:
network:
ingress.class: "kourier.ingress.networking.knative.dev"
certificate.class: "net-http01.certificate.networking.knative.dev"
autoTLS: "Enabled"
autocreateClusterDomainClaims: "true"
EOF
while ! kubectl wait crd --timeout=30s --for=condition=Established --all 2>/dev/null; do sleep 30; done
while ! kubectl wait pod --timeout=30s --for=condition=Ready -l '!job-name' -n knative-serving 2>/dev/null; do sleep 30; done
# CONFIGURE MAGIC DNS
kubectl apply -f https://storage.googleapis.com/knative-nightly/serving/latest/serving-default-domain.yaml
#HTTP01 TLS
kubectl apply -f https://storage.googleapis.com/knative-nightly/net-http01/latest/release.yaml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment