# ref: https://knative.dev/docs/getting-started/quickstart-install/#install-the-knative-cli
echo
echo "installing knative with kind cluster..."
echo "downloading kn CLI"
sudo curl -s -Lo /usr/local/bin/kn https://github.com/knative/client/releases/download/knative-v1.4.1/kn-linux-amd64
sudo chmod +x /usr/local/bin/kn
sleep 2
echo
echo "downloading kn quickstart plugin binary"
sudo curl -s -Lo /usr/local/bin/kn-quickstart https://github.com/knative-sandbox/kn-plugin-quickstart/releases/download/knative-v1.4.0/kn-quickstart-linux-amd64
sudo chmod +x /usr/local/bin/kn-quickstart
echo
echo "checking knative quickstart plugin"
kn quickstart --help
echo
echo
echo starting knative kind cluster...
kn quickstart kind
sleep 15
echo "getting clusters to verify"
kind get clusters
echo
echo
echo patch knative serving to use Kourier by default
kubectl patch configmap/config-network \
--namespace knative-serving \
--type merge \
--patch '{"data":{"ingress-class":"kourier.ingress.networking.knative.dev"}}'
echo "patching configmap/config-features to enable podspec.runtimeclassname for installing KM..."
kubectl patch configmap/config-features \
-n knative-serving \
--type merge \
-p '{"data":{"kubernetes.podspec-runtimeclassname": "enabled"}}'
sleep 5
echo "applying Kontain daemonset yaml..."
kubectl apply -f https://raw.githubusercontent.com/kontainapp/guide-examples/master/infra/kustomize_outputs/km.yaml
sleep 5
echo "waiting for kontain-node-initializer to be ready..."
kubectl -n kube-system wait pod --for=condition=Ready -l name=kontain-node-initializer --timeout=240s
sleep 5
echo "saving log output of kontain-node-initiliazer daemonset pod"
kubectl logs daemonset/kontain-node-initializer -n kube-system > /tmp/kontain-node-initializer-kind.log
sleep 20
kubectl get po -A
cat /tmp/kontain-node-initializer-kind.log
echo creating service...
# kn service create hello-kontain --image gcr.io/knative-samples/helloworld-go --port 8080 --env TARGET=World
kubectl apply -f k8s.yml
where k8s.yml is shown below:
apiVersion: serving.knative.dev/v1
kind: Service
metadata:
name: hello-kontain
spec:
template:
spec:
runtimeClassName: kontain
containers:
- image: kontainguide/golang-http-hello:1.0 # gcr.io/knative-samples/helloworld-go
ports:
- containerPort: 8080
env:
- name: TARGET
value: "World"
echo getting service list...
kn service list
echo getting address of service...
curl $(kn service describe hello-kontain -o url)
echo invoking service...
curl $(kn service describe hello -o url)
The instructions here didn't quite work for me.
kubectl patch
command didn't get runtimes enabled inconfig-features
correctly.kn service create
command doesn't allow runtime to be set. You need to use 1kubectl apply -f`.The instructions for gVisor (https://gvisor.dev/docs/tutorials/knative/) are what I used to get things working.