Serverless-knative安装
Knative基础
Knative项目简介
Knative Serving 架构
事件与Knative Eventing
Event Source | Knative Eventing | Knative Serving
kafka | Event Source Broker Trigger | Function
部署knative
root@master03:~/knative# cat a.sh #!/bin/bash docker load -i activator.tar.gz docker load -i autoscaler.tar.gz docker load -i controller.tar.gz docker load -i domain-mapping-webhook.tar.gz docker load -i domain-mapping.tar.gz docker load -i helloworld-go.tar.gz docker load -i knative-autoscaler-hpa.tar.gz docker load -i net-istio-controller.tar.gz docker load -i net-istio-webhook.tar.gz docker load -i queue.tar.gz docker load -i webhook.tar.gz root@master03:~/knative# cat b.sh #!/bin/bash docker tag 818e6fca2a38 gcr.io/knative-releases/knative.dev/serving/cmd/domain-mapping:lates docker tag 0ab46b1399f7 gcr.io/knative-releases/knative.dev/serving/cmd/domain-mapping-webhook:lates docker tag c6353e866d44 gcr.io/knative-releases/knative.dev/serving/cmd/webhook:lates docker tag ec86e162aa5a gcr.io/knative-releases/knative.dev/serving/cmd/queue:lates docker tag f69f2fd04eb8 gcr.io/knative-releases/knative.dev/serving/cmd/activator:lates docker tag f871244aa201 gcr.io/knative-releases/knative.dev/serving/cmd/autoscaler:lates docker tag 9ec663418a9b gcr.io/knative-releases/knative.dev/serving/cmd/controller:lates docker tag 03f6877f903c gcr.io/knative-releases/knative.dev/serving/cmd/autoscaler-hpa:lates docker tag e14dc948c159 gcr.io/knative-releases/knative.dev/net-istio/cmd/webhook:lates imagePullPolicy: IfNotPresent #不能latest结尾
activator 8012
kubectl apply -f https://github.com/knative/serving/releases/download/knative-v1.2.0/serving-crds.yaml
root@master02:/opt/knative-in-practise/knative-deploy-v1.2/serving# kubectl apply -f serving-crds.yaml
root@master01:/opt# kubectl api-versions |grep knative autoscaling.internal.knative.dev/v1alpha1 caching.internal.knative.dev/v1alpha1 networking.internal.knative.dev/v1alpha1 serving.knative.dev/v1 serving.knative.dev/v1alpha1 serving.knative.dev/v1beta1
root@master01:/opt# kubectl api-resources --api-group=serving.knative.dev NAME SHORTNAMES APIVERSION NAMESPACED KIND configurations config,cfg serving.knative.dev/v1 true Configuration domainmappings dm serving.knative.dev/v1beta1 true DomainMapping revisions rev serving.knative.dev/v1 true Revision routes rt serving.knative.dev/v1 true Route services kservice,ksvc serving.knative.dev/v1 true Service
root@master01:/opt# kubectl apply -f https://github.com/knative/serving/releases/download/knative-v1.2.0/serving-core.yaml
root@master02:/opt/knative-in-practise/knative-deploy-v1.2/serving# kubectl apply -f serving-core.yaml
imagePullPolicy:
description: 'Image pull policy. One of Always, Never, IfNotPresent. Defaults to Always if :latest tag is specified, or IfNotPresent otherwise. Cannot be updated. More info: https://kubernetes.io/docs/concepts/containers/images#updating-images' #更改镜像为非lates,镜像策略为IfNotPresent
image: gcr.io/knative-releases/knative.dev/serving/cmd/queue:lates # TODO: switch to 'queue-sidecar-image' after 0.27 # Maximum time allowed for an image's digests to be resolved. image: gcr.io/knative-releases/knative.dev/serving/cmd/activator:lates image: gcr.io/knative-releases/knative.dev/serving/cmd/autoscaler:lates image: gcr.io/knative-releases/knative.dev/serving/cmd/controller:lates image: gcr.io/knative-releases/knative.dev/serving/cmd/domain-mapping:lates image: gcr.io/knative-releases/knative.dev/serving/cmd/domain-mapping-webhook:lates image: gcr.io/knative-releases/knative.dev/serving/cmd/webhook:lates
[root@yisu-621245f591dc7 ~]# docker images REPOSITORY TAG IMAGE ID CREATED SIZE gcr.io/knative-releases/knative.dev/serving/cmd/domain-mapping <none> 818e6fca2a38 3 weeks ago 49.4 MB gcr.io/knative-releases/knative.dev/serving/cmd/domain-mapping-webhook <none> 0ab46b1399f7 3 weeks ago 47.7 MB gcr.io/knative-releases/knative.dev/serving/cmd/webhook <none> c6353e866d44 3 weeks ago 49.5 MB gcr.io/knative-releases/knative.dev/serving/cmd/queue <none> ec86e162aa5a 3 weeks ago 28.1 MB gcr.io/knative-releases/knative.dev/serving/cmd/activator <none> f69f2fd04eb8 3 weeks ago 50.4 MB gcr.io/knative-releases/knative.dev/serving/cmd/autoscaler <none> f871244aa201 3 weeks ago 50.9 MB gcr.io/knative-releases/knative.dev/serving/cmd/controller <none> 9ec663418a9b 3 weeks ago 56.4 MB
root@master01:~/knative# kubectl get po -nknative-serving NAME READY STATUS RESTARTS AGE activator-5fbccc4648-qlhk8 1/1 Running 0 3m51s autoscaler-778b5c8b8b-jfxv6 1/1 Running 0 3m51s controller-77459586fc-7cpvb 1/1 Running 0 3m51s domain-mapping-85fddf7b7-6kffn 1/1 Running 0 3m50s domainmapping-webhook-dd99749fb-j6w6w 1/1 Running 0 3m50s webhook-8594d4bfb5-7r4ft 1/1 Running 0 3m50s

链接:https://pan.baidu.com/s/18auE8LZpv2SezkYg4kui2w
Install a networking layey / Istio
kubectl apply -l knative.dev/crd-install=true -f https://github.com/knative/net-istio/releases/download/knative-v1.2.0/istio.yaml kubectl apply -f https://github.com/knative/net-istio/releases/download/knative-v1.2.0/istio.yaml
root@master01:/opt/knative-in-practise/knative-deploy-v1.2/istio# kubectl apply -l knative.dev/crd-install=true -f istio.yaml #1
root@master01:/opt/knative-in-practise/knative-deploy-v1.2/istio# kubectl apply -f istio.yaml #2
istio-system istio-egressgateway-7f4864f59c-ghc6v 1/1 Running 5 10d istio-system istio-ingressgateway-fbb76f5df-4pbgt 1/1 Running 2 20m istio-system istio-ingressgateway-fbb76f5df-8bxx2 1/1 Running 0 20m istio-system istio-ingressgateway-fbb76f5df-swznk 1/1 Running 2 20m istio-system istiod-6fb996b56-58j6s 1/1 Running 2 20m istio-system istiod-6fb996b56-hdqln 1/1 Running 1 20m istio-system istiod-6fb996b56-jz7md 1/1 Running 1 20m
root@master01:~# kubectl edit svc istio-ingressgateway -nistio-system spec: clusterIP: 10.100.43.136 clusterIPs: - 10.100.43.136 externalIPs: # - 192.168.80.251 #
root@master01:~# kubectl get svc -n istio-system NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE istio-egressgateway ClusterIP 10.100.141.15 <none> 80/TCP,443/TCP 10d istio-ingressgateway LoadBalancer 10.100.43.136 192.168.80.251 15021:36049/TCP,80:29931/TCP,443:25555/TCP 10d
[root@yisu-621245f591dc7 ~]# docker images |grep istio gcr.io/knative-releases/knative.dev/net-istio/cmd/webhook <none> e14dc948c159 3 weeks ago 47.7 MB gcr.io/knative-releases/knative.dev/net-istio/cmd/controller <none> 8b2ff194e33a 3 weeks ago 53.1 MB
root@master01:/opt/knative-in-practise/knative-deploy-v1.2/istio# cat net-istio.yaml |grep image image: gcr.io/knative-releases/knative.dev/net-istio/cmd/controller@sha256:f253b82941c2220181cee80d7488fe1cefce9d49ab30bdb54bcb8c76515f7a26 image: gcr.io/knative-releases/knative.dev/net-istio/cmd/webhook@sha256:a705c1ea8e9e556f860314fe055082fbe3cde6a924c29291955f98d979f8185e
root@master01:/opt/knative-in-practise/knative-deploy-v1.2/istio# kubectl apply -f net-istio.yaml
[root@master istio]# cat net-istio.yaml |grep image image: gexuchuan123/net-istio-cmd-controller:v1 image: gexuchuan123/net-istio-cmd-webhook:v1
Install optional Serving extensions
[root@yisu-621245f591dc7 a]# docker images |grep hpa gcr.io/knative-releases/knative.dev/serving/cmd/autoscaler-hpa <none> 03f6877f903c 3 weeks ago 50 MB
docker tag gcr.io/knative-releases/knative.dev/serving/cmd/autoscaler-hpa@sha256:e3db964edf76abb4a53927039a8d3ddafb983e894c51e98b51dd0c3ebb260ccd gexuchuan123/knative-releases-knative.dev-serving-cmd-autoscaler-hpa:lates
root@master01:/opt/knative-in-practise/knative-deploy-v1.2/serving-extensions# kubectl apply -f serving-hpa.yaml
knative-serving autoscaler-hpa-7474ddcb8f-75s8l 1/1 Running 0 51s
Install the kn CLI
Using a binary
https://github.com/knative/client/releases/
root@master01:~/knative# cp kn-linux-amd64 /usr/bin/
mv kn-linux-amd64 kn
root@master01:~/knative# kn version Version: v1.2.0
root@master01:~/knative# kn service --help
root@master01:~/knative# kubectl api-resources --api-group serving.knative.dev NAME SHORTNAMES APIVERSION NAMESPACED KIND configurations config,cfg serving.knative.dev/v1 true Configuration domainmappings dm serving.knative.dev/v1beta1 true DomainMapping revisions rev serving.knative.dev/v1 true Revision routes rt serving.knative.dev/v1 true Route services kservice,ksvc serving.knative.dev/v1 true Service root@master01:~/knative# kubectl get kservice No resources found in default namespace. root@master01:~/knative# kubectl get ksvc No resources found in default namespace.
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
· 【自荐】一款简洁、开源的在线白板工具 Drawnix
· 园子的第一款AI主题卫衣上架——"HELLO! HOW CAN I ASSIST YOU TODAY
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本