Knative支持自定义域名。
介绍
有两种方式创建 knative ClusterDomainClaim 资源:
kubectl patch configmap config-network -n knative-service -p '{"data": {"autocreate-cluster-domain-claims": "true"}}'
- 手动创建 CDC,metadata.name 要为外部域名,资源文件如下:
apiVersion: networking.internal.knative.dev/v1alpha1
kind: ClusterDomainClaim
metadata:
name: <domain-name>
spec:
namespace: <namespace>
apiVersion: serving.knative.dev/v1alpha1
kind: DomainMapping
metadata:
name: <domain-name>
namespace: <namespace>
spec:
ref:
name: <service-name>
kind: Service
apiVersion: serving.knative.dev/v1
tls:
secretName: <cert-secret>
kn domain create <domain-name> --ref <target> --tls <tls-secret> --namespace <namespace>
kubectl get cdc <name>
kn domain list/create/delete/describe/update
kn domain create h1.kb.cx --ref ksv:h1
kn domain list