Knative Serving
기본 정보
섹션 제목: “기본 정보”| 항목 | 값 |
|---|---|
| version | Knative 1.22.0 |
| 공식 문서 | Knative Serving |
| upstream 소스 | common/knative/knative-serving, common/istio/cluster-local-gateway |
개념과 특징
섹션 제목: “개념과 특징”Knative는 Kubernetes 위에 serverless workload model을 제공한다. Kubeflow에서는 주로 KServe가 InferenceService를 serverless 형태로 띄우고 routing, revision, scale-to-zero, activator 경유 처리를 맡기기 위해 Knative Serving을 사용한다. 이 문서는 KServe serving의 기반이 되는 Knative Serving에 집중한다.

component 가 확립하는 것
섹션 제목: “component 가 확립하는 것”- Knative Serving control plane:
activator,autoscaler,controller,webhook과net-istio-controller,net-istio-webhook을 설치한다. - Serving CRD:
services.serving.knative.dev,revisions.serving.knative.dev,routes.serving.knative.dev,configurations.serving.knative.dev등 KServe serverless runtime이 의존하는 API를 제공한다. - Kubeflow gateway 연결: 기본
knative-ingress-gateway를 제거하고,config-istio가kubeflow/kubeflow-gateway와istio-ingressgateway를 사용하도록 patch한다. - cluster-local-gateway 연결:
knative-local-gateway라는 Service/Gateway 이름은 유지하되 selector를cluster-local-gatewayworkload로 돌려 KServe 내부 serving hop을 처리한다. - Serving M2M 2-hop JWT 검증:
cluster-local-gateway-jwtRequestAuthentication에 legacy ServiceAccount token issuer를 추가해 외부 serving 호출의 두 번째 gateway hop도 통과하게 한다.
Kubeflow 맞춤 변경
섹션 제목: “Kubeflow 맞춤 변경”upstream Knative는 자체 ingress gateway를 만들 수 있지만, 이 배포는 Kubeflow web app과 serving traffic을 Istio/Kubeflow gateway 체계 안에서 관리한다. 그래서 Knative Serving base는 knative-ingress-gateway를 제거하고 config-istio에 gateway.kubeflow.kubeflow-gateway: istio-ingressgateway.istio-system.svc.cluster.local을 추가한다.
config-deployment의 progressDeadline은 600s로 늘려 둔다. 큰 모델 image pull이나 container 시작 시간이 기본값보다 길어질 수 있기 때문이다.
Kubeflow 에서의 역할
섹션 제목: “Kubeflow 에서의 역할”KServe는 모델 serving workload를 단순 Deployment로만 다루지 않는다. InferenceService가 predictor revision을 만들고, 요청량에 따라 activator와 autoscaler가 관여하며, route와 domain 설정을 통해 외부/내부 endpoint를 구성한다. 이 serverless layer가 없으면 KServe의 serverless serving 경로와 scale-to-zero, revision 기반 rollout이 성립하지 않는다.
핵심 기여
섹션 제목: “핵심 기여”- KServe serverless substrate: KServe controller가 InferenceService를 Knative Service/Revision/Route로 구체화할 수 있는 API와 controller를 제공한다.
- Istio routing 통합: Knative가 만든 Route/VirtualService가 Kubeflow gateway와 local gateway 체계를 사용하도록 맞춘다.
- 내부 serving hop 보안: cluster-local-gateway에도 JWT 검증과 AuthorizationPolicy를 둬서 KServe serving의 두 번째 hop을 익명으로 열어 두지 않는다.
- Kubeflow RBAC 확장: Knative namespaced admin/edit/view ClusterRole에 aggregation label을 붙여
kubeflow-admin,kubeflow-edit,kubeflow-view에 권한이 합쳐지게 한다.
배포 구조
섹션 제목: “배포 구조”overlay 구성
섹션 제목: “overlay 구성”이 저장소의 dev overlay는 upstream common overlay를 얇게 감싼다. Serving은 본체와 cluster-local-gateway M2M auth를 분리해서 적용한다.
overlays/dev/knative-serving/overlays/gateways -> common/knative/knative-serving/overlays/gateways -> common/knative/knative-serving/base
overlays/dev/knative-serving/overlays/cluster-local-gateway -> common/istio/cluster-local-gateway/overlays/m2m-auth -> common/istio/cluster-local-gateway/base -> dev patch: legacy issuer kubernetes/serviceaccount적용 단위
섹션 제목: “적용 단위”| 적용 단위 | 주요 내용 | 이유 |
|---|---|---|
knative-serving/overlays/gateways | Serving core, net-istio, Kubeflow gateway patch, Knative local gateway selector patch | KServe serverless serving의 control plane과 routing 기반 |
knative-serving/overlays/cluster-local-gateway | cluster-local-gateway workload, Gateway, RequestAuthentication, AuthorizationPolicy | KServe serving 내부 hop과 2-hop JWT 검증 |
중요한 wiring
섹션 제목: “중요한 wiring”| 항목 | 값 / 동작 | 의미 |
|---|---|---|
config-istio | gateway.kubeflow.kubeflow-gateway -> istio-ingressgateway.istio-system.svc.cluster.local | Knative external gateway를 Kubeflow gateway로 연결 |
knative-ingress-gateway | 삭제 | 별도 Knative ingress gateway를 만들지 않음 |
knative-local-gateway Service | selector app: cluster-local-gateway, istio: cluster-local-gateway | 이름은 Knative/KServe가 기대하는 값을 유지하고 실제 Pod는 cluster-local-gateway 사용 |
knative-local-gateway Gateway | selector app: cluster-local-gateway, istio: cluster-local-gateway | local gateway traffic을 cluster-local-gateway workload로 전달 |
cluster-local-gateway-jwt | bound token issuer 2개 + legacy issuer kubernetes/serviceaccount | KServe serving 2-hop JWT 검증 |
config-domain | example.com: "" | Knative 기본 domain placeholder |
Deployment view
섹션 제목: “Deployment view”Resource Placement
섹션 제목: “Resource Placement”| namespace | resource | 이름 | 역할 |
|---|---|---|---|
knative-serving | Deployment | activator | scale-to-zero 상태의 revision 앞에서 요청을 받아 Pod 활성화 |
knative-serving | Deployment | autoscaler | request metric 기반 revision scale 조정 |
knative-serving | Deployment | controller | Knative Service, Route, Revision, Configuration reconcile |
knative-serving | Deployment | webhook | Serving resource validation/defaulting |
knative-serving | Deployment | net-istio-controller, net-istio-webhook | Knative Route를 Istio VirtualService/Gateway와 연결 |
knative-serving | ConfigMap | config-istio, config-domain, config-deployment | gateway, domain, deployment deadline 설정 |
knative-serving | Gateway | knative-local-gateway | local serving route가 참조하는 Istio Gateway 이름 |
istio-system | Service | knative-local-gateway | 실제 selector는 cluster-local-gateway Pod를 가리킴 |
istio-system | Deployment + Service | cluster-local-gateway | KServe serving 내부 route의 두 번째 gateway hop |
istio-system | RequestAuthentication | cluster-local-gateway-jwt | cluster-local-gateway에서 Bearer token 검증 |
istio-system | AuthorizationPolicy | cluster-local-gateway, cluster-local-gateway-require-jwt | JWT principal이 있는 요청만 허용하고 익명 요청 거부 |
| (cluster) | CRD | *.serving.knative.dev 등 | Knative Serving API |
| (cluster) | ClusterRole | knative-serving-namespaced-* | Kubeflow aggregated RBAC에 합쳐지는 user-facing 권한 |
Diagram
섹션 제목: “Diagram”PlantUML 원본:
의존성과 상호작용
섹션 제목: “의존성과 상호작용”선행 / 후행
섹션 제목: “선행 / 후행”- 선행: Istio control plane과
istio-ingressgateway,kubeflow-gateway, cluster JWKS proxy, Kubeflow aggregated RBAC 기준 role. - 후행: KServe controller와 KServe InferenceService runtime.
- 같이 봐야 하는 문서: serving 외부 host와 dashboard host 분리는 Kubeflow Istio Resources, M2M 2-hop 인증은 인증 흐름, user namespace 권한과 serving predictor ALLOW 정책은 멀티테넌시와 User Profile에서 다룬다.
런타임 상호작용
섹션 제목: “런타임 상호작용”KServe가 InferenceService를 reconcile하면 Knative Serving API를 통해 Service, Revision, Route가 만들어지고, Serving controller와 net-istio-controller가 이를 Pod, Service, Istio VirtualService로 구체화한다. scale-to-zero 상태에서는 activator가 요청을 받아 revision Pod 활성화를 유도하고, autoscaler가 request metric에 따라 replica 수를 조정한다.
외부 serving 요청은 kserve.10.x.x.x.nip.io host로 들어와 istio-ingressgateway에서 1차 JWT 검증을 받고, KServe/Knative route가 내부 predictor host로 넘기면서 cluster-local-gateway를 2차 경유한다. 이때 cluster-local-gateway-jwt에도 legacy issuer kubernetes/serviceaccount가 있어야 platform-api-token 같은 legacy ServiceAccount token이 통과한다. RequestAuthentication과 AuthorizationPolicy 변경은 xDS로 push되므로 Pod 재기동 없이 반영된다.
핵심 리소스
섹션 제목: “핵심 리소스”config-istio: Knative가 사용할 external gateway를 Kubeflow gateway로 지정한다.knative-local-gatewayService/Gateway: 이름은 Knative/KServe가 기대하는 local gateway지만 실제 workload는cluster-local-gateway다.cluster-local-gateway-jwt: serving 2-hop의 JWT 검증 지점. bound token issuer와 legacy issuer를 모두 신뢰한다.cluster-local-gateway-require-jwt: health/metrics path를 제외하고 JWT principal이 없는 요청을 거부한다.activator,autoscaler,controller,webhook: Knative Serving runtime과 API lifecycle의 핵심 control plane.- Knative namespaced ClusterRole: Kubeflow aggregated RBAC에 합쳐져 Profile namespace 사용자가 Knative/KServe 관련 resource를 다룰 수 있게 한다.
- overlay:
overlays/dev/knative-serving/overlays/gateways - overlay:
overlays/dev/knative-serving/overlays/cluster-local-gateway - upstream:
common/knative/knative-serving,common/istio/cluster-local-gateway - 관련 문서:
추가 적용 보정
섹션 제목: “추가 적용 보정”다음 표는 deployment에 적용되는 추가 보정을 정리한다.
| Adjustment | Target | Why it exists |
|---|---|---|
Remove knative-ingress-gateway | Knative gateway resources | avoid creating a second, separate ingress gateway stack |
Patch config-istio | Knative config | map gateway.kubeflow.kubeflow-gateway to istio-ingressgateway.istio-system.svc.cluster.local |
Keep knative-local-gateway names | Service and Gateway | preserve the names Knative and KServe expect |
Redirect selectors to cluster-local-gateway | Service and Gateway selectors | make the actual traffic land on the repository’s shared local-gateway workload |
Add legacy issuer support to cluster-local-gateway-jwt | RequestAuthentication | allow the second hop to accept legacy ServiceAccount tokens such as platform-api-token |
Extend progressDeadline to 600s | config-deployment | large model images can need longer pulls and slower startup |