Knative installation:修订间差异

来自WHY42
Riguz留言 | 贡献
Riguz留言 | 贡献
第29行: 第29行:
</syntaxhighlight>
</syntaxhighlight>


For podman(rootless mode):
For podman(rootless mode does not work):
<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
sudo chmod +w /etc/sudoers
# add this line to the END of the file
riguz ALL=(ALL) NOPASSWD: ALL
sudo chmod -w /etc/sudoers
minikube start --cpus=4 --memory=4096 --addons=ingress --container-runtime=containerd
minikube start --cpus=4 --memory=4096 --addons=ingress --container-runtime=containerd
</syntaxhighlight>
</syntaxhighlight>

2023年10月11日 (三) 06:39的版本

Minikube

Container Runtime

sudo apt-get -y install podman

Install Minikube

Mac:

curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-darwin-arm64
sudo install minikube-darwin-arm64 /usr/local/bin/minikube

Ubuntu:

curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
sudo install minikube-linux-amd64 /usr/local/bin/minikube
minikube config set rootless true

Start Minikube

If use docker:

minikube start --cpus=4 --memory=4096 --addons=ingress

For podman(rootless mode does not work):

sudo chmod +w /etc/sudoers
# add this line to the END of the file
riguz ALL=(ALL) NOPASSWD: ALL 

sudo chmod -w /etc/sudoers

minikube start --cpus=4 --memory=4096 --addons=ingress --container-runtime=containerd

Knative

kubectl apply -f https://github.com/knative/serving/releases/download/knative-v1.11.0/serving-crds.yaml
kubectl apply -f https://github.com/knative/serving/releases/download/knative-v1.11.0/serving-core.yaml
kubectl apply -f https://github.com/knative/eventing/releases/download/knative-v1.11.2/eventing-crds.yaml
kubectl apply -f https://github.com/knative/eventing/releases/download/knative-v1.11.2/eventing-core.yaml
kubectl apply -f https://github.com/knative/eventing/releases/download/knative-v1.11.2/in-memory-channel.yaml
kubectl apply -f https://github.com/knative/eventing/releases/download/knative-v1.11.2/mt-channel-broker.yaml
kubectl apply -f https://github.com/knative/net-kourier/releases/download/knative-v1.11.1/kourier.yaml

kubectl patch configmap/config-network \
  --namespace knative-serving \
  --type merge \
  --patch '{"data":{"ingress-class":"kourier.ingress.networking.knative.dev"}}'

kubectl apply -f https://github.com/knative/serving/releases/download/knative-v1.11.0/serving-default-domain.yaml

kubectl --namespace kourier-system get service kourier
NAME      TYPE           CLUSTER-IP   EXTERNAL-IP     PORT(S)
   AGE
kourier   LoadBalancer   10.45.2.31   35.192.171.57   80:32515/TCP,443:31010/TCP   4m31s

CLI

wget https://github.com/knative/client/releases/download/knative-v1.11.0/kn-darwin-arm64
sudo install kn-darwin-arm64 /usr/local/bin/kn
wget https://github.com/knative/func/releases/download/knative-v1.11.0/func_darwin_arm64
sudo install func_darwin_arm64 /usr/local/bin/func

Post settings

minikube tunnel
minikube addons enable registry

kubectl port-forward --namespace kube-system service/registry 5000:80
docker run --rm -it --network=host alpine ash -c "apk add socat && socat TCP-LISTEN:5000,reuseaddr,fork TCP:$(minikube ip):5000"

kubectl -n knative-serving edit configmap config-deployment
# add
data:
  registries-skipping-tag-resolving: "localhost:5000"

Test create func

func create -l node helloworld
cd helloworld
func build
> localhost:5000/helloworld

$ func build
A registry for function images is required. For example, 'docker.io/tigerteam'.
? Registry for function images: localhost:5000/helloworld
Note: building a function the first time will take longer than subsequent builds
   🙌 Function built: localhost:5000/helloworld/helloworld:latest
$ func deploy
function up-to-date. Force rebuild with --build
    Function deployed in namespace "default" and exposed at URL:
   http://helloworld.default.127.0.0.1.sslip.io

Tekton (Not Required)

kubectl apply -f https://storage.googleapis.com/tekton-releases/pipeline/previous/v0.47.3/release.yaml
kubectl apply -f https://storage.googleapis.com/tekton-releases/triggers/previous/v0.24.1/release.yaml
kubectl apply -f https://storage.googleapis.com/tekton-releases/triggers/previous/v0.24.1/interceptors.yaml
kubectl apply -f https://storage.googleapis.com/tekton-releases/dashboard/previous/v0.37.0/release.yaml
*.func.riguz.com 35.192.171.57
kubectl patch configmap/config-domain \
  --namespace knative-serving \
  --type merge \
  --patch '{"data":{"func.riguz.com":""}}'