下面是我的 knative 服务示例
apiVersion: serving.knative.dev/v1
kind: Service
metadata:
name: test-svc
spec:
template:
metadata:
annotations:
autoscaling.knative.dev/minScale: "1"
spec:
serviceAccountName: default
containers:
- image: ******************
imagePullPolicy: IfNotPresent
name: test-svc
envFrom:
- secretRef:
name: test-env
kubectl get ksvc
NAME URL LATESTCREATED LATESTREADY READY REASON
test-svc http://test-svc.kube-system.kasl.io test-svc-8v6gv test-svc-8v6gv True
网关+虚拟服务
apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
name: httpbin-gateway
spec:
selector:
istio: ingressgateway # use Istio default gateway implementation
servers:
- port:
number: 80
name: http
protocol: HTTP
hosts:
- "*"
---
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: httpbin
spec:
hosts:
- "*"
gateways:
- httpbin-gateway
http:
- match:
- uri:
prefix: /headers
route:
- destination:
host: istio-ingressgateway.istio-system.svc.cluster.local
如果我在集群内执行curl -v http://test-svc.kube-system.kasl.io它工作得很好下面是我的 knative 服务示例
apiVersion: serving.knative.dev/v1
kind: Service
metadata:
name: test-svc
spec:
template:
metadata:
annotations:
autoscaling.knative.dev/minScale: "1"
spec:
serviceAccountName: default
containers:
- image: ******************
imagePullPolicy: IfNotPresent
name: test-svc
envFrom:
- secretRef:
name: test-env
kubectl get ksvc
NAME URL LATESTCREATED LATESTREADY READY REASON
test-svc http://test-svc.kube-system.kasl.io test-svc-8v6gv test-svc-8v6gv True
网关+虚拟服务
apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
name: httpbin-gateway
spec:
selector:
istio: ingressgateway # use Istio default gateway implementation
servers:
- port:
number: 80
name: http
protocol: HTTP
hosts:
- "*"
---
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: httpbin
spec:
hosts:
- "*"
gateways:
- httpbin-gateway
http:
- match:
- uri:
prefix: /headers
route:
- destination:
host: istio-ingressgateway.istio-system.svc.cluster.local
如果我在集群内执行curl -v http://test-svc.kube-system.kasl.io它的工作
现在我想将这些服务公开给外部集群