Ref: How to set up a local Knative environment with KinD and without DNS headaches
https://knative.dev/docs/client/install-kn/
https://github.com/knative-extensions/kn-plugin-quickstart
Copy
cat <<EOF | kind create cluster --name knative --config=-
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
extraPortMappings:
## expose port 31080 of the node to port 80 on the host
- containerPort: 31080
hostPort: 80
## expose port 31443 of the node to port 443 on the host
- containerPort: 31443
hostPort: 443
EOF
kn quickstart kind --registry
https://knative.dev/docs/samples/serving/
kn service create hello \
--image ghcr.io/knative/helloworld-go:latest \
--port 8080 \
--env TARGET=World
or
- Create hello.yaml
apiVersion: serving.knative.dev/v1
kind: Service
metadata:
name: hello
spec:
template:
spec:
containers:
- image: gcr.io/knative-samples/helloworld-go
ports:
- containerPort: 8080
env:
- name: TARGET
value: "World"
- apply
kubectl apply -f hello.yaml