Knative: Operator’s Handbook

Deploying an application

Knative has a primary API type called “Service” (not to be confused with Kubernetes “Service”). You use this Kubernetes API to deploy apps and release new versions.

Smallest manifest for a “Knative Service” (a.k.a. KService) object looks like this:

apiVersion: serving.knative.dev/v1alpha1
kind: Service
metadata:
  name: hello
spec:
  template:
    spec:
      containers:
      - image: gcr.io/google-samples/hello-app:1.0

To deploy the sample Service, click Copy button, save this to a file, and run:

$ kubectl apply -f app.yaml

Pro-tip: When you see an underlined parameter on this site, you can click and edit the value in the browser, and we'll remember it.

Specified image must have an application that listens HTTP on the port number provided by Knative (you should not set PORT in your configuration or Dockerfile, but you can customize it).

After deploying this to default namespace, the Knative Service available in the Kubernetes cluster just like any Kubernetes Service on the hostname, on port 80:

hello.default.svc.cluster.local

You can use ksvc or kservice type in kubectl to manage Knative Services:

$ kubectl get ksvc

Learn more about Knative Service (KService) type here.