Skip to content

Repository files navigation

knative-stack

A Crossplane Configuration package that deploys Knative Serving, Knative Eventing, and optional NATS JetStream on any Kubernetes cluster with Istio.

Overview

knative-stack installs and configures a complete serverless platform:

  • Knative Operator — manages the lifecycle of Knative components via Helm
  • Knative Serving — autoscaling serverless workloads with Istio ingress, scale-to-zero, and revision management
  • Knative Eventing — event-driven architecture with pluggable channels and brokers
  • NATS JetStream (optional, enabled by default) — high-performance messaging backend for Knative Eventing channels

The stack assumes Istio is already installed (e.g. via istio-stack) and configures Knative to use Istio for ingress, mTLS, and network policies.

Deletion protection (Usages) ensures correct teardown order: Serving/Eventing CRs are deleted before the Knative Operator that provides their CRDs.

Prerequisites

  • Crossplane installed in the cluster
  • Istio installed (provides security.istio.io CRDs and ingress)
  • Crossplane providers:
    • provider-helm (>=v1)
    • provider-kubernetes (>=v1)
  • Crossplane function:
    • function-auto-ready (>=v0.6.0)

Quick Start

apiVersion: pkg.crossplane.io/v1kind: Configurationmetadata:
name: knative-stackspec:
package: ghcr.io/hops-ops/knative-stack:latest
apiVersion: hops.ops.com.ai/v1alpha1kind: KnativeStackmetadata:
name: knativenamespace: defaultspec:
clusterName: default

This minimal spec installs the Knative Operator, Knative Serving (with Istio ingress), Knative Eventing (with NATS channels), and a 3-node NATS JetStream cluster.

The Journey

Stage 1: Getting Started

Minimal configuration — everything uses sensible defaults. Serving and Eventing are both enabled, NATS provides the default channel backend, and Istio handles ingress.

apiVersion: hops.ops.com.ai/v1alpha1kind: KnativeStackmetadata:
name: knativenamespace: defaultspec:
clusterName: default

What you get:

  • Knative Serving with Istio ingress, pod affinity/tolerations/topology spread enabled
  • Knative Eventing with NATS JetStream as the default channel
  • Revision garbage collection (max 10 non-active, retain 48h since creation)
  • Istio mTLS permissive mode on the knative-serving namespace

Stage 2: Production with TLS and Custom Domain

Add a hosted zone and cert-manager for automatic TLS on Knative services.

apiVersion: hops.ops.com.ai/v1alpha1kind: KnativeStackmetadata:
name: knativenamespace: defaultspec:
clusterName: production-clusterhostedZone: example.comcertManager:
enabled: truelabels:
team: platform

What this adds:

  • All Knative services get *.example.com domain routing
  • cert-manager automatically provisions TLS certificates via Let's Encrypt
  • External domain TLS enabled on the Serving network config

Stage 3: Customized Components

Override Helm values and Knative specs for specific requirements.

apiVersion: hops.ops.com.ai/v1alpha1kind: KnativeStackmetadata:
name: knativenamespace: defaultspec:
clusterName: production-clusterhostedZone: example.comcertManager:
enabled: trueknativeServing:
spec:
config:
gc:
max-non-active-revisions: "20"retain-since-last-active-time: "48h"knativeEventing:
spec:
config:
features:
new-apiserversource-filters: enablednats:
values:
config:
jetstream:
fileStore:
pvc:
size: 50Gi

Serving or Eventing Only

Disable components you don't need:

spec:
clusterName: my-clusterknativeEventing:
enabled: falsenats:
enabled: false

Composed Resources

ResourceKindPurpose
knative-operatorHelm ReleaseInstalls the Knative Operator (manages Serving/Eventing CRDs)
namespace-knative-servingObject (Namespace)Creates the knative-serving namespace with istio-injection: enabled
namespace-knative-eventingObject (Namespace)Creates the knative-eventing namespace with istio-injection: enabled
knative-servingObject (KnativeServing)Deploys Knative Serving via the operator
knative-serving-peer-authObject (PeerAuthentication)Sets Istio mTLS to permissive in knative-serving namespace
knative-eventingObject (KnativeEventing)Deploys Knative Eventing via the operator
natsHelm ReleaseInstalls NATS JetStream cluster (3 replicas, 10Gi storage)
usage-knative-servingUsagePrevents operator deletion before KnativeServing cleanup
usage-knative-eventingUsagePrevents operator deletion before KnativeEventing cleanup

Spec Reference

FieldTypeDefaultDescription
clusterNamestringrequiredTarget cluster name, used for provider config defaults
hostedZonestringDNS zone for Knative service domains (e.g. example.com)
certManager.enabledboolfalseEnable cert-manager TLS integration
certManager.issuerRefstringletsencrypt-productionClusterIssuer reference
labelsmap{}Labels merged with defaults on all resources
managementPoliciesstring[]["*"]Crossplane management policies
helmProviderConfigRef.namestring<clusterName>Helm ProviderConfig name
helmProviderConfigRef.kindstringProviderConfigProviderConfig or ClusterProviderConfig
kubernetesProviderConfigRef.namestring<clusterName>Kubernetes ProviderConfig name
kubernetesProviderConfigRef.kindstringProviderConfigProviderConfig or ClusterProviderConfig
knativeOperator.namestringknative-operatorHelm release name
knativeOperator.namespacestringknative-operatorNamespace
knativeOperator.valuesobject{}Helm values merged with defaults
knativeOperator.overrideAllValuesobjectReplaces all defaults
knativeServing.enabledbooltrueInstall Knative Serving
knativeServing.namestringknative-servingKnativeServing resource name
knativeServing.namespacestringknative-servingNamespace
knativeServing.specobject(see defaults)Spec merged with defaults
knativeServing.overrideAllSpecobjectReplaces all spec defaults
knativeEventing.enabledbooltrueInstall Knative Eventing
knativeEventing.namestringknative-eventingKnativeEventing resource name
knativeEventing.namespacestringknative-eventingNamespace
knativeEventing.specobject(see defaults)Spec merged with defaults
knativeEventing.overrideAllSpecobjectReplaces all spec defaults
nats.enabledbooltrueInstall NATS JetStream
nats.namestringnatsHelm release name
nats.namespacestringnatsNamespace
nats.valuesobject{}Helm values merged with defaults
nats.overrideAllValuesobjectReplaces all defaults

Serving Defaults

When not overridden, Knative Serving is configured with:

  • Ingress: Istio (istio.ingress.networking.knative.dev)
  • Pod features: affinity, securityContext, nodeSelector, tolerations, topologySpreadConstraints
  • GC: max 10 non-active revisions, retain 48h since creation, 15h since last active
  • TLS: enabled when certManager.enabled: true
  • Domain: configured when hostedZone is set

Eventing Defaults

When not overridden, Knative Eventing is configured with:

  • Istio integration: enabled
  • Default channel: NATS JetStream (when nats.enabled: true)

Status

FieldTypeDescription
status.readyboolOverall readiness (all components healthy)

Development

make render # Render all examples
make validate # Validate against XRD schema
make test# Run unit tests
make e2e # Run E2E tests

About

Crossplane configuration for Knative: Knative Operator, Knative Serving/Eventing, and optional NATS

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages