# 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)
Thanks for checking on this. Awesome review. I used the gvisor page as well.
I came up with the patch command to automate the kubectl edit command that was in gvisor. It has worked in the past for me on both EKS and Kops and kind, but will check it again definitely to make sure.
Yup, I need to alter the doc for kn service create for our service type, agreed. I have it that way in Makefile, but think I forgot to document in this doc.
the readme in guide-examples does use kubectl:
https://github.com/kontainapp/guide-examples/tree/master/examples/knative/basics