We use analytics and cookies to understand site traffic. Information about your use of our site is shared with Google for that purpose. Learn more.
Publishing to your Kubernetes cluster
Run the sample source locally
Start a minikube cluster.
If you already have a Kubernetes cluster running, you can skip this step. The cluster must be 1.15+
minikube start
Setup ko
to use the minikube docker instance and local registry
eval $(minikube docker-env)
export KO_DOCKER_REPO=ko.local
Apply the CRD and configuration yaml
ko apply -f config
Once the sample-source-controller-manager
is running in the knative-samples
namespace, you can
apply the example.yaml
to connect our sample-source
every 10s
directly to a ksvc
.
apiVersion: serving.knative.dev/v1
kind: Service
metadata:
name: event-display
namespace: knative-samples
spec:
template:
spec:
containers:
- image: gcr.io/knative-releases/knative.dev/eventing-contrib/cmd/event_display
---
apiVersion: samples.knative.dev/v1alpha1
kind: SampleSource
metadata:
name: sample-source
namespace: knative-samples
spec:
interval: "10s"
sink:
ref:
apiVersion: serving.knative.dev/v1
kind: Service
name: event-display
ko apply -f example.yaml
Once reconciled, you can confirm the ksvc
is outputting valid cloudevents every 10s
to align with our specified interval.
% kubectl -n knative-samples logs -l serving.knative.dev/service=event-display -c user-container -f
☁️ cloudevents.Event
Validation: valid
Context Attributes,
specversion: 1.0
type: dev.knative.sample
source: http://sample.knative.dev/heartbeat-source
id: d4619592-363e-4a41-82d1-b1586c390e24
time: 2019-12-17T01:31:10.795588888Z
datacontenttype: application/json
Data,
{
"Sequence": 0,
"Heartbeat": "10s"
}
☁️ cloudevents.Event
Validation: valid
Context Attributes,
specversion: 1.0
type: dev.knative.sample
source: http://sample.knative.dev/heartbeat-source
id: db2edad0-06bc-4234-b9e1-7ea3955841d6
time: 2019-12-17T01:31:20.825969504Z
datacontenttype: application/json
Data,
{
"Sequence": 1,
"Heartbeat": "10s"
}
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.