参考: https://knative.dev/docs/install/any-kubernetes-cluster/
kubectl apply --filename https://github.com/knative/net-kourier/releases/download/v0.20.0/kourier.yaml
namespace/kourier-system created
serviceaccount/3scale-kourier created
clusterrole.rbac.authorization.k8s.io/3scale-kourier created
clusterrolebinding.rbac.authorization.k8s.io/3scale-kourier created
deployment.apps/3scale-kourier-control created
service/kourier-control created
deployment.apps/3scale-kourier-gateway created
service/kourier created
service/kourier-internal created
configmap/kourier-bootstrap created
kubectl patch configmap/config-network \
--namespace knative-serving \
--type merge \
--patch '{"data":{"ingress.class":"kourier.ingress.networking.knative.dev"}}'
configmap/config-network patched
kubectl --namespace kourier-system get service kourier
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
kourier LoadBalancer 10.102.77.91 <pending> 80:30794/TCP,443:31790/TCP 22s
参考: https://knative.dev/docs/serving/getting-started-knative-app/
service.yaml
apiVersion: serving.knative.dev/v1 # Current version of Knative
kind: Service
metadata:
name: helloworld-go # The name of the app
namespace: default # The namespace the app will use
spec:
template:
spec:
containers:
- image: gcr.io/knative-samples/helloworld-go # Reference to the image of the app
env:
- name: TARGET # The environment variable printed out by the sample app
value: "Go Sample v1"
kubectl apply --filename service.yaml
可以看到
service.serving.knative.dev/helloworld-go created
查看服务是否成功部属
kubectl get ksvc helloworld-go
NAME URL LATESTCREATED LATESTREADY READY REASON
helloworld-go http://helloworld-go.default.example.com helloworld-go-00001 helloworld-go-00001 True
Magic DNS 仅在集群 LoadBalancer 服务公开了 IPv4 地址的情况下才有效,因此不适用於 IPv6 集群,AWS 或 Minikube之类的本地设置。
生产环境的话,应该考虑使用Real DNS。
If you are using curl to access the sample applications, or your own Knative app, and are unable to use the “Magic DNS (xip.io)” or “Real DNS” methods, there is a temporary approach. This is useful for those who wish to evaluate Knative without altering their DNS configuration, as per the “Real DNS” method, or cannot use the “Magic DNS” method due to using, for example, minikube locally or IPv6 clusters.
取得部属服务的 URL
kubectl get ksvc
NAME URL LATESTCREATED LATESTREADY READY REASON
helloworld-go http://helloworld-go.default.example.com helloworld-go-00001 helloworld-go-00001 True
Instruct curl to connect to the External IP or CNAME defined by the networking layer in section 3 above, and use the -H "Host:" command-line option to specify the Knative application’s host name. For example, if the networking layer defines your External IP and port to be http://192.168.39.228:32198 and you wish to access the above helloworld-go application, use:
curl -H "Host: helloworld-go.default.example.com" http://10.20.1.142:30794
Hello Go Sample v1!
参考: https://knative.dev/docs/serving/using-a-custom-domain/
先确认目前服务 route
kubectl get route helloworld-go
NAME URL READY REASON
helloworld-go http://helloworld-go.default.example.com True
By default, Knative Serving routes use example.com as the default domain. The fully qualified domain name for a route by default is {route}.{namespace}.{default-domain}.
To change the {default-domain} value there are a few steps involved:
config-domain.yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: config-domain
namespace: knative-serving
data:
# These are example settings of domain.
# example.org will be used for routes having app=prod.
example.org: |
selector:
app: prod
# Default value for domain, for routes that does not have app=prod labels.
# Although it will match all routes, it is the least-specific rule so it
# will only be used if no other domain matches.
mydomain.com: ""
更新 Domain Configuration
kubectl apply --filename config-domain.yaml
查看服务的 Domain
kubectl get route helloworld-go
NAME URL READY REASON
helloworld-go http://helloworld-go.default.mydomain.com True
重新拜访更新过 Domain 的服务
curl -H "Host: helloworld-go.default.mydomain.com" http://10.20.1.142:30794
Hello Go Sample v1!
<<: Angular Stock实作流程说明(Day20)
>>: Day_23: 让 Vite 来开启你的Vue 之 <script setup>
资料的最终目的就是替代人力。 (https://qz.com/217199/softbanks-hu...
前言 前几天我们聊的是串接API,在前端功能开发里,遇到的第二个主题就是档案处理。 档案处理也是在网...
1.display显示模式设定:可控制 HTML 标签的显示模式,主要分为 block 与 inli...
待完成... ...
我们今天要把环境给设定好,并且尝试将laravel专案启动,而在我写这篇文章之前,我已经有利用Hom...