Format markdown (#620)

Produced via: `prettier --write --proseWrap=always $(find -name '*.md' | grep -v vendor)`
This commit is contained in:
mattmoor-sockpuppet 2018-12-03 13:54:25 -08:00 committed by Knative Prow Robot
parent b83769e72d
commit 41462c69e1
83 changed files with 3472 additions and 3252 deletions

View File

@ -1,14 +1,12 @@
## Expected Behavior ## Expected Behavior
## Actual Behavior ## Actual Behavior
## Steps to Reproduce the Problem ## Steps to Reproduce the Problem
1. 1.
2. 2.
3. 3.
## Additional Info ## Additional Info

View File

@ -2,6 +2,6 @@ Fixes #(issue-number)
## Proposed Changes ## Proposed Changes
* -
* -
* -

View File

@ -1,30 +1,30 @@
# Welcome, Knative # Welcome, Knative
Knative (pronounced kay-nay-tiv) extends Kubernetes to provide a set of middleware Knative (pronounced kay-nay-tiv) extends Kubernetes to provide a set of middleware
components that are essential to build modern, source-centric, and container-based components that are essential to build modern, source-centric, and container-based
applications that can run anywhere: on premises, in the cloud, or even in a third-party applications that can run anywhere: on premises, in the cloud, or even in a third-party
data center. data center.
Each of the components under the Knative project attempt to identify common patterns and Each of the components under the Knative project attempt to identify common patterns and
codify the best practices that are shared by successful real-world Kubernetes-based frameworks and codify the best practices that are shared by successful real-world Kubernetes-based frameworks and
applications. Knative components focus on solving many mundane but difficult tasks such as: applications. Knative components focus on solving many mundane but difficult tasks such as:
* [Deploying a container](./install/getting-started-knative-app.md) - [Deploying a container](./install/getting-started-knative-app.md)
* [Orchestrating source-to-URL workflows on Kubernetes](./serving/samples/source-to-url-go/) - [Orchestrating source-to-URL workflows on Kubernetes](./serving/samples/source-to-url-go/)
* [Routing and managing traffic with blue/green deployment](./serving/samples/blue-green-deployment.md) - [Routing and managing traffic with blue/green deployment](./serving/samples/blue-green-deployment.md)
* [Automatic scaling and sizing workloads based on demand](./serving/samples/autoscale-go) - [Automatic scaling and sizing workloads based on demand](./serving/samples/autoscale-go)
* [Binding running services to eventing ecosystems](./eventing/samples/kubernetes-event-source) - [Binding running services to eventing ecosystems](./eventing/samples/kubernetes-event-source)
Developers on Knative can use familiar idioms, languages, and frameworks to deploy any workload: Developers on Knative can use familiar idioms, languages, and frameworks to deploy any workload:
functions, applications, or containers. functions, applications, or containers.
## Components ## Components
The following Knative components are currently available: The following Knative components are currently available:
* [Build](https://github.com/knative/build) - Source-to-container build orchestration - [Build](https://github.com/knative/build) - Source-to-container build orchestration
* [Eventing](https://github.com/knative/eventing) - Management and delivery of events - [Eventing](https://github.com/knative/eventing) - Management and delivery of events
* [Serving](https://github.com/knative/serving) - Request-driven compute that can scale to zero - [Serving](https://github.com/knative/serving) - Request-driven compute that can scale to zero
## Audience ## Audience
@ -71,41 +71,41 @@ Follow the links in this section to learn more about Knative.
### Getting started ### Getting started
* [Installing Knative](./install/README.md) - [Installing Knative](./install/README.md)
* [Getting started with app deployment](./install/getting-started-knative-app.md) - [Getting started with app deployment](./install/getting-started-knative-app.md)
* [Getting started with serving](./serving) - [Getting started with serving](./serving)
* [Getting started with builds](./build) - [Getting started with builds](./build)
* [Getting started with eventing](./eventing) - [Getting started with eventing](./eventing)
### Configuration and networking ### Configuration and networking
* [Configuring outbound network access](./serving/outbound-network-access.md) - [Configuring outbound network access](./serving/outbound-network-access.md)
* [Using a custom domain](./serving/using-a-custom-domain.md) - [Using a custom domain](./serving/using-a-custom-domain.md)
* [Assigning a static IP address for Knative on Google Kubernetes Engine](./serving/gke-assigning-static-ip-address.md) - [Assigning a static IP address for Knative on Google Kubernetes Engine](./serving/gke-assigning-static-ip-address.md)
* [Configuring HTTPS with a custom certificate](./serving/using-an-ssl-cert.md) - [Configuring HTTPS with a custom certificate](./serving/using-an-ssl-cert.md)
### Samples and demos ### Samples and demos
* [Autoscaling](./serving/samples/autoscale-go/README.md) - [Autoscaling](./serving/samples/autoscale-go/README.md)
* [Source-to-URL deployment](./serving/samples/source-to-url-go/README.md) - [Source-to-URL deployment](./serving/samples/source-to-url-go/README.md)
* [Binding running services to eventing ecosystems](./eventing/samples/event-flow/README.md) - [Binding running services to eventing ecosystems](./eventing/samples/event-flow/README.md)
* [Telemetry](./serving/samples/telemetry-go/README.md) - [Telemetry](./serving/samples/telemetry-go/README.md)
* [REST API sample](./serving/samples/rest-api-go/README.md) - [REST API sample](./serving/samples/rest-api-go/README.md)
* [All samples for serving](./serving/samples/) - [All samples for serving](./serving/samples/)
* [All samples for eventing](./eventing/samples/) - [All samples for eventing](./eventing/samples/)
### Logging and metrics ### Logging and metrics
* [Installing logging, metrics and traces](./serving/installing-logging-metrics-traces.md) - [Installing logging, metrics and traces](./serving/installing-logging-metrics-traces.md)
* [Accessing logs](./serving/accessing-logs.md) - [Accessing logs](./serving/accessing-logs.md)
* [Accessing metrics](./serving/accessing-metrics.md) - [Accessing metrics](./serving/accessing-metrics.md)
* [Accessing traces](./serving/accessing-traces.md) - [Accessing traces](./serving/accessing-traces.md)
* [Setting up a logging plugin](./serving/setting-up-a-logging-plugin.md) - [Setting up a logging plugin](./serving/setting-up-a-logging-plugin.md)
### Debugging ### Debugging
* [Debugging application issues](./serving/debugging-application-issues.md) - [Debugging application issues](./serving/debugging-application-issues.md)
* [Debugging performance issues](./serving/debugging-performance-issues.md) - [Debugging performance issues](./serving/debugging-performance-issues.md)
--- ---

View File

@ -19,27 +19,27 @@ More information about this use case is demonstrated in
## Key features of Knative Builds ## Key features of Knative Builds
* A `Build` can include multiple `steps` where each step specifies a `Builder`. - A `Build` can include multiple `steps` where each step specifies a `Builder`.
* A `Builder` is a type of container image that you create to accomplish any - A `Builder` is a type of container image that you create to accomplish any
task, whether that's a single step in a process, or the whole process itself. task, whether that's a single step in a process, or the whole process itself.
* The `steps` in a `Build` can push to a repository. - The `steps` in a `Build` can push to a repository.
* A `BuildTemplate` can be used to defined reusable templates. - A `BuildTemplate` can be used to defined reusable templates.
* The `source` in a `Build` can be defined to mount data to a Kubernetes - The `source` in a `Build` can be defined to mount data to a Kubernetes
Volume, and supports: Volume, and supports:
* `git` repositories - `git` repositories
* Google Cloud Storage - Google Cloud Storage
* An arbitrary container image - An arbitrary container image
* Authenticate with `ServiceAccount` using Kubernetes Secrets. - Authenticate with `ServiceAccount` using Kubernetes Secrets.
### Learn more ### Learn more
See the following reference topics for information about each of the build See the following reference topics for information about each of the build
components: components:
* [`Build`](https://github.com/knative/docs/blob/master/build/builds.md) - [`Build`](https://github.com/knative/docs/blob/master/build/builds.md)
* [`BuildTemplate`](https://github.com/knative/docs/blob/master/build/build-templates.md) - [`BuildTemplate`](https://github.com/knative/docs/blob/master/build/build-templates.md)
* [ `Builder`](https://github.com/knative/docs/blob/master/build/builder-contract.md) - [ `Builder`](https://github.com/knative/docs/blob/master/build/builder-contract.md)
* [`ServiceAccount`](https://github.com/knative/docs/blob/master/build/auth.md) - [`ServiceAccount`](https://github.com/knative/docs/blob/master/build/auth.md)
## Install the Knative Build component ## Install the Knative Build component
@ -49,10 +49,10 @@ install. Knative Serving is not required to create and run builds.
Before you can run a Knative Build, you must install the Knative Build Before you can run a Knative Build, you must install the Knative Build
component in your Kubernetes cluster: component in your Kubernetes cluster:
* For details about installing a new instance of Knative in your Kubernetes - For details about installing a new instance of Knative in your Kubernetes
cluster, see [Installing Knative](../install/README.md). cluster, see [Installing Knative](../install/README.md).
* If you have a component of Knative installed and running, you can - If you have a component of Knative installed and running, you can
[add and install the Knative Build component](installing-build-component.md). [add and install the Knative Build component](installing-build-component.md).
## Configuration syntax example ## Configuration syntax example
@ -86,7 +86,6 @@ spec:
args: ['echo', 'hello-example', 'build'] args: ['echo', 'hello-example', 'build']
``` ```
## Get started with Knative Build samples ## Get started with Knative Build samples
Use the following samples to learn how to configure your Knative Builds to Use the following samples to learn how to configure your Knative Builds to
@ -96,21 +95,20 @@ Tip: Review and reference multiple samples to piece together more complex builds
#### Simple build samples #### Simple build samples
* [Collection of simple test builds](https://github.com/knative/build/tree/master/test). - [Collection of simple test builds](https://github.com/knative/build/tree/master/test).
#### Build templates #### Build templates
* [Repository of sample build templates](https://github.com/knative/build-templates). - [Repository of sample build templates](https://github.com/knative/build-templates).
#### Complex samples #### Complex samples
* [Use Knative to build apps from source code and then run those containers](https://github.com/knative/docs/blob/master/serving/samples/source-to-url-go). - [Use Knative to build apps from source code and then run those containers](https://github.com/knative/docs/blob/master/serving/samples/source-to-url-go).
## Related info
## Related info If you are interested in contributing to the Knative Build project, see the
[Knative Build code repository](https://github.com/knative/build).
If you are interested in contributing to the Knative Build project, see the
[Knative Build code repository](https://github.com/knative/build).
--- ---

View File

@ -6,8 +6,8 @@ of a build.
The build system supports two types of authentication, using Kubernetes' The build system supports two types of authentication, using Kubernetes'
first-class `Secret` types: first-class `Secret` types:
* `kubernetes.io/basic-auth` - `kubernetes.io/basic-auth`
* `kubernetes.io/ssh-auth` - `kubernetes.io/ssh-auth`
Secrets of these types can be made available to the `Build` by attaching them Secrets of these types can be made available to the `Build` by attaching them
to the `ServiceAccount` as which it runs. to the `ServiceAccount` as which it runs.
@ -34,7 +34,7 @@ into their respective files in `$HOME`.
metadata: metadata:
name: ssh-key name: ssh-key
annotations: annotations:
build.knative.dev/git-0: https://github.com # Described below build.knative.dev/git-0: https://github.com # Described below
type: kubernetes.io/ssh-auth type: kubernetes.io/ssh-auth
data: data:
ssh-privatekey: <base64 encoded> ssh-privatekey: <base64 encoded>
@ -55,7 +55,7 @@ into their respective files in `$HOME`.
metadata: metadata:
name: build-bot name: build-bot
secrets: secrets:
- name: ssh-key - name: ssh-key
``` ```
1. Then use that `ServiceAccount` in your `Build`: 1. Then use that `ServiceAccount` in your `Build`:
@ -92,7 +92,7 @@ used to authenticate with the Git service.
metadata: metadata:
name: basic-user-pass name: basic-user-pass
annotations: annotations:
build.knative.dev/git-0: https://github.com # Described below build.knative.dev/git-0: https://github.com # Described below
type: kubernetes.io/basic-auth type: kubernetes.io/basic-auth
stringData: stringData:
username: <username> username: <username>
@ -107,7 +107,7 @@ used to authenticate with the Git service.
metadata: metadata:
name: build-bot name: build-bot
secrets: secrets:
- name: basic-user-pass - name: basic-user-pass
``` ```
1. Use that `ServiceAccount` in your `Build`: 1. Use that `ServiceAccount` in your `Build`:
@ -144,7 +144,7 @@ credentials are then used to authenticate with the Git repository.
metadata: metadata:
name: basic-user-pass name: basic-user-pass
annotations: annotations:
build.knative.dev/docker-0: https://gcr.io # Described below build.knative.dev/docker-0: https://gcr.io # Described below
type: kubernetes.io/basic-auth type: kubernetes.io/basic-auth
stringData: stringData:
username: <username> username: <username>
@ -159,7 +159,7 @@ credentials are then used to authenticate with the Git repository.
metadata: metadata:
name: build-bot name: build-bot
secrets: secrets:
- name: basic-user-pass - name: basic-user-pass
``` ```
1. Use that `ServiceAccount` in your `Build`: 1. Use that `ServiceAccount` in your `Build`:
@ -264,6 +264,7 @@ are ignored.
Given URLs, usernames, and passwords of the form: `https://url{n}.com`, Given URLs, usernames, and passwords of the form: `https://url{n}.com`,
`user{n}`, and `pass{n}`, generate the following for Git: `user{n}`, and `pass{n}`, generate the following for Git:
``` ```
=== ~/.gitconfig === === ~/.gitconfig ===
[credential] [credential]
@ -283,6 +284,7 @@ https://user2:pass2@url2.com
Given hostnames, private keys, and `known_hosts` of the form: `url{n}.com`, Given hostnames, private keys, and `known_hosts` of the form: `url{n}.com`,
`key{n}`, and `known_hosts{n}`, generate the following for Git: `key{n}`, and `known_hosts{n}`, generate the following for Git:
``` ```
=== ~/.ssh/id_key1 === === ~/.ssh/id_key1 ===
{contents of key1} {contents of key1}
@ -305,14 +307,14 @@ Host url2.com
Note: Because `known_hosts` is a non-standard extension of Note: Because `known_hosts` is a non-standard extension of
`kubernetes.io/ssh-auth`, when it is not present this will be generated `kubernetes.io/ssh-auth`, when it is not present this will be generated
through `ssh-keygen url{n}.com ` instead. through `ssh-keygen url{n}.com` instead.
### Least privilege ### Least privilege
The secrets as outlined here will be stored into `$HOME` (by convention the The secrets as outlined here will be stored into `$HOME` (by convention the
volume: `/builder/home`), and will be available to `Source` and all `Steps`. volume: `/builder/home`), and will be available to `Source` and all `Steps`.
For sensitive credentials that should not be made available to some steps, For sensitive credentials that should not be made available to some steps,
do not use the mechanisms outlined here. Instead, the user should declare an do not use the mechanisms outlined here. Instead, the user should declare an
explicit `Volume` from the `Secret` and manually `VolumeMount` it into the explicit `Volume` from the `Secret` and manually `VolumeMount` it into the
`Step`. `Step`.

View File

@ -22,43 +22,49 @@ This is used only for the purposes of demonstration.
```yaml ```yaml
spec: spec:
parameters: parameters:
# This has no default, and is therefore required. # This has no default, and is therefore required.
- name: IMAGE - name: IMAGE
description: Where to publish the resulting image. description: Where to publish the resulting image.
# These may be overridden, but provide sensible defaults. # These may be overridden, but provide sensible defaults.
- name: DIRECTORY - name: DIRECTORY
description: The directory containing the build context. description: The directory containing the build context.
default: /workspace default: /workspace
- name: DOCKERFILE_NAME - name: DOCKERFILE_NAME
description: The name of the Dockerfile description: The name of the Dockerfile
default: Dockerfile default: Dockerfile
steps: steps:
- name: dockerfile-build - name: dockerfile-build
image: gcr.io/cloud-builders/docker image: gcr.io/cloud-builders/docker
workingDir: "${DIRECTORY}" workingDir: "${DIRECTORY}"
args: ["build", "--no-cache", args:
"--tag", "${IMAGE}", [
"--file", "${DOCKERFILE_NAME}", "build",
"."] "--no-cache",
volumeMounts: "--tag",
- name: docker-socket "${IMAGE}",
mountPath: /var/run/docker.sock "--file",
"${DOCKERFILE_NAME}",
".",
]
volumeMounts:
- name: docker-socket
mountPath: /var/run/docker.sock
- name: dockerfile-push - name: dockerfile-push
image: gcr.io/cloud-builders/docker image: gcr.io/cloud-builders/docker
args: ["push", "${IMAGE}"] args: ["push", "${IMAGE}"]
volumeMounts: volumeMounts:
- name: docker-socket - name: docker-socket
mountPath: /var/run/docker.sock mountPath: /var/run/docker.sock
# As an implementation detail, this template mounts the host's daemon socket. # As an implementation detail, this template mounts the host's daemon socket.
volumes: volumes:
- name: docker-socket - name: docker-socket
hostPath: hostPath:
path: /var/run/docker.sock path: /var/run/docker.sock
type: Socket type: Socket
``` ```
In this example, `parameters` describes the formal arguments for the template. In this example, `parameters` describes the formal arguments for the template.
@ -80,6 +86,7 @@ For the sake of illustrating re-use, here are several example Builds
instantiating the `BuildTemplate` above (`dockerfile-build-and-push`). instantiating the `BuildTemplate` above (`dockerfile-build-and-push`).
Build `mchmarny/rester-tester`: Build `mchmarny/rester-tester`:
```yaml ```yaml
spec: spec:
source: source:
@ -89,11 +96,12 @@ spec:
template: template:
name: dockerfile-build-and-push name: dockerfile-build-and-push
arguments: arguments:
- name: IMAGE - name: IMAGE
value: gcr.io/my-project/rester-tester value: gcr.io/my-project/rester-tester
``` ```
Build `googlecloudplatform/cloud-builder`'s `wget` builder: Build `googlecloudplatform/cloud-builder`'s `wget` builder:
```yaml ```yaml
spec: spec:
source: source:
@ -103,14 +111,15 @@ spec:
template: template:
name: dockerfile-build-and-push name: dockerfile-build-and-push
arguments: arguments:
- name: IMAGE - name: IMAGE
value: gcr.io/my-project/wget value: gcr.io/my-project/wget
# Optional override to specify the subdirectory containing the Dockerfile # Optional override to specify the subdirectory containing the Dockerfile
- name: DIRECTORY - name: DIRECTORY
value: /workspace/wget value: /workspace/wget
``` ```
Build `googlecloudplatform/cloud-builder`'s `docker` builder with `17.06.1`: Build `googlecloudplatform/cloud-builder`'s `docker` builder with `17.06.1`:
```yaml ```yaml
spec: spec:
source: source:
@ -120,13 +129,13 @@ spec:
template: template:
name: dockerfile-build-and-push name: dockerfile-build-and-push
arguments: arguments:
- name: IMAGE - name: IMAGE
value: gcr.io/my-project/docker value: gcr.io/my-project/docker
# Optional overrides # Optional overrides
- name: DIRECTORY - name: DIRECTORY
value: /workspace/docker value: /workspace/docker
- name: DOCKERFILE_NAME - name: DOCKERFILE_NAME
value: Dockerfile-17.06.1 value: Dockerfile-17.06.1
``` ```
--- ---

View File

@ -23,7 +23,7 @@ spec:
### Typical Builders ### Typical Builders
A Builder is typically a purpose-built container whose entrypoint is a tool that A Builder is typically a purpose-built container whose entrypoint is a tool that
performs some action and exits with a zero status on success. These entrypoints performs some action and exits with a zero status on success. These entrypoints
are often command-line tools, for example, `git`, `docker`, `mvn`, and so on. are often command-line tools, for example, `git`, `docker`, `mvn`, and so on.
Typical builders set their `command:` (aka `ENTRYPOINT`) to be the command they Typical builders set their `command:` (aka `ENTRYPOINT`) to be the command they
@ -40,31 +40,30 @@ overriding `command:` and `args:` for example:
```yaml ```yaml
steps: steps:
- image: ubuntu - image: ubuntu
command: ['/bin/bash'] command: ["/bin/bash"]
args: ['-c', 'echo hello $FOO'] args: ["-c", "echo hello $FOO"]
env: env:
- name: 'FOO' - name: "FOO"
value: 'world' value: "world"
``` ```
### Specialized Builders ### Specialized Builders
It is also possible for advanced users to create purpose-built builders. It is also possible for advanced users to create purpose-built builders.
One example of this are the ["FTL" builders]( One example of this are the ["FTL" builders](https://github.com/GoogleCloudPlatform/runtimes-common/tree/master/ftl#ftl).
https://github.com/GoogleCloudPlatform/runtimes-common/tree/master/ftl#ftl).
## What are the Builder conventions? ## What are the Builder conventions?
Builders should expect a Build to implement the following conventions: Builders should expect a Build to implement the following conventions:
* `/workspace`: The default working directory will be `/workspace`, which is
a volume that is filled by the `source:` step and shared across build `steps:`.
* `/builder/home`: This volume is exposed to steps via `$HOME`. - `/workspace`: The default working directory will be `/workspace`, which is
a volume that is filled by the `source:` step and shared across build `steps:`.
* Credentials attached to the Build's service account may be exposed as Git or - `/builder/home`: This volume is exposed to steps via `$HOME`.
Docker credentials as outlined [here](./auth.md).
- Credentials attached to the Build's service account may be exposed as Git or
Docker credentials as outlined [here](./auth.md).
--- ---

View File

@ -11,14 +11,14 @@ A build runs until all `steps` have completed or until a failure occurs.
--- ---
* [Syntax](#syntax) - [Syntax](#syntax)
* [Steps](#steps) - [Steps](#steps)
* [Template](#template) - [Template](#template)
* [Source](#source) - [Source](#source)
* [Service Account](#service-account) - [Service Account](#service-account)
* [Volumes](#volumes) - [Volumes](#volumes)
* [Timeout](#timeout) - [Timeout](#timeout)
* [Examples](#examples) - [Examples](#examples)
--- ---
@ -27,28 +27,28 @@ A build runs until all `steps` have completed or until a failure occurs.
To define a configuration file for a `Build` resource, you can specify the To define a configuration file for a `Build` resource, you can specify the
following fields: following fields:
* Required: - Required:
* [`apiVersion`][kubernetes-overview] - Specifies the API version, for example - [`apiVersion`][kubernetes-overview] - Specifies the API version, for example
`build.knative.dev/v1alpha1`. `build.knative.dev/v1alpha1`.
* [`kind`][kubernetes-overview] - Specify the `Build` resource object. - [`kind`][kubernetes-overview] - Specify the `Build` resource object.
* [`metadata`][kubernetes-overview] - Specifies data to uniquely identify the - [`metadata`][kubernetes-overview] - Specifies data to uniquely identify the
`Build` resource object, for example a `name`. `Build` resource object, for example a `name`.
* [`spec`][kubernetes-overview] - Specifies the configuration information for - [`spec`][kubernetes-overview] - Specifies the configuration information for
your `Build` resource object. Build steps must be defined through either of your `Build` resource object. Build steps must be defined through either of
the following fields: the following fields:
* [`steps`](#steps) - Specifies one or more container images that you want - [`steps`](#steps) - Specifies one or more container images that you want
to run in your build. to run in your build.
* [`template`](#template) - Specifies a reusable build template that - [`template`](#template) - Specifies a reusable build template that
includes one or more `steps`. includes one or more `steps`.
* Optional: - Optional:
* [`source`](#source) - Specifies a container image that provides information - [`source`](#source) - Specifies a container image that provides information
to your build. to your build.
* [`serviceAccountName`](#service-account) - Specifies a `ServiceAccount` - [`serviceAccountName`](#service-account) - Specifies a `ServiceAccount`
resource object that enables your build to run with the defined resource object that enables your build to run with the defined
authentication information. authentication information.
* [`volumes`](#volumes) - Specifies one or more volumes that you want to make - [`volumes`](#volumes) - Specifies one or more volumes that you want to make
available to your build. available to your build.
* [`timeout`](#timeout) - Specifies timeout after which the build will fail. - [`timeout`](#timeout) - Specifies timeout after which the build will fail.
[kubernetes-overview]: https://kubernetes.io/docs/concepts/overview/working-with-objects/kubernetes-objects/#required-fields [kubernetes-overview]: https://kubernetes.io/docs/concepts/overview/working-with-objects/kubernetes-objects/#required-fields
@ -94,15 +94,14 @@ Each `steps` in a build must specify a `Builder`, or type of container image tha
adheres to the [Knative builder contract](./builder-contract.md). For each of adheres to the [Knative builder contract](./builder-contract.md). For each of
the `steps` fields, or container images that you define: the `steps` fields, or container images that you define:
* The `Builder`-type container images are run and evaluated in order, starting - The `Builder`-type container images are run and evaluated in order, starting
from the top of the configuration file. from the top of the configuration file.
* Each container image runs until completion or until the first failure is - Each container image runs until completion or until the first failure is
detected. detected.
For details about how to ensure that you implement each step to align with the For details about how to ensure that you implement each step to align with the
"builder contract", see the [`Builder`](./builder-contract.md) reference topic. "builder contract", see the [`Builder`](./builder-contract.md) reference topic.
#### Template #### Template
The `template` field is a required if no `steps` are defined. Specifies a The `template` field is a required if no `steps` are defined. Specifies a
@ -112,7 +111,6 @@ repeatable or sharable build `steps`.
For examples and more information about build templates, see the For examples and more information about build templates, see the
[`BuildTemplate`](./build-templates.md) reference topic. [`BuildTemplate`](./build-templates.md) reference topic.
#### Source #### Source
Optional. Specifies a container image. Use the `source` field to provide your Optional. Specifies a container image. Use the `source` field to provide your
@ -123,15 +121,14 @@ to all `steps` of your build.
The currently supported types of sources include: The currently supported types of sources include:
* `git` - A Git based repository. Specify the `url` field to define the - `git` - A Git based repository. Specify the `url` field to define the
location of the container image. Specify a `revision` field to define a location of the container image. Specify a `revision` field to define a
branch name, tag name, commit SHA, or any ref. [Learn more about revisions in branch name, tag name, commit SHA, or any ref. [Learn more about revisions in
Git](https://git-scm.com/docs/gitrevisions#_specifying_revisions). Git](https://git-scm.com/docs/gitrevisions#_specifying_revisions).
* `gcs` - An archive that is located in Google Cloud Storage. - `gcs` - An archive that is located in Google Cloud Storage.
* `custom` - An arbitrary container image.
- `custom` - An arbitrary container image.
#### Service Account #### Service Account
@ -147,7 +144,6 @@ of the `Build` resource object.
For examples and more information about specifying service accounts, For examples and more information about specifying service accounts,
see the [`ServiceAccount`](./auth.md) reference topic. see the [`ServiceAccount`](./auth.md) reference topic.
#### Volumes #### Volumes
Optional. Specifies one or more Optional. Specifies one or more
@ -158,20 +154,20 @@ complement the volumes that are implicitly
For example, use volumes to accomplish one of the following common tasks: For example, use volumes to accomplish one of the following common tasks:
* [Mount a Kubernetes secret](./auth.md). - [Mount a Kubernetes secret](./auth.md).
* Create an `emptyDir` volume to act as a cache for use across multiple build - Create an `emptyDir` volume to act as a cache for use across multiple build
steps. Consider using a persistent volume for inter-build caching. steps. Consider using a persistent volume for inter-build caching.
* Mount a host's Docker socket to use a `Dockerfile` for container image - Mount a host's Docker socket to use a `Dockerfile` for container image
builds. builds.
#### Timeout #### Timeout
Optional. Specifies timeout for the build. Includes time required for allocating resources and execution of build. Optional. Specifies timeout for the build. Includes time required for allocating resources and execution of build.
* Defaults to 10 minutes. - Defaults to 10 minutes.
* Refer to [Go's ParseDuration documentation](https://golang.org/pkg/time/#ParseDuration) for expected format. - Refer to [Go's ParseDuration documentation](https://golang.org/pkg/time/#ParseDuration) for expected format.
### Examples ### Examples
@ -181,13 +177,13 @@ Tip: See the collection of simple
[test builds](https://github.com/knative/build/tree/master/test) for [test builds](https://github.com/knative/build/tree/master/test) for
additional code samples, including working copies of the following snippets: additional code samples, including working copies of the following snippets:
* [`git` as `source`](#using-git) - [`git` as `source`](#using-git)
* [`gcs` as `source`](#using-gcs) - [`gcs` as `source`](#using-gcs)
* [`custom` as `source`](#using-custom) - [`custom` as `source`](#using-custom)
* [Mounting extra volumes](#using-an-extra-volume) - [Mounting extra volumes](#using-an-extra-volume)
* [Pushing an image](#using-steps-to-push-images) - [Pushing an image](#using-steps-to-push-images)
* [Authenticating with `ServiceAccount`](#using-a-serviceaccount) - [Authenticating with `ServiceAccount`](#using-a-serviceaccount)
* [Timeout](#using-timeout) - [Timeout](#using-timeout)
#### Using `git` #### Using `git`
@ -200,8 +196,8 @@ spec:
url: https://github.com/knative/build.git url: https://github.com/knative/build.git
revision: master revision: master
steps: steps:
- image: ubuntu - image: ubuntu
args: ["cat", "README.md"] args: ["cat", "README.md"]
``` ```
#### Using `gcs` #### Using `gcs`
@ -215,9 +211,9 @@ spec:
type: Archive type: Archive
location: gs://build-crd-tests/rules_docker-master.zip location: gs://build-crd-tests/rules_docker-master.zip
steps: steps:
- name: list-files - name: list-files
image: ubuntu:latest image: ubuntu:latest
args: ["ls"] args: ["ls"]
``` ```
#### Using `custom` #### Using `custom`
@ -231,8 +227,8 @@ spec:
image: gcr.io/cloud-builders/gsutil image: gcr.io/cloud-builders/gsutil
args: ["rsync", "gs://some-bucket", "."] args: ["rsync", "gs://some-bucket", "."]
steps: steps:
- image: ubuntu - image: ubuntu
args: ["cat", "README.md"] args: ["cat", "README.md"]
``` ```
#### Using an extra volume #### Using an extra volume
@ -242,22 +238,22 @@ Mounting multiple volumes:
```yaml ```yaml
spec: spec:
steps: steps:
- image: ubuntu - image: ubuntu
entrypoint: ["bash"] entrypoint: ["bash"]
args: ["-c", "curl https://foo.com > /var/my-volume"] args: ["-c", "curl https://foo.com > /var/my-volume"]
volumeMounts: volumeMounts:
- name: my-volume - name: my-volume
mountPath: /var/my-volume mountPath: /var/my-volume
- image: ubuntu - image: ubuntu
args: ["cat", "/etc/my-volume"] args: ["cat", "/etc/my-volume"]
volumeMounts: volumeMounts:
- name: my-volume - name: my-volume
mountPath: /etc/my-volume mountPath: /etc/my-volume
volumes: volumes:
- name: my-volume - name: my-volume
emptyDir: {} emptyDir: {}
``` ```
#### Using `steps` to push images #### Using `steps` to push images
@ -267,17 +263,17 @@ Defining a `steps` to push a container image to a repository.
```yaml ```yaml
spec: spec:
parameters: parameters:
- name: IMAGE - name: IMAGE
description: The name of the image to push description: The name of the image to push
- name: DOCKERFILE - name: DOCKERFILE
description: Path to the Dockerfile to build. description: Path to the Dockerfile to build.
default: /workspace/Dockerfile default: /workspace/Dockerfile
steps: steps:
- name: build-and-push - name: build-and-push
image: gcr.io/kaniko-project/executor image: gcr.io/kaniko-project/executor
args: args:
- --dockerfile=${DOCKERFILE} - --dockerfile=${DOCKERFILE}
- --destination=${IMAGE} - --destination=${IMAGE}
``` ```
#### Using a `ServiceAccount` #### Using a `ServiceAccount`
@ -299,10 +295,10 @@ spec:
revision: master revision: master
steps: steps:
- name: config - name: config
image: ubuntu image: ubuntu
command: ["/bin/bash"] command: ["/bin/bash"]
args: ["-c", "cat README.md"] args: ["-c", "cat README.md"]
``` ```
Where `serviceAccountName: test-build-robot-git-ssh` references the following Where `serviceAccountName: test-build-robot-git-ssh` references the following
@ -314,7 +310,7 @@ kind: ServiceAccount
metadata: metadata:
name: test-build-robot-git-ssh name: test-build-robot-git-ssh
secrets: secrets:
- name: test-git-ssh - name: test-git-ssh
``` ```
And `name: test-git-ssh`, references the following `Secret`: And `name: test-git-ssh`, references the following `Secret`:
@ -352,8 +348,8 @@ spec:
url: https://github.com/knative/build.git url: https://github.com/knative/build.git
revision: master revision: master
steps: steps:
- image: ubuntu - image: ubuntu
args: ["cat", "README.md"] args: ["cat", "README.md"]
``` ```
--- ---

View File

@ -7,7 +7,7 @@ deploy that build to Knative, and then test that the build completes.
The following demonstrates the process of deploying and then testing that The following demonstrates the process of deploying and then testing that
the build completed successfully. This sample build uses a hello-world-type app the build completed successfully. This sample build uses a hello-world-type app
that uses [busybox](https://docs.docker.com/samples/library/busybox/) to simply that uses [busybox](https://docs.docker.com/samples/library/busybox/) to simply
print "*hello build*". print "_hello build_".
Tip: See the Tip: See the
[build code samples](builds.md#get-started-with-knative-build-samples) [build code samples](builds.md#get-started-with-knative-build-samples)
@ -19,10 +19,10 @@ images, authentication, and include multiple steps.
Before you can run a Knative Build, you must have Knative installed in your Before you can run a Knative Build, you must have Knative installed in your
Kubernetes cluster, and it must include the Knative Build component: Kubernetes cluster, and it must include the Knative Build component:
* For details about installing a new instance of Knative in your Kubernetes - For details about installing a new instance of Knative in your Kubernetes
cluster, see [Installing Knative](../install/README.md). cluster, see [Installing Knative](../install/README.md).
* If you have a component of Knative installed and running, you must [ensure - If you have a component of Knative installed and running, you must [ensure
that the Knative Build component is also installed](installing-build-component.md). that the Knative Build component is also installed](installing-build-component.md).
## Creating and running a build ## Creating and running a build
@ -31,92 +31,95 @@ Kubernetes cluster, and it must include the Knative Build component:
code. code.
This `Build` resource definition includes a single "[step](builds.md#steps)" This `Build` resource definition includes a single "[step](builds.md#steps)"
that performs the task of simply printing "*hello build*": that performs the task of simply printing "_hello build_":
```yaml ```yaml
apiVersion: build.knative.dev/v1alpha1 apiVersion: build.knative.dev/v1alpha1
kind: Build kind: Build
metadata: metadata:
name: hello-build name: hello-build
spec: spec:
steps: steps:
- name: hello - name: hello
image: busybox image: busybox
args: ['echo', 'hello', 'build'] args: ["echo", "hello", "build"]
``` ```
Notice that this definition specifies `kind` as a `Build`, and that Notice that this definition specifies `kind` as a `Build`, and that
the name of this `Build` resource is `hello-build`. the name of this `Build` resource is `hello-build`.
For more information about defining build configuration files, See the For more information about defining build configuration files, See the
[`Build` reference topic](builds.md). [`Build` reference topic](builds.md).
1. Deploy the `build.yaml` configuration file and run the `hello-build` build on 1. Deploy the `build.yaml` configuration file and run the `hello-build` build on
Knative by running the Knative by running the
[`kubectl apply`](https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands#apply) [`kubectl apply`](https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands#apply)
command: command:
```shell ```shell
kubectl apply --filename build.yaml kubectl apply --filename build.yaml
``` ```
Response: Response:
```shell
build "hello-build" created ```shell
``` build "hello-build" created
```
1. Verify that the `hello-build` build resource has been created by running the 1. Verify that the `hello-build` build resource has been created by running the
[`kubectl get`](https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands#get) [`kubectl get`](https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands#get)
command: command:
```shell ```shell
kubectl get builds kubectl get builds
``` ```
Response: Response:
```shell
NAME AGE ```shell
hello-build 4s NAME AGE
``` hello-build 4s
```
1. After the build is created, you can run the following 1. After the build is created, you can run the following
[`kubectl get`](https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands#get) [`kubectl get`](https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands#get)
command to retrieve details about the `hello-build` build, specifically, in command to retrieve details about the `hello-build` build, specifically, in
which cluster and pod the build is running: which cluster and pod the build is running:
```shell ```shell
kubectl get build hello-build --output yaml kubectl get build hello-build --output yaml
``` ```
Response: Response:
```shell
apiVersion: build.knative.dev/v1alpha1
kind: Build
... ```shell
apiVersion: build.knative.dev/v1alpha1
kind: Build
status: ...
builder: Cluster
cluster:
namespace: default
podName: hello-build-jx4ql
conditions:
- state: Complete
status: "True"
stepStates:
- terminated:
reason: Completed
- terminated:
reason: Completed
```
Notice that the values of `completed` indicate that the build was status:
successful, and that `hello-build-jx4ql` is the pod where the build ran. builder: Cluster
cluster:
namespace: default
podName: hello-build-jx4ql
conditions:
- state: Complete
status: "True"
stepStates:
- terminated:
reason: Completed
- terminated:
reason: Completed
```
Tip: You can also retrieve the `podName` by running the following command: Notice that the values of `completed` indicate that the build was
successful, and that `hello-build-jx4ql` is the pod where the build ran.
```shell Tip: You can also retrieve the `podName` by running the following command:
kubectl get build hello-build --output jsonpath={.status.cluster.podName}
``` ```shell
kubectl get build hello-build --output jsonpath={.status.cluster.podName}
```
1. Optional: Run the following 1. Optional: Run the following
[`kubectl get`](https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands#get) [`kubectl get`](https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands#get)
@ -124,41 +127,43 @@ Kubernetes cluster, and it must include the Knative Build component:
the name of the the name of the
[Init container](https://kubernetes.io/docs/concepts/workloads/pods/init-containers/): [Init container](https://kubernetes.io/docs/concepts/workloads/pods/init-containers/):
```shell ```shell
kubectl get pod hello-build-[ID] --output yaml kubectl get pod hello-build-[ID] --output yaml
``` ```
where `[ID]` is the suffix of your pod name, for example
`hello-build-jx4ql`.
The response of this command includes a lot of detail, as well as where `[ID]` is the suffix of your pod name, for example
the `build-step-hello` name of the Init container. `hello-build-jx4ql`.
Tip: The name of the Init container is determined by the `name` that is The response of this command includes a lot of detail, as well as
specified in the `steps` field of the build configuration file, for the `build-step-hello` name of the Init container.
example `build-step-[ID]`.
Tip: The name of the Init container is determined by the `name` that is
specified in the `steps` field of the build configuration file, for
example `build-step-[ID]`.
1. To verify that your build performed the single task of printing 1. To verify that your build performed the single task of printing
"*hello build*", you can run the "_hello build_", you can run the
[`kubectl logs`](https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands#logs) [`kubectl logs`](https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands#logs)
command to retrieve the log files from the `build-step-hello` Init container command to retrieve the log files from the `build-step-hello` Init container
in the `hello-build-[ID]` pod: in the `hello-build-[ID]` pod:
```shell ```shell
kubectl logs $(kubectl get build hello-build --output jsonpath={.status.cluster.podName}) --container build-step-hello kubectl logs $(kubectl get build hello-build --output jsonpath={.status.cluster.podName}) --container build-step-hello
``` ```
Response: Response:
```shell
hello build ```shell
``` hello build
```
### Learn more ### Learn more
To learn more about the objects and commands used in this topic, see: To learn more about the objects and commands used in this topic, see:
* [Knative `Build` resources](builds.md) - [Knative `Build` resources](builds.md)
* [Kubernetes Init containers](https://kubernetes.io/docs/concepts/workloads/pods/init-containers/) - [Kubernetes Init containers](https://kubernetes.io/docs/concepts/workloads/pods/init-containers/)
* [Kubernetes kubectl CLI](https://kubernetes.io/docs/reference/kubectl/kubectl/) - [Kubernetes kubectl CLI](https://kubernetes.io/docs/reference/kubectl/kubectl/)
For information about contributing to the Knative Build project, see the For information about contributing to the Knative Build project, see the
[Knative Build code repo](https://github.com/knative/build/). [Knative Build code repo](https://github.com/knative/build/).

View File

@ -21,20 +21,21 @@ To add only the Knative Build component to an existing installation:
[`kubectl apply`](https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands#apply) [`kubectl apply`](https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands#apply)
command to install command to install
[Knative Build](https://github.com/knative/build) and its dependencies: [Knative Build](https://github.com/knative/build) and its dependencies:
```bash ```bash
kubectl apply --filename https://storage.googleapis.com/knative-releases/build/latest/release.yaml kubectl apply --filename https://storage.googleapis.com/knative-releases/build/latest/release.yaml
``` ```
1. Run the 1. Run the
[`kubectl get`](https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands#get) [`kubectl get`](https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands#get)
command to monitor the Knative Build components until all of the components command to monitor the Knative Build components until all of the components
show a `STATUS` of `Running`: show a `STATUS` of `Running`:
```bash
kubectl get pods --namespace knative-build
```
Tip: Instead of running the `kubectl get` command multiple times, you can ```bash
append the `--watch` flag to view the component's status updates in real kubectl get pods --namespace knative-build
time. Use CTRL + C to exit watch mode. ```
Tip: Instead of running the `kubectl get` command multiple times, you can
append the `--watch` flag to view the component's status updates in real
time. Use CTRL + C to exit watch mode.
You are now ready to create and run Knative Builds, see You are now ready to create and run Knative Builds, see
[Creating a simple Knative Build](../build/creating-builds.md) to get started. [Creating a simple Knative Build](../build/creating-builds.md) to get started.

View File

@ -1,14 +1,13 @@
# Knative Personas # Knative Personas
When discussing user actions, it is often helpful to [define specific When discussing user actions, it is often helpful to [define specific
user roles](https://en.wikipedia.org/wiki/Persona_(user_experience)) who user roles](<https://en.wikipedia.org/wiki/Persona_(user_experience)>) who
might want to do the action. might want to do the action.
## Knative Build ## Knative Build
We expect the build components of Knative to be useful on their own, We expect the build components of Knative to be useful on their own,
as well as in conjunction with the compute components. as well as in conjunction with the compute components.
### Developer ### Developer
@ -19,8 +18,9 @@ tooling for managing dependencies and even detecting language and
runtime dependencies. runtime dependencies.
User stories: User stories:
* Start a build
* Read build logs - Start a build
- Read build logs
### Language operator / contributor ### Language operator / contributor
@ -30,9 +30,9 @@ within a particular organization, or on behalf of a particular
language runtime. language runtime.
User stories: User stories:
* Create a build image / build pack
* Enable build signing / provenance
- Create a build image / build pack
- Enable build signing / provenance
## Contributors ## Contributors
@ -41,17 +41,19 @@ always consider how infrastructure changes encourage and enable
contributors to the project, as well as the impact on users. contributors to the project, as well as the impact on users.
Types of users: Types of users:
* Hobbyist or newcomer
* Motivated user - Hobbyist or newcomer
* Corporate (employed) maintainer - Motivated user
* Consultant - Corporate (employed) maintainer
- Consultant
User stories: User stories:
* Check out the code
* Build and run the code - Check out the code
* Run tests - Build and run the code
* View test status - Run tests
* Run performance tests - View test status
- Run performance tests
--- ---

View File

@ -14,22 +14,22 @@ race, religion, or sexual identity and orientation.
Examples of behavior that contributes to creating a positive environment Examples of behavior that contributes to creating a positive environment
include: include:
* Using welcoming and inclusive language - Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences - Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism - Gracefully accepting constructive criticism
* Focusing on what is best for the community - Focusing on what is best for the community
* Showing empathy towards other community members - Showing empathy towards other community members
Examples of unacceptable behavior by participants include: Examples of unacceptable behavior by participants include:
* The use of sexualized language or imagery and unwelcome sexual attention or - The use of sexualized language or imagery and unwelcome sexual attention or
advances advances
* Trolling, insulting/derogatory comments, and personal or political attacks - Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment - Public or private harassment
* Publishing others' private information, such as a physical or electronic - Publishing others' private information, such as a physical or electronic
address, without explicit permission address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a - Other conduct which could reasonably be considered inappropriate in a
professional setting professional setting
## Our Responsibilities ## Our Responsibilities

View File

@ -7,15 +7,15 @@ repositories go through. All changes, regardless of whether they are from
newcomers to the community or from the core team follow the same process and newcomers to the community or from the core team follow the same process and
are given the same level of review. are given the same level of review.
* [Working groups](#working-groups) - [Working groups](#working-groups)
* [Code of conduct](#code-of-conduct) - [Code of conduct](#code-of-conduct)
* [Team values](#team-values) - [Team values](#team-values)
* [Contributor license agreements](#contributor-license-agreements) - [Contributor license agreements](#contributor-license-agreements)
* [Design documents](#design-documents) - [Design documents](#design-documents)
* [Contributing a feature](#contributing-a-feature) - [Contributing a feature](#contributing-a-feature)
* [Setting up to contribute to Knative](#setting-up-to-contribute-to-knative) - [Setting up to contribute to Knative](#setting-up-to-contribute-to-knative)
* [Pull requests](#pull-requests) - [Pull requests](#pull-requests)
* [Issues](#issues) - [Issues](#issues)
## Working groups ## Working groups
@ -74,40 +74,40 @@ later join knative-dev if you want immediate access).
In order to contribute a feature to Knative you'll need to go through the In order to contribute a feature to Knative you'll need to go through the
following steps: following steps:
* Discuss your idea with the appropriate [working groups](WORKING-GROUPS.md) - Discuss your idea with the appropriate [working groups](WORKING-GROUPS.md)
on the working group's mailing list. on the working group's mailing list.
* Once there is general agreement that the feature is useful, [create a GitHub - Once there is general agreement that the feature is useful, [create a GitHub
issue](https://github.com/knative/docs/issues/new) to track the discussion. issue](https://github.com/knative/docs/issues/new) to track the discussion.
The issue should include information about the requirements and use cases The issue should include information about the requirements and use cases
that it is trying to address. Include a discussion of the proposed design that it is trying to address. Include a discussion of the proposed design
and technical details of the implementation in the issue. and technical details of the implementation in the issue.
* If the feature is substantial enough: - If the feature is substantial enough:
* Working group leads will ask for a design document as outlined in - Working group leads will ask for a design document as outlined in
[design documents](#design-documents). Create the design document and [design documents](#design-documents). Create the design document and
add a link to it in the GitHub issue. Don't forget to send a note to the add a link to it in the GitHub issue. Don't forget to send a note to the
working group to let everyone know your document is ready for review. working group to let everyone know your document is ready for review.
* Depending on the breadth of the design and how contentious it is, the - Depending on the breadth of the design and how contentious it is, the
working group leads may decide the feature needs to be discussed in one working group leads may decide the feature needs to be discussed in one
or more working group meetings before being approved. or more working group meetings before being approved.
* Once the major technical issues are resolved and agreed upon, post a - Once the major technical issues are resolved and agreed upon, post a
note with the design decision and the general execution plan to the note with the design decision and the general execution plan to the
working group's mailing list and on the feature's issue. working group's mailing list and on the feature's issue.
* Submit PRs to [knative/serving](https://github.com/knative/serving/pulls) - Submit PRs to [knative/serving](https://github.com/knative/serving/pulls)
with your code changes. with your code changes.
* Submit PRs to knative/serving with user documentation for your feature, - Submit PRs to knative/serving with user documentation for your feature,
including usage examples when possible. Add documentation to including usage examples when possible. Add documentation to
[knative/docs/serving](https://github.com/knative/docs/tree/master/serving). [knative/docs/serving](https://github.com/knative/docs/tree/master/serving).
*Note that we prefer bite-sized PRs instead of giant monster PRs. It's therefore _Note that we prefer bite-sized PRs instead of giant monster PRs. It's therefore
preferable if you can introduce large features in small, individually-reviewable preferable if you can introduce large features in small, individually-reviewable
PRs that build on top of one another.* PRs that build on top of one another._
If you would like to skip the process of submitting an issue and instead would If you would like to skip the process of submitting an issue and instead would
prefer to just submit a pull request with your desired code changes then that's prefer to just submit a pull request with your desired code changes then that's
@ -135,14 +135,14 @@ active, and hopefully prevents duplicated efforts.
To submit a proposed change: To submit a proposed change:
* Fork the affected repository. - Fork the affected repository.
* Create a new branch for your changes. - Create a new branch for your changes.
* Develop the code/fix. - Develop the code/fix.
* Add new test cases. In the case of a bug fix, the tests should fail without - Add new test cases. In the case of a bug fix, the tests should fail without
your code changes. For new features try to cover as many variants as your code changes. For new features try to cover as many variants as
reasonably possible. reasonably possible.
* Modify the documentation as necessary. - Modify the documentation as necessary.
* Verify all CI status checks pass, and work to make them pass if failing. - Verify all CI status checks pass, and work to make them pass if failing.
The general rule is that all PRs should be 100% complete - meaning they should The general rule is that all PRs should be 100% complete - meaning they should
include all test cases and documentation changes related to the change. A include all test cases and documentation changes related to the change. A
@ -165,46 +165,50 @@ GitHub issues can be used to report bugs or submit feature requests.
When reporting a bug please include the following key pieces of information: When reporting a bug please include the following key pieces of information:
* The version of the project you were using (version number, git commit, etc) - The version of the project you were using (version number, git commit, etc)
* Operating system you are using - Operating system you are using
* The exact, minimal, steps needed to reproduce the issue. Submitting a 5 line - The exact, minimal, steps needed to reproduce the issue. Submitting a 5 line
script will get a much faster response from the team than one that's script will get a much faster response from the team than one that's
hundreds of lines long. hundreds of lines long.
## Third-party code ## Third-party code
* All third-party code must be placed in `vendor/` or `third_party/` folders.
* `vendor/` folder is managed by [dep](https://github.com/golang/dep) and stores - All third-party code must be placed in `vendor/` or `third_party/` folders.
the source code of third-party Go dependencies. `vendor/` folder should not be - `vendor/` folder is managed by [dep](https://github.com/golang/dep) and stores
modified manually. the source code of third-party Go dependencies. `vendor/` folder should not be
* Other third-party code belongs in `third_party/` folder. modified manually.
* Third-party code must include licenses. - Other third-party code belongs in `third_party/` folder.
- Third-party code must include licenses.
A non-exclusive list of code that must be places in `vendor/` and `third_party/`: A non-exclusive list of code that must be places in `vendor/` and `third_party/`:
* Open source, free software, or commercially-licensed code.
* Tools or libraries or protocols that are open source, free software, or commercially licensed. - Open source, free software, or commercially-licensed code.
* Derivative works of third-party code. - Tools or libraries or protocols that are open source, free software, or commercially licensed.
* Excerpts from third-party code. - Derivative works of third-party code.
- Excerpts from third-party code.
### Adding a new third-party dependency to `third_party/` folder ### Adding a new third-party dependency to `third_party/` folder
* Create a sub-folder under `third_party/` for each component.
* In each sub-folder, make sure there is a file called LICENSE which contains the appropriate - Create a sub-folder under `third_party/` for each component.
license text for the dependency. If one doesn't exist then create it. More details on this below. - In each sub-folder, make sure there is a file called LICENSE which contains the appropriate
* Check in a pristine copy of the code with LICENSE and METADATA files. license text for the dependency. If one doesn't exist then create it. More details on this below.
You do not have to include unused files, and you can move or rename files if necessary, - Check in a pristine copy of the code with LICENSE and METADATA files.
but do not modify the contents of any files yet. You do not have to include unused files, and you can move or rename files if necessary,
* Once the pristine copy is merged into master, you may modify the code. but do not modify the contents of any files yet.
- Once the pristine copy is merged into master, you may modify the code.
### LICENSE ### LICENSE
The license for the code must be in a file named LICENSE. If it was distributed like that, The license for the code must be in a file named LICENSE. If it was distributed like that,
you're good. If not, you need to make LICENSE be a file containing the full text of the license. you're good. If not, you need to make LICENSE be a file containing the full text of the license.
If there's another file in the distribution with the license in it, rename it to LICENSE If there's another file in the distribution with the license in it, rename it to LICENSE
(e.g., rename a LICENSE.txt or COPYING file to LICENSE). If the license is only available in (e.g., rename a LICENSE.txt or COPYING file to LICENSE). If the license is only available in
the comments or at a URL, extract and copy the text of the license into LICENSE. the comments or at a URL, extract and copy the text of the license into LICENSE.
You may optionally document the generation of the LICENSE file in the local_modifications You may optionally document the generation of the LICENSE file in the local_modifications
field of the METADATA file. field of the METADATA file.
If there are multiple licenses for the code, put the text of all the licenses into LICENSE If there are multiple licenses for the code, put the text of all the licenses into LICENSE
along with separators and comments as to the applications. along with separators and comments as to the applications.
--- ---

View File

@ -1,6 +1,6 @@
# Knative Community # Knative Community
*Important*. Before proceeding, please review the Knative community [Code of _Important_. Before proceeding, please review the Knative community [Code of
Conduct](CODE-OF-CONDUCT.md). Conduct](CODE-OF-CONDUCT.md).
If you any have questions or concerns, please contact the authors at If you any have questions or concerns, please contact the authors at
@ -13,29 +13,29 @@ Welcome to the Knative community!
This is the starting point for becoming a contributor - improving code, This is the starting point for becoming a contributor - improving code,
improving docs, giving talks, etc. improving docs, giving talks, etc.
* [Introduction](#introduction) - [Introduction](#introduction)
* [Knative authors](#knative-authors) - [Knative authors](#knative-authors)
* [Meetings and work groups](#meetings-and-work-groups) - [Meetings and work groups](#meetings-and-work-groups)
* [How can I help?](#how-can-i-help) - [How can I help?](#how-can-i-help)
* [Questions and issues](#questions-and-issues) - [Questions and issues](#questions-and-issues)
Other Documents Other Documents
* [Code of Conduct](CODE-OF-CONDUCT.md) - all contributors must abide by the - [Code of Conduct](CODE-OF-CONDUCT.md) - all contributors must abide by the
code of conduct code of conduct
* [Contributing to Knative](CONTRIBUTING.md) - guidelines and advice on - [Contributing to Knative](CONTRIBUTING.md) - guidelines and advice on
becoming a contributor becoming a contributor
* [Working Groups](WORKING-GROUPS.md) - describes our various working groups - [Working Groups](WORKING-GROUPS.md) - describes our various working groups
* [Working Group Processes](WORKING-GROUP-PROCESSES.md) - describes how - [Working Group Processes](WORKING-GROUP-PROCESSES.md) - describes how
working groups operate working groups operate
* [Technical Oversight Committee](TECH-OVERSIGHT-COMMITTEE.md) - describes our - [Technical Oversight Committee](TECH-OVERSIGHT-COMMITTEE.md) - describes our
technical oversight committee technical oversight committee
* [Steering Committee](STEERING-COMMITTEE.md) - describes our steering - [Steering Committee](STEERING-COMMITTEE.md) - describes our steering
committee committee
* [Community Roles](ROLES.md) - describes the roles individuals can assume - [Community Roles](ROLES.md) - describes the roles individuals can assume
within the Knative community within the Knative community
* [Reviewing and Merging Pull Requests](REVIEWING.md) - how we manage pull - [Reviewing and Merging Pull Requests](REVIEWING.md) - how we manage pull
requests requests
## Introduction ## Introduction
@ -44,7 +44,7 @@ See [Knative docs](https://github.com/knative/docs) for in-depth information abo
## Knative authors ## Knative authors
Knative is an open source project with an active development community. Knative is an open source project with an active development community.
The project was started by Google but has contributions from a growing number of The project was started by Google but has contributions from a growing number of
industry-leading companies. For a current list of the authors, see [Authors](https://github.com/knative/serving/blob/master/AUTHORS). industry-leading companies. For a current list of the authors, see [Authors](https://github.com/knative/serving/blob/master/AUTHORS).
@ -61,8 +61,8 @@ monitoring the overall project.
If you're looking for something to do to get your feet wet working on Knative, If you're looking for something to do to get your feet wet working on Knative,
look for GitHub issues marked with the Help Wanted label: look for GitHub issues marked with the Help Wanted label:
* [Serving issues](https://github.com/knative/serving/issues?q=is%3Aopen+is%3Aissue+label%3A%22community%2Fhelp+wanted%22) - [Serving issues](https://github.com/knative/serving/issues?q=is%3Aopen+is%3Aissue+label%3A%22community%2Fhelp+wanted%22)
* [Documentation repo](https://github.com/knative/docs/issues?q=is%3Aopen+is%3Aissue+label%3A%22community%2Fhelp+wanted%22) - [Documentation repo](https://github.com/knative/docs/issues?q=is%3Aopen+is%3Aissue+label%3A%22community%2Fhelp+wanted%22)
Even if there's not an issue opened for it, we can always use more Even if there's not an issue opened for it, we can always use more
testing throughout the platform. Similarly, we can always use more docs, richer testing throughout the platform. Similarly, we can always use more docs, richer
@ -74,8 +74,8 @@ we could use your help in spiffing up our public-facing web site.
If you're a developer, operator, or contributor trying to use Knative, the If you're a developer, operator, or contributor trying to use Knative, the
following resources are available for you: following resources are available for you:
* [Knative Users](https://groups.google.com/forum/#!forum/knative-users) - [Knative Users](https://groups.google.com/forum/#!forum/knative-users)
* [Knative Developers](https://groups.google.com/forum/#!forum/knative-dev) - [Knative Developers](https://groups.google.com/forum/#!forum/knative-dev)
For contributors to Knative, we also have [Knative Slack](SLACK-GUIDELINES.md). For contributors to Knative, we also have [Knative Slack](SLACK-GUIDELINES.md).

View File

@ -7,13 +7,13 @@ in turn produces high quality software.
This document provides guidelines for how the project's This document provides guidelines for how the project's
[Members](ROLES.md#member) review issues and merge pull requests (PRs). [Members](ROLES.md#member) review issues and merge pull requests (PRs).
* [Pull requests welcome](#pull-requests-welcome) - [Pull requests welcome](#pull-requests-welcome)
* [Code of Conduct](#code-of-conduct) - [Code of Conduct](#code-of-conduct)
* [Code reviewers](#code-reviewers) - [Code reviewers](#code-reviewers)
* [Reviewing changes](#reviewing-changes) - [Reviewing changes](#reviewing-changes)
* [Holds](#holds) - [Holds](#holds)
* [Approvers](#approvers) - [Approvers](#approvers)
* [Merging PRs](#merging-prs) - [Merging PRs](#merging-prs)
## Pull requests welcome ## Pull requests welcome
@ -55,9 +55,9 @@ are not in favor of the change. If a PR gets a "request changes" vote, the
group discusses the issue to resolve their differences. group discusses the issue to resolve their differences.
Reviewers are expected to respond in a timely fashion to PRs that are assigned Reviewers are expected to respond in a timely fashion to PRs that are assigned
to them. Reviewers are expected to respond to *active* PRs with reasonable to them. Reviewers are expected to respond to _active_ PRs with reasonable
latency. If reviewers fail to respond, those PRs may be assigned to other latency. If reviewers fail to respond, those PRs may be assigned to other
reviewers. *Active* PRs are those that have a proper CLA (`cla:yes`) label, are reviewers. _Active_ PRs are those that have a proper CLA (`cla:yes`) label, are
not works in progress (WIP), are passing tests, and do not need rebase to be not works in progress (WIP), are passing tests, and do not need rebase to be
merged. PRs that do not have a proper CLA, are WIP, do not pass tests, or merged. PRs that do not have a proper CLA, are WIP, do not pass tests, or
require a rebase are not considered active PRs. require a rebase are not considered active PRs.

View File

@ -4,21 +4,21 @@ This document describes the set of roles individuals may have within the Knative
community, the requirements of each role, and the privileges that each role community, the requirements of each role, and the privileges that each role
grants. grants.
* [Role Summary](#role-summary) - [Role Summary](#role-summary)
* [Collaborator](#collaborator) - [Collaborator](#collaborator)
* [Member](#member) - [Member](#member)
* [Approver](#approver) - [Approver](#approver)
* [Lead](#lead) - [Lead](#lead)
* [Administrator](#administrator) - [Administrator](#administrator)
## Role Summary ## Role Summary
The following table lists the roles we use within the Knative community. The The following table lists the roles we use within the Knative community. The
table describes: table describes:
* General responsibilities expected by individuals in each role - General responsibilities expected by individuals in each role
* Requirements necessary to join or stay in a given role - Requirements necessary to join or stay in a given role
* How the role manifests in terms of permissions and privileges. - How the role manifests in terms of permissions and privileges.
<table> <table>
<thead> <thead>
@ -112,12 +112,12 @@ the PR bot.
### Requirements ### Requirements
* Working on some contribution to the project that would benefit from the - Working on some contribution to the project that would benefit from the
ability to have PRs or Issues to be assigned to the contributor ability to have PRs or Issues to be assigned to the contributor
* Join [knative-users@](https://groups.google.com/forum/#!forum/knative-users) - Join [knative-users@](https://groups.google.com/forum/#!forum/knative-users)
unrestricted join permissions; this grants read access to documents in the unrestricted join permissions; this grants read access to documents in the
Team Drive Team Drive
## Member ## Member
@ -139,36 +139,36 @@ this is not a requirement.
### Requirements ### Requirements
* Has made multiple contributions to the project or community. Contributions - Has made multiple contributions to the project or community. Contributions
may include, but are not limited to: may include, but are not limited to:
* Authoring or reviewing PRs on GitHub - Authoring or reviewing PRs on GitHub
* Filing or commenting on issues on GitHub - Filing or commenting on issues on GitHub
* Contributing to working group or community discussions - Contributing to working group or community discussions
* Subscribed to - Subscribed to
[knative-dev@googlegroups.com](https://groups.google.com/forum/#!forum/knative-dev) [knative-dev@googlegroups.com](https://groups.google.com/forum/#!forum/knative-dev)
* Actively contributing to 1 or more areas. - Actively contributing to 1 or more areas.
* Sponsored by 1 approver. - Sponsored by 1 approver.
* Done by adding GitHub user to Knative organization - Done by adding GitHub user to Knative organization
### Responsibilities and privileges ### Responsibilities and privileges
* Responsive to issues and PRs assigned to them - Responsive to issues and PRs assigned to them
* Active owner of code they have contributed (unless ownership is explicitly - Active owner of code they have contributed (unless ownership is explicitly
transferred) transferred)
* Code is well tested - Code is well tested
* Tests consistently pass - Tests consistently pass
* Addresses bugs or issues discovered after code is accepted - Addresses bugs or issues discovered after code is accepted
Members who frequently contribute code are expected to proactively perform code Members who frequently contribute code are expected to proactively perform code
reviews and work towards becoming an approver for the area that they are active reviews and work towards becoming an approver for the area that they are active
@ -188,40 +188,40 @@ status is scoped to a part of the codebase.
The following apply to the part of the codebase for which one would be an The following apply to the part of the codebase for which one would be an
approver in an OWNERS file: approver in an OWNERS file:
* Reviewer of the codebase for at least 3 months or 50% of project lifetime, - Reviewer of the codebase for at least 3 months or 50% of project lifetime,
whichever is shorter whichever is shorter
* Primary reviewer for at least 10 substantial PRs to the codebase - Primary reviewer for at least 10 substantial PRs to the codebase
* Reviewed or merged at least 30 PRs to the codebase - Reviewed or merged at least 30 PRs to the codebase
* Nominated by an area lead - Nominated by an area lead
* With no objections from other leads - With no objections from other leads
* Done through PR to update an OWNERS file - Done through PR to update an OWNERS file
### Responsibilities and privileges ### Responsibilities and privileges
The following apply to the part of the codebase for which one would be an The following apply to the part of the codebase for which one would be an
approver in an OWNERS file: approver in an OWNERS file:
* Approver status may be a precondition to accepting large code contributions - Approver status may be a precondition to accepting large code contributions
* Demonstrate sound technical judgement - Demonstrate sound technical judgement
* Responsible for project quality control via [code reviews](REVIEWING.md) - Responsible for project quality control via [code reviews](REVIEWING.md)
* Focus on holistic acceptance of contribution such as dependencies with - Focus on holistic acceptance of contribution such as dependencies with
other features, backward / forward compatibility, API and flag other features, backward / forward compatibility, API and flag
definitions, etc definitions, etc
* Expected to be responsive to review requests as per [community - Expected to be responsive to review requests as per [community
expectations](REVIEWING.md) expectations](REVIEWING.md)
* Mentor members and contributors - Mentor members and contributors
* May approve code contributions for acceptance - May approve code contributions for acceptance
## Lead ## Lead
@ -233,53 +233,53 @@ and approve design decisions for their area of ownership.
Getting to be a lead of an existing working group: Getting to be a lead of an existing working group:
* Recognized as having expertise in the groups subject matter - Recognized as having expertise in the groups subject matter
* Approver for some part of the codebase for at least 3 months - Approver for some part of the codebase for at least 3 months
* Member for at least 1 year or 50% of project lifetime, whichever is shorter - Member for at least 1 year or 50% of project lifetime, whichever is shorter
* Primary reviewer for 20 substantial PRs - Primary reviewer for 20 substantial PRs
* Reviewed or merged at least 50 PRs - Reviewed or merged at least 50 PRs
* Sponsored by the technical oversight committee - Sponsored by the technical oversight committee
Additional requirements for leads of a new working group: Additional requirements for leads of a new working group:
* Originally authored or contributed major functionality to the group's area - Originally authored or contributed major functionality to the group's area
* An approver in the OWNERS file for the groups code - An approver in the OWNERS file for the groups code
### Responsibilities and privileges ### Responsibilities and privileges
The following apply to the area / component for which one would be an owner. The following apply to the area / component for which one would be an owner.
* Run their working group as explained in the [Working Group - Run their working group as explained in the [Working Group
Processes](WORKING-GROUP-PROCESSES.md). Processes](WORKING-GROUP-PROCESSES.md).
* Design/proposal approval authority over the area / component, though - Design/proposal approval authority over the area / component, though
escalation to the technical oversight committee is possible. escalation to the technical oversight committee is possible.
* Perform issue triage on GitHub. - Perform issue triage on GitHub.
* Apply/remove/create/delete GitHub labels and milestones - Apply/remove/create/delete GitHub labels and milestones
* Write access to repo (assign issues/PRs, add/remove labels and milestones, - Write access to repo (assign issues/PRs, add/remove labels and milestones,
edit issues and PRs, edit wiki, create/delete labels and milestones) edit issues and PRs, edit wiki, create/delete labels and milestones)
* Capable of directly applying lgtm + approve labels for any PR - Capable of directly applying lgtm + approve labels for any PR
* Expected to respect OWNERS files approvals and use [standard - Expected to respect OWNERS files approvals and use [standard
procedure for merging code](REVIEWING.md#merging-prs). procedure for merging code](REVIEWING.md#merging-prs).
* Expected to work to holistically maintain the health of the project through: - Expected to work to holistically maintain the health of the project through:
* Reviewing PRs - Reviewing PRs
* Fixing bugs - Fixing bugs
* Mentoring and guiding approvers, members, and contributors - Mentoring and guiding approvers, members, and contributors
## Administrator ## Administrator
@ -287,21 +287,21 @@ Administrators are responsible for the bureaucratic aspects of the project.
### Requirements ### Requirements
* Assigned by technical oversight committee. - Assigned by technical oversight committee.
### Responsibilities and privileges ### Responsibilities and privileges
* Manage the Knative GitHub repo, including granting membership and - Manage the Knative GitHub repo, including granting membership and
controlling repo read/write permissions controlling repo read/write permissions
* Manage the Knative Slack team - Manage the Knative Slack team
* Manage the Knative Google group forum - Manage the Knative Google group forum
* Manage any additional Knative technical collaboration assets - Manage any additional Knative technical collaboration assets
* Expected to be responsive to membership and permission change requests - Expected to be responsive to membership and permission change requests
<!-- TODO SLA for admin response --> <!-- TODO SLA for admin response -->
<!-- * TODO Manage the Google Search Console settings for knative.dev --> <!-- * TODO Manage the Google Search Console settings for knative.dev -->

View File

@ -1,31 +1,32 @@
# Slack Usage Guidelines # Slack Usage Guidelines
Slack is the main communication platform for Knative outside of our mailing Slack is the main communication platform for Knative outside of our mailing
lists. Its important that conversation stays on topic in each channel, and that lists. Its important that conversation stays on topic in each channel, and that
everyone abides by the Code of Conduct. Community members should all expect to everyone abides by the Code of Conduct. Community members should all expect to
have a positive experience. have a positive experience.
Chat is searchable and public. Do not make comments that you would not say on a Chat is searchable and public. Do not make comments that you would not say on a
video recording or in another public space. Please be courteous to others. video recording or in another public space. Please be courteous to others.
`@here` and `@channel` should be used rarely. Members will receive notifications `@here` and `@channel` should be used rarely. Members will receive notifications
from these commands and we are a global project - please be kind. from these commands and we are a global project - please be kind.
Note: `@all` is only to be used by admins. Note: `@all` is only to be used by admins.
You can join the [Knative Slack](https://slack.knative.dev) instance at You can join the [Knative Slack](https://slack.knative.dev) instance at
https://slack.knative.dev. https://slack.knative.dev.
## Code of Conduct ## Code of Conduct
The Knative [Code of Conduct](./CODE-OF-CONDUCT.md) applies throughout the
The Knative [Code of Conduct](./CODE-OF-CONDUCT.md) applies throughout the
project, and includes all communication mediums. project, and includes all communication mediums.
## Admins ## Admins
* @mchmarny - @mchmarny
* @isdal - @isdal
* @dewitt - @dewitt
Slack admins should make sure to mention this in the “What I do” section of Slack admins should make sure to mention this in the “What I do” section of
their Slack profile, as well as for which time zone. their Slack profile, as well as for which time zone.
To connect: please reach out in the #slack-admins channel, mention one of us To connect: please reach out in the #slack-admins channel, mention one of us
@ -34,16 +35,16 @@ of us privately.
### Admin Expectations and Guidelines ### Admin Expectations and Guidelines
* Adhere to Code of Conduct - Adhere to Code of Conduct
* Take care of spam as soon as possible, which may mean taking action by making - Take care of spam as soon as possible, which may mean taking action by making
members inactive members inactive
* Moderating and fostering a safe environment for conversations - Moderating and fostering a safe environment for conversations
* Bring Code of Conduct issues to the Steering Committee - Bring Code of Conduct issues to the Steering Committee
* Create relevant channels and list Code of Conduct in new channel welcome - Create relevant channels and list Code of Conduct in new channel welcome
message message
* Help troubleshoot Slack issues - Help troubleshoot Slack issues
* Review bot, token, and webhook requests - Review bot, token, and webhook requests
* Be helpful! - Be helpful!
## Creating Channels ## Creating Channels
@ -51,14 +52,14 @@ Please reach out to the #slack-admins group with your request to create a new
channel. channel.
Channels are dedicated to [Working Groups](./WORKING-GROUPS.md), sub-projects, Channels are dedicated to [Working Groups](./WORKING-GROUPS.md), sub-projects,
community topics, and related programs/projects. community topics, and related programs/projects.
Channels are not: Channels are not:
* company specific; e.g. a channel named for a cloud provider must be used for - company specific; e.g. a channel named for a cloud provider must be used for
conversation about Knative-related topics on that cloud, and not proprietary conversation about Knative-related topics on that cloud, and not proprietary
information of the provider. information of the provider.
* private unless there is an exception: code of conduct matters, mentoring, - private unless there is an exception: code of conduct matters, mentoring,
security/vulnerabilities, or steering committee. security/vulnerabilities, or steering committee.
All channels need a documented purpose. Use this space to welcome the targeted All channels need a documented purpose. Use this space to welcome the targeted
@ -80,16 +81,16 @@ and describe the situation.
## Bots, Tokens, and Webhooks ## Bots, Tokens, and Webhooks
Bots, tokens, and webhooks are reviewed on a case-by-case basis. Expect most Bots, tokens, and webhooks are reviewed on a case-by-case basis. Expect most
requests will be rejected due to security, privacy, and usability concerns. requests will be rejected due to security, privacy, and usability concerns.
Bots and the like tend to make a lot of noise in channels. Bots and the like tend to make a lot of noise in channels.
Please join #slack-admins and have a discussion about your request before Please join #slack-admins and have a discussion about your request before
requesting the access. requesting the access.
## Admin Moderation ## Admin Moderation
Be mindful of how you handle communication during stressful interactions. Be mindful of how you handle communication during stressful interactions.
Administrators act as direct representatives of the project, and need to Administrators act as direct representatives of the project, and need to
maintain a very high level of professionalism at all times. If you feel too maintain a very high level of professionalism at all times. If you feel too
involved in the situation to maintain impartiality or professionalism, thats a involved in the situation to maintain impartiality or professionalism, thats a
@ -100,19 +101,19 @@ chat. Please document these interactions for other Slack admins to review.
Content will be automatically removed if it violates code of conduct or is a Content will be automatically removed if it violates code of conduct or is a
sales pitch. Admins will take a screenshot of such behavior in order to document sales pitch. Admins will take a screenshot of such behavior in order to document
the situation. Google takes such violations extremely seriously, and the situation. Google takes such violations extremely seriously, and
they will be handled swiftly. they will be handled swiftly.
## Inactivating Accounts ## Inactivating Accounts
For reasons listed below, admins may inactivate individual Slack accounts. For reasons listed below, admins may inactivate individual Slack accounts.
Due to Slacks framework, it does not allow for an account to be banned or Due to Slacks framework, it does not allow for an account to be banned or
suspended in the traditional sense. suspended in the traditional sense.
[Read Slacks policy on this.](https://get.Slack.help/hc/en-us/articles/204475027-Deactivate-a-member-s-account) [Read Slacks policy on this.](https://get.Slack.help/hc/en-us/articles/204475027-Deactivate-a-member-s-account)
* Spreading spam content in DMs and/or channels - Spreading spam content in DMs and/or channels
* Not adhering to the code of conduct set forth in DMs and/or channels - Not adhering to the code of conduct set forth in DMs and/or channels
* Overtly selling products, related or unrelated to Knative - Overtly selling products, related or unrelated to Knative
## Specific Channel Rules ## Specific Channel Rules
@ -123,7 +124,7 @@ in the purpose or pinned docs of that channel.
Please do not engage in proprietary company specific conversations in the Knative Please do not engage in proprietary company specific conversations in the Knative
Slack instance. This is meant for conversations related to Knative open source Slack instance. This is meant for conversations related to Knative open source
topics and community. topics and community.
Proprietary conversations should occur in your company communication platforms. Proprietary conversations should occur in your company communication platforms.
As with all communication, please be mindful of appropriateness, professionalism, As with all communication, please be mindful of appropriateness, professionalism,

View File

@ -1,38 +1,38 @@
# Knative Steering Committee # Knative Steering Committee
The Knative Steering Committee (SC) defines, evolves, and defends the vision, The Knative Steering Committee (SC) defines, evolves, and defends the vision,
values, mission, and scope of the project. *The Steering Committee is a values, mission, and scope of the project. _The Steering Committee is a
work-in-progress.* work-in-progress._
* [Charter](#charter) - [Charter](#charter)
* [Committee Mechanics](#committee-mechanics) - [Committee Mechanics](#committee-mechanics)
* [Committee Members](#committee-members) - [Committee Members](#committee-members)
## Charter ## Charter
* Non-technical project oversight - Non-technical project oversight
* Define policy for the creation and administration of community groups, - Define policy for the creation and administration of community groups,
including [Working Groups](WORKING-GROUPS.md) and Committees. including [Working Groups](WORKING-GROUPS.md) and Committees.
* Define and evolve project governance structures and policies, including - Define and evolve project governance structures and policies, including
project role assignment and contributor promotion. project role assignment and contributor promotion.
* Approve members of the Tech Oversight Committee. - Approve members of the Tech Oversight Committee.
* Management of project assets - Management of project assets
* Control access to, establish processes regarding, and provide a final - Control access to, establish processes regarding, and provide a final
escalation path for any Knative repository. escalation path for any Knative repository.
* Guided by the TOC for normal business. - Guided by the TOC for normal business.
* Control and delegate access to and establish processes regarding other - Control and delegate access to and establish processes regarding other
project resources/assets not covered by the above, including web sites project resources/assets not covered by the above, including web sites
and their domains, blogs, social-media accounts, etc. and their domains, blogs, social-media accounts, etc.
* Manage the Knative brand to decide which things can be called “Knative” - Manage the Knative brand to decide which things can be called “Knative”
and how that mark can be used in relation to other efforts or vendors. and how that mark can be used in relation to other efforts or vendors.
## Committee Mechanics ## Committee Mechanics
@ -51,11 +51,11 @@ The members of the Steering Committee are shown below. Membership in the SC is
determined by current level of contribution to the project. Contribution is determined by current level of contribution to the project. Contribution is
periodically reviewed to ensure proper recognition. periodically reviewed to ensure proper recognition.
&nbsp; | Member | Company | Profile | &nbsp; | Member | Company | Profile |
-------------------------------------------------------- | -------------- | ------- | ------- | -------------------------------------------------------- | -------------- | ------- | ---------------------------------------- |
<img width="30px" src="https://github.com/dewitt.png"> | DeWitt Clinton | Google | [@dewitt](https://github.com/dewitt) | <img width="30px" src="https://github.com/dewitt.png"> | DeWitt Clinton | Google | [@dewitt](https://github.com/dewitt) |
<img width="30px" src="https://github.com/mchmarny.png"> | Mark Chmarny | Google | [@mchmarny](https://github.com/mchmarny) | <img width="30px" src="https://github.com/mchmarny.png"> | Mark Chmarny | Google | [@mchmarny](https://github.com/mchmarny) |
<img width="30px" src="https://github.com/isdal.png"> | Tomas Isdal | Google | [@isdal](https://github.com/isdal) | <img width="30px" src="https://github.com/isdal.png"> | Tomas Isdal | Google | [@isdal](https://github.com/isdal) |
--- ---

View File

@ -3,67 +3,67 @@
The Knative Technical Oversight Committee (TOC) is responsible for cross-cutting The Knative Technical Oversight Committee (TOC) is responsible for cross-cutting
product and design decisions. product and design decisions.
* [Charter](#charter) - [Charter](#charter)
* [Committee Mechanics](#committee-mechanics) - [Committee Mechanics](#committee-mechanics)
* [Committee Meeting](#committee-meeting) - [Committee Meeting](#committee-meeting)
* [Committee Members](#committee-members) - [Committee Members](#committee-members)
## Charter ## Charter
* Technical Project Oversight, Direction & Delivery - Technical Project Oversight, Direction & Delivery
* Set the overall technical direction and roadmap of the project. - Set the overall technical direction and roadmap of the project.
* Resolve technical issues, technical disagreements and escalations within - Resolve technical issues, technical disagreements and escalations within
the project. the project.
* Set the priorities of individual releases to ensure coherency and proper - Set the priorities of individual releases to ensure coherency and proper
sequencing. sequencing.
* Approve declaring a new long-term supported (LTS) Knative release. - Approve declaring a new long-term supported (LTS) Knative release.
* Approve the creation and dissolution of working groups and approve - Approve the creation and dissolution of working groups and approve
leadership changes of working groups. leadership changes of working groups.
* Create proposals based on TOC discussions and bring them to the relevant - Create proposals based on TOC discussions and bring them to the relevant
working groups for discussion. working groups for discussion.
* Approve the creation/deletion of GitHub repositories, along with other - Approve the creation/deletion of GitHub repositories, along with other
high-level administrative issues around GitHub and our other tools. high-level administrative issues around GitHub and our other tools.
* Happy Healthy Community - Happy Healthy Community
* Establish and maintain the overall technical governance guidelines for - Establish and maintain the overall technical governance guidelines for
the project. the project.
* Decide which sub-projects are part of the Knative project, including - Decide which sub-projects are part of the Knative project, including
accepting new sub-projects and pruning existing sub-projects to maintain accepting new sub-projects and pruning existing sub-projects to maintain
community focus community focus
* Ensure the team adheres to our [code of - Ensure the team adheres to our [code of
conduct](CONTRIBUTING.md#code-of-conduct) and respects our conduct](CONTRIBUTING.md#code-of-conduct) and respects our
[values](VALUES.md). [values](VALUES.md).
* Foster an environment for a healthy and happy community of developers - Foster an environment for a healthy and happy community of developers
and contributors. and contributors.
## Committee Mechanics ## Committee Mechanics
The TOCs work includes: The TOCs work includes:
* Regular committee meetings to discuss hot topics, resulting in a set of - Regular committee meetings to discuss hot topics, resulting in a set of
published [meeting published [meeting
notes](https://docs.google.com/document/d/1hR5ijJQjz65QkLrgEhWjv3Q86tWVxYj_9xdhQ6Y5D8Q/edit#). notes](https://docs.google.com/document/d/1hR5ijJQjz65QkLrgEhWjv3Q86tWVxYj_9xdhQ6Y5D8Q/edit#).
* Create, review, approve and publish technical project governance documents. - Create, review, approve and publish technical project governance documents.
* Create proposals for consideration by individual working groups to help - Create proposals for consideration by individual working groups to help
steer their work towards a common project-wide objective. steer their work towards a common project-wide objective.
* Review/address/comment on project issues. - Review/address/comment on project issues.
* Act as a high-level sounding board for technical questions or designs - Act as a high-level sounding board for technical questions or designs
bubbled up by the working groups. bubbled up by the working groups.
## Committee Meeting ## Committee Meeting
@ -71,24 +71,24 @@ Community members are encouraged to suggest topics for discussion ahead of the
TOC meetings, and are invited to observe these meetings and engage with the TOC TOC meetings, and are invited to observe these meetings and engage with the TOC
during the community feedback period at the end of each meeting. during the community feedback period at the end of each meeting.
Artifact | Link | Artifact | Link |
-------------------------- | ---- | -------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- |
Google Group | [knative-tech-oversight@googlegroups.com](https://groups.google.com/forum/#!forum/knative-tech-oversight) | Google Group | [knative-tech-oversight@googlegroups.com](https://groups.google.com/forum/#!forum/knative-tech-oversight) |
Community Meeting VC | [meet.google.com/ffc-rypd-kih](https://meet.google.com/ffc-rypd-kih) <br>or dial in:<br>(US) +1 240-630-1102 PIN: 316262# | Community Meeting VC | [meet.google.com/ffc-rypd-kih](https://meet.google.com/ffc-rypd-kih) <br>or dial in:<br>(US) +1 240-630-1102 PIN: 316262# |
Community Meeting Calendar | Thursdays at 11:30a-12p <br>[Calendar](https://calendar.google.com/calendar/embed?src=google.com_18un4fuh6rokqf8hmfftm5oqq4%40group.calendar.google.com) | Community Meeting Calendar | Thursdays at 11:30a-12p <br>[Calendar](https://calendar.google.com/calendar/embed?src=google.com_18un4fuh6rokqf8hmfftm5oqq4%40group.calendar.google.com) |
Meeting Notes | [Notes](https://docs.google.com/document/d/1hR5ijJQjz65QkLrgEhWjv3Q86tWVxYj_9xdhQ6Y5D8Q/edit#heading=h.g47ptr8u5cov) | Meeting Notes | [Notes](https://docs.google.com/document/d/1hR5ijJQjz65QkLrgEhWjv3Q86tWVxYj_9xdhQ6Y5D8Q/edit#heading=h.g47ptr8u5cov) |
Document Folder | [Folder](https://drive.google.com/drive/folders/1_OHttsYLCVtX202aXNmJJrAHJ7BaXcu6) | Document Folder | [Folder](https://drive.google.com/drive/folders/1_OHttsYLCVtX202aXNmJJrAHJ7BaXcu6) |
## Committee Members ## Committee Members
The members of the TOC are shown below. Membership in the TOC is determined by The members of the TOC are shown below. Membership in the TOC is determined by
the [Steering committee](STEERING-COMMITTEE.md). the [Steering committee](STEERING-COMMITTEE.md).
&nbsp; | Member | Company | Profile | &nbsp; | Member | Company | Profile |
------------------------------------------------------------- | ------------- | ------- | ------- | ------------------------------------------------------------- | ------------- | ------- | -------------------------------------------------- |
<img width="30px" src="https://github.com/evankanderson.png"> | Evan Anderson | Google | [@evankanderson](https://github.com/evankanderson) | <img width="30px" src="https://github.com/evankanderson.png"> | Evan Anderson | Google | [@evankanderson](https://github.com/evankanderson) |
<img width="30px" src="https://github.com/mattmoor.png"> | Matt Moore | Google | [@mattmoor](https://github.com/mattmoor) | <img width="30px" src="https://github.com/mattmoor.png"> | Matt Moore | Google | [@mattmoor](https://github.com/mattmoor) |
<img width="30px" src="https://github.com/vaikas-google.png"> | Ville Aikas | Google | [@vaikas-google](https://github.com/vaikas-google) | <img width="30px" src="https://github.com/vaikas-google.png"> | Ville Aikas | Google | [@vaikas-google](https://github.com/vaikas-google) |
--- ---

View File

@ -3,49 +3,49 @@
We want to make sure every member has a shared understanding of the goals and We want to make sure every member has a shared understanding of the goals and
values we hold as a team: values we hold as a team:
* Optimize for the **overall project**, not your own area or feature - Optimize for the **overall project**, not your own area or feature
* A shortcut for one individual can mean a lot of extra work or disruption - A shortcut for one individual can mean a lot of extra work or disruption
for the rest of the team. for the rest of the team.
* Our repos should always be in release shape: **Always Green** - Our repos should always be in release shape: **Always Green**
* This lets us move faster in the mid and long term. - This lets us move faster in the mid and long term.
* This implies investments in build/test infrastructure to have fast, - This implies investments in build/test infrastructure to have fast,
reliable tests to ensure that we can release at any time. reliable tests to ensure that we can release at any time.
* Extra discipline may require more work by individuals to keep the build - Extra discipline may require more work by individuals to keep the build
in good state, but less work overall for the team. in good state, but less work overall for the team.
* Be **specific**, **respectful** and **courteous** - Be **specific**, **respectful** and **courteous**
* Disagreements are welcome and encouraged, but don't use broad - Disagreements are welcome and encouraged, but don't use broad
generalizations, exaggerations, or judgment words that can be taken generalizations, exaggerations, or judgment words that can be taken
personally. Consider other peoples perspective (including the wide personally. Consider other peoples perspective (including the wide
range of applicability of Knative). Empathize with our users. Focus on range of applicability of Knative). Empathize with our users. Focus on
the specific issue at hand, and remember that we all care about the the specific issue at hand, and remember that we all care about the
project, first and foremost. project, first and foremost.
* Emails to the [mailing lists](CONTRIBUTING.md#contributing-a-feature), - Emails to the [mailing lists](CONTRIBUTING.md#contributing-a-feature),
document comments, or meetings are often better and higher bandwidth document comments, or meetings are often better and higher bandwidth
ways to communicate complex and nuanced design issues, as opposed to ways to communicate complex and nuanced design issues, as opposed to
protracted heated live chats. protracted heated live chats.
* Be mindful of the terminology you are using, it may not be the same as - Be mindful of the terminology you are using, it may not be the same as
someone else and cause misunderstanding. To promote clear and precise someone else and cause misunderstanding. To promote clear and precise
communication, define the terms you are using in context. communication, define the terms you are using in context.
* See also the [Code of Conduct](CODE-OF-CONDUCT.md), which everyone must - See also the [Code of Conduct](CODE-OF-CONDUCT.md), which everyone must
abide by. abide by.
* Raising issues is great, suggesting solutions is even better - Raising issues is great, suggesting solutions is even better
* Think of a proposed alternative and improvement rather than just what - Think of a proposed alternative and improvement rather than just what
you perceive as wrong. you perceive as wrong.
* If you have no immediate solution even after thinking about it - if - If you have no immediate solution even after thinking about it - if
something does seem significant, raise it to someone who might be able something does seem significant, raise it to someone who might be able
to also think of solutions or to the group (dont stay frustrated! Feel to also think of solutions or to the group (dont stay frustrated! Feel
safe in bringing up issues. safe in bringing up issues.
* Avoid rehashing old issues that have been resolved/decided - Avoid rehashing old issues that have been resolved/decided
(unless you have new insights or information). (unless you have new insights or information).
* Be productive and **happy**, and most importantly, have *fun* :-) - Be productive and **happy**, and most importantly, have _fun_ :-)
--- ---

View File

@ -4,15 +4,15 @@ This document describes the processes we use to manage the Knative working
groups. This includes how they are formed, how leads are established, how they groups. This includes how they are formed, how leads are established, how they
are run, etc. are run, etc.
* [Why working groups?](#why-working-groups) - [Why working groups?](#why-working-groups)
* [Proposing a new working group](#proposing-a-new-working-group) - [Proposing a new working group](#proposing-a-new-working-group)
* [Setting up a working group](#setting-up-a-working-group) - [Setting up a working group](#setting-up-a-working-group)
* [Dissolving a working group](#dissolving-a-working-group) - [Dissolving a working group](#dissolving-a-working-group)
* [Running a working group](#running-a-working-group) - [Running a working group](#running-a-working-group)
* [Be open](#be-open) - [Be open](#be-open)
* [Making decisions](#making-decisions) - [Making decisions](#making-decisions)
* [Subgroups](#subgroups) - [Subgroups](#subgroups)
* [Escalations](#escalations) - [Escalations](#escalations)
## Why working groups? ## Why working groups?
@ -39,30 +39,30 @@ If youve identified a substantial architectural area which would benefit from
long-lived, concerted and focused design, then you should consider creating a long-lived, concerted and focused design, then you should consider creating a
new working group. To do so, you need to: new working group. To do so, you need to:
* **Create a charter**. This should be a few paragraphs explaining: - **Create a charter**. This should be a few paragraphs explaining:
* The mission of the working group - The mission of the working group
* The goals of the working group (problems being solved) - The goals of the working group (problems being solved)
* The scope of the working group (topics, subsystems, code repos, areas of - The scope of the working group (topics, subsystems, code repos, areas of
responsibility) responsibility)
* **Nominate an initial set of leads**. The leads set the agenda for the - **Nominate an initial set of leads**. The leads set the agenda for the
working group and serve as final arbiters on any technical decision. See working group and serve as final arbiters on any technical decision. See
[below](#leads) for information on the responsibilities of leads and [below](#leads) for information on the responsibilities of leads and
requirements for nominating them. requirements for nominating them.
* **Prepare a Roadmap**. Create a preliminary 3 month roadmap for what the - **Prepare a Roadmap**. Create a preliminary 3 month roadmap for what the
working group would focus on. working group would focus on.
* **Send an Email**. Write up an email with your charter, nominated leads, and - **Send an Email**. Write up an email with your charter, nominated leads, and
roadmap, and send it to roadmap, and send it to
[knative-tech-oversight@](mailto:knative-tech-oversight@googlegroups.com). [knative-tech-oversight@](mailto:knative-tech-oversight@googlegroups.com).
The technical oversight committee will evaluate the request and decide The technical oversight committee will evaluate the request and decide
whether the working group should be formed, whether it should be merely a whether the working group should be formed, whether it should be merely a
subgroup of an existing working group, or whether it should be subsumed by subgroup of an existing working group, or whether it should be subsumed by
an existing working group. an existing working group.
## Setting up a working group ## Setting up a working group
@ -70,42 +70,42 @@ Once approval has been granted by the technical oversight committee to form a
working group, the working group leads need to take a few steps to establish the working group, the working group leads need to take a few steps to establish the
working group: working group:
* **Create a Google Drive Folder**. Create a folder to hold your - **Create a Google Drive Folder**. Create a folder to hold your
working group documents within this parent working group documents within this parent
[folder](https://drive.google.com/corp/drive/folders/0APnJ_hRs30R2Uk9PVA). Call [folder](https://drive.google.com/corp/drive/folders/0APnJ_hRs30R2Uk9PVA). Call
your folder "GROUP_NAME". your folder "GROUP_NAME".
* **Create a Meeting Notes Document**. Create a blank document in the above - **Create a Meeting Notes Document**. Create a blank document in the above
folder and call it "GROUP_NAME Group Meeting Notes". folder and call it "GROUP_NAME Group Meeting Notes".
* **Create a Roadmap Document**. Create a document in the above folder and - **Create a Roadmap Document**. Create a document in the above folder and
call it "GROUP_NAME Group Roadmap". Put your initial roadmap in the call it "GROUP_NAME Group Roadmap". Put your initial roadmap in the
document. document.
* **Create a Wiki**. Create a wiki page on - **Create a Wiki**. Create a wiki page on
[GitHub](https://github.com/knative/serving) titled "GROUP_NAME Design [GitHub](https://github.com/knative/serving) titled "GROUP_NAME Design
Decisions". This page will be used to track important design decisions made Decisions". This page will be used to track important design decisions made
by the working group. by the working group.
* **Create a Public Google Group**. Call the group "knative-*group_name*" (all - **Create a Public Google Group**. Call the group "knative-_group_name_" (all
in lowercase, dashes for spaces). This mailing list must be open to all. in lowercase, dashes for spaces). This mailing list must be open to all.
* **Schedule a Recurring Meeting**. Create a recurring meeting (weekly or - **Schedule a Recurring Meeting**. Create a recurring meeting (weekly or
bi-weekly, 30 or 60 minutes) and call the meeting GROUP_NAME Group Sync-Up". bi-weekly, 30 or 60 minutes) and call the meeting GROUP_NAME Group Sync-Up".
Attach the meeting notes document to the calendar event. Generally schedule Attach the meeting notes document to the calendar event. Generally schedule
these meetings between 9:00AM to 2:59PM Pacific Time. Invite the public these meetings between 9:00AM to 2:59PM Pacific Time. Invite the public
Google group to the meeting. Google group to the meeting.
* **Register the Working Group**. Go to - **Register the Working Group**. Go to
[WORKING-GROUPS.md](https://github.com/knative/serving/blob/master/community/WORKING-GROUPS.md) [WORKING-GROUPS.md](https://github.com/knative/serving/blob/master/community/WORKING-GROUPS.md)
and add your working group name, the names of the leads, the working group and add your working group name, the names of the leads, the working group
charter, and a link to the meeting you created. charter, and a link to the meeting you created.
* **Announce your Working Group**. Send a note to - **Announce your Working Group**. Send a note to
[knative-dev@](mailto:knative-dev@googlegroups.com) and [knative-dev@](mailto:knative-dev@googlegroups.com) and
[knative-tech-oversight@](mailto:knative-tech-oversight@googlegroups.com) to [knative-tech-oversight@](mailto:knative-tech-oversight@googlegroups.com) to
announce your new working group. Include your charter in the email and announce your new working group. Include your charter in the email and
provide links to the meeting invitation. provide links to the meeting invitation.
Congratulations, you now have a fully formed working group! Congratulations, you now have a fully formed working group!
@ -137,23 +137,23 @@ leads role and requirements.
Leads are responsible for running a working group. Running the group involves a Leads are responsible for running a working group. Running the group involves a
few activities: few activities:
* **Meetings**. Prepare the agenda and run the regular working group meetings. - **Meetings**. Prepare the agenda and run the regular working group meetings.
Ensure the meetings are recorded, and properly archived. Ensure the meetings are recorded, and properly archived.
* **Notes**. Ensure that meeting notes are kept up to date. Provide a link to - **Notes**. Ensure that meeting notes are kept up to date. Provide a link to
the recorded meeting in the notes. The lead may delegate note-taking duties. the recorded meeting in the notes. The lead may delegate note-taking duties.
* **Wiki**. Ensure that significant design decisions are captured in the Wiki. - **Wiki**. Ensure that significant design decisions are captured in the Wiki.
In the Wiki, include links to useful design documents, any interesting In the Wiki, include links to useful design documents, any interesting
GitHub issues or PRs, posts to the mailing lists, etc. The wiki should GitHub issues or PRs, posts to the mailing lists, etc. The wiki should
provide a good feel for where the mind of the working group is at and where provide a good feel for where the mind of the working group is at and where
things are headed. things are headed.
* **Roadmap**. Establish **and maintain** a roadmap for the working group - **Roadmap**. Establish **and maintain** a roadmap for the working group
outlining the areas of focus for the working group over the next 3 months. outlining the areas of focus for the working group over the next 3 months.
* **Report**. Report current status to the main community meeting every 6 - **Report**. Report current status to the main community meeting every 6
weeks. weeks.
### Be open ### Be open

View File

@ -1,6 +1,6 @@
# Knative Working Groups # Knative Working Groups
Most community activity is organized into *working groups*. Most community activity is organized into _working groups_.
Working groups follow the [contributing](CONTRIBUTING.md) guidelines although Working groups follow the [contributing](CONTRIBUTING.md) guidelines although
each of these groups may operate a little differently depending on their needs each of these groups may operate a little differently depending on their needs
@ -27,155 +27,155 @@ meetings.
The current working groups are: The current working groups are:
* [API Core](#api-core) - [API Core](#api-core)
* [Build](#build) - [Build](#build)
* [Documentation](#documentation) - [Documentation](#documentation)
* [Eventing](#eventing) - [Eventing](#eventing)
* [Networking](#networking) - [Networking](#networking)
* [Observability](#observability) - [Observability](#observability)
* [Productivity](#productivity) - [Productivity](#productivity)
* [Scaling](#scaling) - [Scaling](#scaling)
<!-- TODO add charters for each group --> <!-- TODO add charters for each group -->
## API Core ## API Core
API [resources](../pkg/apis/serving), [validation](../pkg/webhook), and [semantics](../pkg/controller). API [resources](../pkg/apis/serving), [validation](../pkg/webhook), and [semantics](../pkg/controller).
Artifact | Link | Artifact | Link |
-------------------------- | ---- | -------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- |
Forum | [knative-dev@](https://groups.google.com/forum/#!forum/knative-dev) | Forum | [knative-dev@](https://groups.google.com/forum/#!forum/knative-dev) |
Community Meeting VC | [https://meet.google.com/bzx-bjqa-rha](https://meet.google.com/bzx-bjqa-rha) <br>Or dial in:<br>(US) +1 262-448-6367<br>PIN: 923 539# | Community Meeting VC | [https://meet.google.com/bzx-bjqa-rha](https://meet.google.com/bzx-bjqa-rha) <br>Or dial in:<br>(US) +1 262-448-6367<br>PIN: 923 539# |
Community Meeting Calendar | Wednesdays 10:30a-11:00a PST <br>[Calendar](https://calendar.google.com/calendar/embed?src=google.com_18un4fuh6rokqf8hmfftm5oqq4%40group.calendar.google.com) | Community Meeting Calendar | Wednesdays 10:30a-11:00a PST <br>[Calendar](https://calendar.google.com/calendar/embed?src=google.com_18un4fuh6rokqf8hmfftm5oqq4%40group.calendar.google.com) |
Meeting Notes | [Notes](https://docs.google.com/document/d/1NC4klOdNaU-N-PsKLyXBqDKgNSHtxCDep29Ta2b5FK0/edit) | Meeting Notes | [Notes](https://docs.google.com/document/d/1NC4klOdNaU-N-PsKLyXBqDKgNSHtxCDep29Ta2b5FK0/edit) |
Document Folder | [Folder](https://drive.google.com/corp/drive/folders/1fpBW7VyiBISsKuVdgn1MrgFdtx_JGoC5) | Document Folder | [Folder](https://drive.google.com/corp/drive/folders/1fpBW7VyiBISsKuVdgn1MrgFdtx_JGoC5) |
Slack Channel | [#api](https://knative.slack.com/messages/api) | Slack Channel | [#api](https://knative.slack.com/messages/api) |
&nbsp; | Leads | Company | Profile | &nbsp; | Leads | Company | Profile |
-------------------------------------------------------- | ---------- | ------- | ------- | -------------------------------------------------------- | ---------- | ------- | --------------------------------------- |
<img width="30px" src="https://github.com/mattmoor.png"> | Matt Moore | Google | [mattmoor](https://github.com/mattmoor) | <img width="30px" src="https://github.com/mattmoor.png"> | Matt Moore | Google | [mattmoor](https://github.com/mattmoor) |
## Build ## Build
[Build](https://github.com/knative/build), Builders, and Build templates [Build](https://github.com/knative/build), Builders, and Build templates
Artifact | Link | Artifact | Link |
-------------------------- | ---- | -------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
Forum | [knative-dev@](https://groups.google.com/forum/#!forum/knative-dev) | Forum | [knative-dev@](https://groups.google.com/forum/#!forum/knative-dev) |
Community Meeting VC | [meet.google.com/hau-nwak-tgm](https://meet.google.com/hau-nwak-tgm) <br>Or dial in:<br>(US) +1 219-778-6103 PIN: 573 000# | Community Meeting VC | [meet.google.com/hau-nwak-tgm](https://meet.google.com/hau-nwak-tgm) <br>Or dial in:<br>(US) +1 219-778-6103 PIN: 573 000# |
Community Meeting Calendar | Wednesdays 10:00a-10:30a PST <br>[Calendar](https://calendar.google.com/event?action=TEMPLATE&tmeid=MTBkb3MwYnVrbDd0djE0a2kzcmpmbjZndm9fMjAxODA5MTJUMTcwMDAwWiBqYXNvbmhhbGxAZ29vZ2xlLmNvbQ&tmsrc=jasonhall%40google.com&scp=ALL) | Community Meeting Calendar | Wednesdays 10:00a-10:30a PST <br>[Calendar](https://calendar.google.com/event?action=TEMPLATE&tmeid=MTBkb3MwYnVrbDd0djE0a2kzcmpmbjZndm9fMjAxODA5MTJUMTcwMDAwWiBqYXNvbmhhbGxAZ29vZ2xlLmNvbQ&tmsrc=jasonhall%40google.com&scp=ALL) |
Meeting Notes | [Notes](https://docs.google.com/document/d/1e7gMVFlJfkFdTcaWj2qETeRD9kSBG2Vh8mASPmQMYC0/edit) | Meeting Notes | [Notes](https://docs.google.com/document/d/1e7gMVFlJfkFdTcaWj2qETeRD9kSBG2Vh8mASPmQMYC0/edit) |
Document Folder | [Folder](https://drive.google.com/corp/drive/folders/1ov16HvPam-v_FXAGEaUdHok6_hUAoIoe) | Document Folder | [Folder](https://drive.google.com/corp/drive/folders/1ov16HvPam-v_FXAGEaUdHok6_hUAoIoe) |
Slack Channel | [#build-crd](https://knative.slack.com/messages/build-crd) | Slack Channel | [#build-crd](https://knative.slack.com/messages/build-crd) |
&nbsp; | Leads | Company | Profile | &nbsp; | Leads | Company | Profile |
-------------------------------------------------------- | ---------- | ------- | ------- | -------------------------------------------------------- | ---------- | ------- | --------------------------------------- |
<img width="30px" src="https://github.com/ImJasonH.png"> | Jason Hall | Google | [ImJasonH](https://github.com/ImJasonH) | <img width="30px" src="https://github.com/ImJasonH.png"> | Jason Hall | Google | [ImJasonH](https://github.com/ImJasonH) |
<img width="30px" src="https://github.com/mattmoor.png"> | Matt Moore | Google | [mattmoor](https://github.com/mattmoor) | <img width="30px" src="https://github.com/mattmoor.png"> | Matt Moore | Google | [mattmoor](https://github.com/mattmoor) |
## Documentation ## Documentation
Knative documentation, especially the [Docs](https://github.com/knative/docs) repo. Knative documentation, especially the [Docs](https://github.com/knative/docs) repo.
Artifact | Link | Artifact | Link |
-------------------------- | ---- | -------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
Forum | [knative-docs@](https://groups.google.com/forum/#!forum/knative-docs) | Forum | [knative-docs@](https://groups.google.com/forum/#!forum/knative-docs) |
Community Meeting VC | [meet.google.com/mku-npuv-cjs](https://meet.google.com/mku-npuv-cjs) <br>Or dial in:<br>(US) +1 260-277-0211<br>PIN: 956 724# | Community Meeting VC | [meet.google.com/mku-npuv-cjs](https://meet.google.com/mku-npuv-cjs) <br>Or dial in:<br>(US) +1 260-277-0211<br>PIN: 956 724# |
Community Meeting Calendar | Every other Tuesday, 9:00a-9:30a PST<br>[Calendar](https://calendar.google.com/calendar/embed?src=google.com_18un4fuh6rokqf8hmfftm5oqq4%40group.calendar.google.com) | Community Meeting Calendar | Every other Tuesday, 9:00a-9:30a PST<br>[Calendar](https://calendar.google.com/calendar/embed?src=google.com_18un4fuh6rokqf8hmfftm5oqq4%40group.calendar.google.com) |
Meeting Notes | [Notes](https://docs.google.com/document/d/1Y7rug0XshcQPdKzptdWbQLQjcjgpFdLeEgP1nfkDAe4/edit) | Meeting Notes | [Notes](https://docs.google.com/document/d/1Y7rug0XshcQPdKzptdWbQLQjcjgpFdLeEgP1nfkDAe4/edit) |
Document Folder | [Folder](https://drive.google.com/corp/drive/folders/1K5cM9m-b93ySI5WGKalJKbBq_cfjyi-y) | Document Folder | [Folder](https://drive.google.com/corp/drive/folders/1K5cM9m-b93ySI5WGKalJKbBq_cfjyi-y) |
Slack Channel | [#docs](https://knative.slack.com/messages/docs) | Slack Channel | [#docs](https://knative.slack.com/messages/docs) |
&nbsp; | Leads | Company | Profile | &nbsp; | Leads | Company | Profile |
------------------------------------------------------------- | ----------- | ------- | ------- | -------------------------------------------------------- | ---------- | ------- | --------------------------------------- |
<img width="30px" src="https://github.com/samodell.png"> | Sam O'Dell | Google | [samodell](https://github.com/samodell) | <img width="30px" src="https://github.com/samodell.png"> | Sam O'Dell | Google | [samodell](https://github.com/samodell) |
## Eventing ## Eventing
Event sources, bindings, FaaS framework, and orchestration Event sources, bindings, FaaS framework, and orchestration
Artifact | Link | Artifact | Link |
-------------------------- | ---- | -------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- |
Forum | [knative-dev@](https://groups.google.com/forum/#!forum/knative-dev) | Forum | [knative-dev@](https://groups.google.com/forum/#!forum/knative-dev) |
Community Meeting VC | [meet.google.com/uea-zcwt-drt](https://meet.google.com/uea-zcwt-drt) <br>Or dial in:<br>(US) +1 919 525 1825<br>PIN: 356 842# | Community Meeting VC | [meet.google.com/uea-zcwt-drt](https://meet.google.com/uea-zcwt-drt) <br>Or dial in:<br>(US) +1 919 525 1825<br>PIN: 356 842# |
Community Meeting Calendar | Wednesdays 9:00a-9:30a PST<br>[Calendar](https://calendar.google.com/calendar/embed?src=google.com_5pce19kpifu8avnj0eo74sg84c%40group.calendar.google.com) | Community Meeting Calendar | Wednesdays 9:00a-9:30a PST<br>[Calendar](https://calendar.google.com/calendar/embed?src=google.com_5pce19kpifu8avnj0eo74sg84c%40group.calendar.google.com) |
Meeting Notes | [Notes](https://docs.google.com/document/d/1uGDehQu493N_XCAT5H4XEw5T9IWlPN1o19ULOWKuPnY/edit) | Meeting Notes | [Notes](https://docs.google.com/document/d/1uGDehQu493N_XCAT5H4XEw5T9IWlPN1o19ULOWKuPnY/edit) |
Document Folder | [Folder](https://drive.google.com/corp/drive/folders/1S22YmGl6B1ppYApwa1j5j9Nc6rEChlPo) | Document Folder | [Folder](https://drive.google.com/corp/drive/folders/1S22YmGl6B1ppYApwa1j5j9Nc6rEChlPo) |
Slack Channel | [#eventing](https://knative.slack.com/messages/eventing) | Slack Channel | [#eventing](https://knative.slack.com/messages/eventing) |
&nbsp; | Leads | Company | Profile | &nbsp; | Leads | Company | Profile |
------------------------------------------------------------- | ----------- | ------- | ------- | ------------------------------------------------------------- | ----------- | ------- | ------------------------------------------------- |
<img width="30px" src="https://github.com/vaikas-google.png"> | Ville Aikas | Google | [vaikas-google](https://github.com/vaikas-google) | <img width="30px" src="https://github.com/vaikas-google.png"> | Ville Aikas | Google | [vaikas-google](https://github.com/vaikas-google) |
## Networking ## Networking
Inbound and outbound network connectivity for [serving](https://github.com/knative/serving) workloads. Inbound and outbound network connectivity for [serving](https://github.com/knative/serving) workloads.
Specific areas of interest include: load balancing, routing, DNS configuration and TLS support. Specific areas of interest include: load balancing, routing, DNS configuration and TLS support.
Artifact | Link | Artifact | Link |
-------------------------- | ---- | -------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ |
Forum | [knative-dev@](https://groups.google.com/forum/#!forum/knative-dev) | Forum | [knative-dev@](https://groups.google.com/forum/#!forum/knative-dev) |
Community Meeting VC | [meet.google.com/cet-jepr-gtx](https://meet.google.com/cet-jepr-gtx) <br>Or dial in:<br>(US) +1 570-865-1288<br>PIN: 741 211# | Community Meeting VC | [meet.google.com/cet-jepr-gtx](https://meet.google.com/cet-jepr-gtx) <br>Or dial in:<br>(US) +1 570-865-1288<br>PIN: 741 211# |
Community Meeting Calendar | Thursdays at 9:00a-9:30a PST<br>[Calendar](https://calendar.google.com/calendar/embed?src=google.com_18un4fuh6rokqf8hmfftm5oqq4%40group.calendar.google.com) | Community Meeting Calendar | Thursdays at 9:00a-9:30a PST<br>[Calendar](https://calendar.google.com/calendar/embed?src=google.com_18un4fuh6rokqf8hmfftm5oqq4%40group.calendar.google.com) |
Meeting Notes | [Notes](https://drive.google.com/open?id=1EE1t5mTfnTir2lEasdTMRNtuPEYuPqQCZbU3NC9mHOI) | Meeting Notes | [Notes](https://drive.google.com/open?id=1EE1t5mTfnTir2lEasdTMRNtuPEYuPqQCZbU3NC9mHOI) |
Document Folder | [Folder](https://drive.google.com/corp/drive/folders/1oVDYbcEDdQ9EpUmkK6gE4C7aZ8u6ujsN) | Document Folder | [Folder](https://drive.google.com/corp/drive/folders/1oVDYbcEDdQ9EpUmkK6gE4C7aZ8u6ujsN) |
Slack Channel | [#networking](https://knative.slack.com/messages/networking) | Slack Channel | [#networking](https://knative.slack.com/messages/networking) |
&nbsp; | Leads | Company | Profile | &nbsp; | Leads | Company | Profile |
--------------------------------------------------------- | ---------------- | ------- | ------- | --------------------------------------------------------- | ---------------- | ------- | ----------------------------------------- |
<img width="30px" src="https://github.com/tcnghia.png"> | Nghia Tran | Google | [tcnghia](https://github.com/tcnghia) | <img width="30px" src="https://github.com/tcnghia.png"> | Nghia Tran | Google | [tcnghia](https://github.com/tcnghia) |
<img width="30px" src="https://github.com/mdemirhan.png"> | Mustafa Demirhan | Google | [mdemirhan](https://github.com/mdemirhan) | <img width="30px" src="https://github.com/mdemirhan.png"> | Mustafa Demirhan | Google | [mdemirhan](https://github.com/mdemirhan) |
## Observability ## Observability
Logging, monitoring & tracing infrastructure Logging, monitoring & tracing infrastructure
Artifact | Link | Artifact | Link |
-------------------------- | ---- | -------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
Forum | [knative-dev@](https://groups.google.com/forum/#!forum/knative-dev) | Forum | [knative-dev@](https://groups.google.com/forum/#!forum/knative-dev) |
Community Meeting VC | meet.google.com/kps-noeu-uzz <br> Or dial in: <br> (US) +1 413-301-9135 <br>PIN: 602 561# | Community Meeting VC | meet.google.com/kps-noeu-uzz <br> Or dial in: <br> (US) +1 413-301-9135 <br>PIN: 602 561# |
Community Meeting Calendar | Every other Thursday, 10:30a-11a PST<br>[Calendar](https://calendar.google.com/calendar/embed?src=google.com_18un4fuh6rokqf8hmfftm5oqq4%40group.calendar.google.com) | Community Meeting Calendar | Every other Thursday, 10:30a-11a PST<br>[Calendar](https://calendar.google.com/calendar/embed?src=google.com_18un4fuh6rokqf8hmfftm5oqq4%40group.calendar.google.com) |
Meeting Notes | [Notes](https://drive.google.com/open?id=1vWEpjf093Jsih3mKkpIvmWWbUQPxFkcyDxzNH15rQgE) | Meeting Notes | [Notes](https://drive.google.com/open?id=1vWEpjf093Jsih3mKkpIvmWWbUQPxFkcyDxzNH15rQgE) |
Document Folder | [Folder](https://drive.google.com/corp/drive/folders/10HcpZlI1PbFyzinO6HjfHbzCkBXrqXMy) | Document Folder | [Folder](https://drive.google.com/corp/drive/folders/10HcpZlI1PbFyzinO6HjfHbzCkBXrqXMy) |
Slack Channel | [#observability](https://knative.slack.com/messages/observability) | Slack Channel | [#observability](https://knative.slack.com/messages/observability) |
&nbsp; | Leads | Company | Profile | &nbsp; | Leads | Company | Profile |
--------------------------------------------------------- | ---------------- | ------- | ------- | --------------------------------------------------------- | ---------------- | ------- | ----------------------------------------- |
<img width="30px" src="https://github.com/mdemirhan.png"> | Mustafa Demirhan | Google | [mdemirhan](https://github.com/mdemirhan) | <img width="30px" src="https://github.com/mdemirhan.png"> | Mustafa Demirhan | Google | [mdemirhan](https://github.com/mdemirhan) |
## Scaling ## Scaling
Autoscaling Autoscaling
Artifact | Link | Artifact | Link |
-------------------------- | ---- | -------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- |
Forum | [knative-dev@](https://groups.google.com/forum/#!forum/knative-dev) | Forum | [knative-dev@](https://groups.google.com/forum/#!forum/knative-dev) |
Community Meeting VC | [Hangouts](https://meet.google.com/ick-mumc-mjv?hs=122) | Community Meeting VC | [Hangouts](https://meet.google.com/ick-mumc-mjv?hs=122) |
Community Meeting Calendar | Wednesdays at 9:30am PST <br>[Calendar](https://calendar.google.com/calendar/embed?src=google.com_18un4fuh6rokqf8hmfftm5oqq4%40group.calendar.google.com) | Community Meeting Calendar | Wednesdays at 9:30am PST <br>[Calendar](https://calendar.google.com/calendar/embed?src=google.com_18un4fuh6rokqf8hmfftm5oqq4%40group.calendar.google.com) |
Meeting Notes | [Notes](https://docs.google.com/document/d/1FoLJqbDJM8_tw7CON-CJZsO2mlF8Ia1cWzCjWX8HDAI/edit#heading=h.c0ufqy5rucfa) | Meeting Notes | [Notes](https://docs.google.com/document/d/1FoLJqbDJM8_tw7CON-CJZsO2mlF8Ia1cWzCjWX8HDAI/edit#heading=h.c0ufqy5rucfa) |
Document Folder | [Folder](https://drive.google.com/corp/drive/folders/1qpGIPXVGoMm6IXb74gPrrHkudV_bjIZ9) | Document Folder | [Folder](https://drive.google.com/corp/drive/folders/1qpGIPXVGoMm6IXb74gPrrHkudV_bjIZ9) |
Slack Channel | [#autoscaling](https://knative.slack.com/messages/autoscaling) | Slack Channel | [#autoscaling](https://knative.slack.com/messages/autoscaling) |
&nbsp; | Leads | Company | Profile | &nbsp; | Leads | Company | Profile |
------------------------------------------------------------- | -------------- | ------- | ------- | ------------------------------------------------------------- | -------------- | ------- | ------------------------------------------------- |
<img width="30px" src="https://github.com/josephburnett.png"> | Joseph Burnett | Google | [josephburnett](https://github.com/josephburnett) | <img width="30px" src="https://github.com/josephburnett.png"> | Joseph Burnett | Google | [josephburnett](https://github.com/josephburnett) |
## Productivity ## Productivity
Project health, test framework, continuous integration & deployment, release, performance/scale/load testing infrastructure Project health, test framework, continuous integration & deployment, release, performance/scale/load testing infrastructure
Artifact | Link | Artifact | Link |
-------------------------- | ---- | -------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ |
Forum | [knative-dev@](https://groups.google.com/forum/#!forum/knative-dev) | Forum | [knative-dev@](https://groups.google.com/forum/#!forum/knative-dev) |
Community Meeting VC | [Hangouts](https://meet.google.com/sps-vbhg-rfx) | Community Meeting VC | [Hangouts](https://meet.google.com/sps-vbhg-rfx) |
Community Meeting Calendar | Every other Thursday, 2p PST<br>[Calendar](https://calendar.google.com/calendar/embed?src=google.com_18un4fuh6rokqf8hmfftm5oqq4%40group.calendar.google.com) | Community Meeting Calendar | Every other Thursday, 2p PST<br>[Calendar](https://calendar.google.com/calendar/embed?src=google.com_18un4fuh6rokqf8hmfftm5oqq4%40group.calendar.google.com) |
Meeting Notes | [Notes](https://docs.google.com/document/d/1aPRwYGD4XscRIqlBzbNsSB886PJ0G-vZYUAAUjoydko) | Meeting Notes | [Notes](https://docs.google.com/document/d/1aPRwYGD4XscRIqlBzbNsSB886PJ0G-vZYUAAUjoydko) |
Document Folder | [Folder](https://drive.google.com/corp/drive/folders/1oMYB4LQHjySuMChmcWYCyhH7-CSkz2r_) | Document Folder | [Folder](https://drive.google.com/corp/drive/folders/1oMYB4LQHjySuMChmcWYCyhH7-CSkz2r_) |
Slack Channel | [#productivity](https://knative.slack.com/messages/productivity) | Slack Channel | [#productivity](https://knative.slack.com/messages/productivity) |
&nbsp; | Leads | Company | Profile | &nbsp; | Leads | Company | Profile |
--------------------------------------------------------- | -------------- | ------- | ------- | --------------------------------------------------------- | ------------- | ------- | ----------------------------------------- |
<img width="30px" src="https://github.com/jessiezcc.png"> | Jessie Zhu | Google | [jessiezcc](https://github.com/jessiezcc) | <img width="30px" src="https://github.com/jessiezcc.png"> | Jessie Zhu | Google | [jessiezcc](https://github.com/jessiezcc) |
<img width="30px" src="https://github.com/adrcunha.png"> | Adriano Cunha | Google | [adrcunhua](https://github.com/adrcunha) | <img width="30px" src="https://github.com/adrcunha.png"> | Adriano Cunha | Google | [adrcunhua](https://github.com/adrcunha) |
--- ---

View File

@ -1,6 +1,6 @@
# Knative Eventing # Knative Eventing
Knative Eventing is a system that is designed to address a common need for cloud native development and Knative Eventing is a system that is designed to address a common need for cloud native development and
provides composable primitives to enable late-binding event sources and event consumers. provides composable primitives to enable late-binding event sources and event consumers.
## Design overview ## Design overview
@ -9,13 +9,13 @@ Knative Eventing is designed around the following goals:
1. Knative Eventing services are loosely coupled. These services can be developed and deployed independently on, 1. Knative Eventing services are loosely coupled. These services can be developed and deployed independently on,
and across a variety of platforms (for example Kubernetes, VMs, SaaS or FaaS). and across a variety of platforms (for example Kubernetes, VMs, SaaS or FaaS).
1. Event producers and event sources are independent. Any producer (or source), can generate events 1. Event producers and event sources are independent. Any producer (or source), can generate events
before there are active event consumers that are listening. Any event consumer can express interest in an before there are active event consumers that are listening. Any event consumer can express interest in an
event or class of events, before there are producers that are creating those events. event or class of events, before there are producers that are creating those events.
1. Other services can be connected to the Eventing system. These services can perform the following functions: 1. Other services can be connected to the Eventing system. These services can perform the following functions:
- Create new applications without modifying the event producer or event consumer. - Create new applications without modifying the event producer or event consumer.
- Select and target specific subsets of the events from their producers. - Select and target specific subsets of the events from their producers.
1. Ensure cross-service interoperability. Knative Eventing is consistent with the 1. Ensure cross-service interoperability. Knative Eventing is consistent with the
[CloudEvents](https://github.com/cloudevents/spec/blob/master/spec.md#design-goals) [CloudEvents](https://github.com/cloudevents/spec/blob/master/spec.md#design-goals)
specification that is developed by the [CNCF Serverless WG](https://lists.cncf.io/g/cncf-wg-serverless). specification that is developed by the [CNCF Serverless WG](https://lists.cncf.io/g/cncf-wg-serverless).

View File

@ -155,6 +155,10 @@ not, then you will need to look downstream yourself.
You should see log lines similar to: You should see log lines similar to:
```json ```json
{"ID":"284375451531353","Data":"SGVsbG8gV29ybGQh","Attributes":null,"PublishTime":"2018-10-31T00:00:00.00Z"} {
"ID": "284375451531353",
"Data": "SGVsbG8gV29ybGQh",
"Attributes": null,
"PublishTime": "2018-10-31T00:00:00.00Z"
}
``` ```

View File

@ -10,22 +10,22 @@ by a Knative Service.
You will need: You will need:
1. An internet-accessible Kubernetes cluster with Knative Serving 1. An internet-accessible Kubernetes cluster with Knative Serving
installed. Follow the [installation installed. Follow the [installation
instructions](https://github.com/knative/docs/blob/master/install/README.md) instructions](https://github.com/knative/docs/blob/master/install/README.md)
if you need to create one. if you need to create one.
1. Ensure Knative Serving is [configured with a domain 1. Ensure Knative Serving is [configured with a domain
name](https://github.com/knative/docs/blob/master/serving/using-a-custom-domain.md) name](https://github.com/knative/docs/blob/master/serving/using-a-custom-domain.md)
that allows GitHub to call into the cluster. that allows GitHub to call into the cluster.
1. If you're using GKE, you'll also want to [assign a static IP address](https://github.com/knative/docs/blob/master/serving/gke-assigning-static-ip-address.md). 1. If you're using GKE, you'll also want to [assign a static IP address](https://github.com/knative/docs/blob/master/serving/gke-assigning-static-ip-address.md).
1. Install [Knative 1. Install [Knative
Eventing](https://github.com/knative/docs/tree/master/eventing). Those Eventing](https://github.com/knative/docs/tree/master/eventing). Those
instructions also install the default eventing sources, including instructions also install the default eventing sources, including
the `GitHubSource` we'll use. the `GitHubSource` we'll use.
### Create a Knative Service ### Create a Knative Service
To verify the `GitHubSource` is working, we will create a simple Knative To verify the `GitHubSource` is working, we will create a simple Knative
`Service` that dumps incoming messages to its log. The `service.yaml` file `Service` that dumps incoming messages to its log. The `service.yaml` file
defines this basic service. defines this basic service.
```yaml ```yaml
@ -44,7 +44,6 @@ spec:
Enter the following command to create the service from `service.yaml`: Enter the following command to create the service from `service.yaml`:
```shell ```shell
kubectl --namespace default apply --filename eventing/samples/github-source/service.yaml kubectl --namespace default apply --filename eventing/samples/github-source/service.yaml
``` ```
@ -54,8 +53,8 @@ kubectl --namespace default apply --filename eventing/samples/github-source/serv
Create a [personal access token](https://github.com/settings/tokens) Create a [personal access token](https://github.com/settings/tokens)
for GitHub that the GitHub source can use to register webhooks with for GitHub that the GitHub source can use to register webhooks with
the GitHub API. Also decide on a secret token that your code will use the GitHub API. Also decide on a secret token that your code will use
to authenticate the incoming webhooks from GitHub (*secretToken*). to authenticate the incoming webhooks from GitHub (_secretToken_).
The token can be named anything you find convenient. The Source The token can be named anything you find convenient. The Source
requires `repo:public_repo` and `admin:repo_hook`, to let it fire requires `repo:public_repo` and `admin:repo_hook`, to let it fire
events from your public repositories and to create webhooks for those events from your public repositories and to create webhooks for those
@ -68,7 +67,7 @@ recommended scopes:
![GitHub UI](personal_access_token.png "GitHub personal access token screenshot") ![GitHub UI](personal_access_token.png "GitHub personal access token screenshot")
Update `githubsecret.yaml` with those values. If your generated access Update `githubsecret.yaml` with those values. If your generated access
token is `'personal_access_token_value'` and you choose your *secretToken* token is `'personal_access_token_value'` and you choose your _secretToken_
as `'asdfasfdsaf'`, you'd modify `githubsecret.yaml` like so: as `'asdfasfdsaf'`, you'd modify `githubsecret.yaml` like so:
```yaml ```yaml
@ -82,14 +81,14 @@ stringData:
secretToken: asdfasfdsaf secretToken: asdfasfdsaf
``` ```
Hint: you can makeup a random *secretToken* with: Hint: you can makeup a random _secretToken_ with:
```shell ```shell
head -c 8 /dev/urandom | base64 head -c 8 /dev/urandom | base64
``` ```
Then, apply the githubsecret using `kubectl`: Then, apply the githubsecret using `kubectl`:
```shell ```shell
kubectl --namespace default apply --filename eventing/samples/github-source/githubsecret.yaml kubectl --namespace default apply --filename eventing/samples/github-source/githubsecret.yaml
``` ```
@ -108,7 +107,7 @@ metadata:
name: githubsourcesample name: githubsourcesample
spec: spec:
eventTypes: eventTypes:
- pull_request - pull_request
ownerAndRepository: <YOUR USER>/<YOUR REPO> ownerAndRepository: <YOUR USER>/<YOUR REPO>
accessToken: accessToken:
secretKeyRef: secretKeyRef:
@ -122,7 +121,6 @@ spec:
apiVersion: serving.knative.dev/v1alpha1 apiVersion: serving.knative.dev/v1alpha1
kind: Service kind: Service
name: github-message-dumper name: github-message-dumper
``` ```
Then, apply that yaml using `kubectl`: Then, apply that yaml using `kubectl`:
@ -142,11 +140,10 @@ check mark to the left of the hook URL, as shown below.
### Create Events ### Create Events
Create a pull request in your GitHub repository. We will verify Create a pull request in your GitHub repository. We will verify
that the GitHub events were sent into the Knative eventing system that the GitHub events were sent into the Knative eventing system
by looking at our message dumper function logs. by looking at our message dumper function logs.
```shell ```shell
kubectl --namespace default get pods kubectl --namespace default get pods
kubectl --namespace default logs github-message-dumper-XXXX user-container kubectl --namespace default logs github-message-dumper-XXXX user-container

View File

@ -73,9 +73,9 @@ export IOTCORE_TOPIC_DEVICE="iot-demo-device-pubsub-topic"
1. Install the 1. Install the
[in-memory `ClusterChannelProvisioner`](https://github.com/knative/eventing/tree/master/config/provisioners/in-memory-channel). [in-memory `ClusterChannelProvisioner`](https://github.com/knative/eventing/tree/master/config/provisioners/in-memory-channel).
- Note that you can skip this if you choose to use a different type of - Note that you can skip this if you choose to use a different type of
`Channel`. If so, you will need to modify `channel.yaml` before `Channel`. If so, you will need to modify `channel.yaml` before
deploying it. deploying it.
#### GCP PubSub Source #### GCP PubSub Source
@ -138,8 +138,8 @@ Even though the `Source` isn't completely ready yet, we can setup the
ko apply -f - ko apply -f -
``` ```
- This uses a very simple Knative Service to see that events are flowing. - This uses a very simple Knative Service to see that events are flowing.
Feel free to replace it. Feel free to replace it.
#### IoT Core #### IoT Core

View File

@ -10,7 +10,6 @@ consumption by a function that has been implemented as a Knative Service.
1. Setup [Knative Serving](https://github.com/knative/docs/tree/master/serving). 1. Setup [Knative Serving](https://github.com/knative/docs/tree/master/serving).
1. Setup [Knative Eventing](https://github.com/knative/docs/tree/master/eventing). 1. Setup [Knative Eventing](https://github.com/knative/docs/tree/master/eventing).
### Channel ### Channel
1. Create a `Channel`. You can use your own `Channel` or use the provided sample, which creates a channel called `testchannel`. If you use your own `Channel` with a different name, then you will need to alter other commands later. 1. Create a `Channel`. You can use your own `Channel` or use the provided sample, which creates a channel called `testchannel`. If you use your own `Channel` with a different name, then you will need to alter other commands later.
@ -21,7 +20,7 @@ kubectl -n default apply -f eventing/samples/kubernetes-event-source/channel.yam
### Service Account ### Service Account
1. Create a Service Account that the `Receive Adapter` runs as. The `Receive Adapater` watches for Kubernetes events and forwards them to the Knative Eventing Framework. If you want to re-use an existing Service Account with the appropriate permissions, you need to modify the 1. Create a Service Account that the `Receive Adapter` runs as. The `Receive Adapater` watches for Kubernetes events and forwards them to the Knative Eventing Framework. If you want to re-use an existing Service Account with the appropriate permissions, you need to modify the
```shell ```shell
kubectl apply -f eventing/samples/kubernetes-event-source/serviceaccount.yaml kubectl apply -f eventing/samples/kubernetes-event-source/serviceaccount.yaml
@ -46,7 +45,6 @@ In order to check the `KubernetesEventSource` is fully working, we will create a
kubectl apply -f eventing/samples/kubernetes-event-source/subscription.yaml kubectl apply -f eventing/samples/kubernetes-event-source/subscription.yaml
``` ```
### Create Events ### Create Events
Create events by launching a pod in the default namespace. Create a busybox container Create events by launching a pod in the default namespace. Create a busybox container
@ -61,7 +59,6 @@ Once the shell comes up, just exit it and kill the pod.
kubectl delete pod busybox kubectl delete pod busybox
``` ```
### Verify ### Verify
We will verify that the kubernetes events were sent into the Knative eventing system by looking at our message dumper function logsIf you deployed the [Subscriber](#subscriber), then continue using this section. If not, then you will need to look downstream yourself. We will verify that the kubernetes events were sent into the Knative eventing system by looking at our message dumper function logsIf you deployed the [Subscriber](#subscriber), then continue using this section. If not, then you will need to look downstream yourself.
@ -72,11 +69,10 @@ kubectl logs -l serving.knative.dev/service=message-dumper -c user-container
``` ```
You should see log lines similar to: You should see log lines similar to:
``` ```
{"metadata":{"name":"busybox.15644359eaa4d8e7","namespace":"default","selfLink":"/api/v1/namespaces/default/events/busybox.15644359eaa4d8e7","uid":"daf8d3ca-e10d-11e8-bf3c-42010a8a017d","resourceVersion":"7840","creationTimestamp":"2018-11-05T15:17:05Z"},"involvedObject":{"kind":"Pod","namespace":"default","name":"busybox","uid":"daf645df-e10d-11e8-bf3c-42010a8a017d","apiVersion":"v1","resourceVersion":"681388"},"reason":"Scheduled","message":"Successfully assigned busybox to gke-knative-eventing-e2e-default-pool-575bcad9-vz55","source":{"component":"default-scheduler"},"firstTimestamp":"2018-11-05T15:17:05Z","lastTimestamp":"2018-11-05T15:17:05Z","count":1,"type":"Normal","eventTime":null,"reportingComponent":"","reportingInstance":""} {"metadata":{"name":"busybox.15644359eaa4d8e7","namespace":"default","selfLink":"/api/v1/namespaces/default/events/busybox.15644359eaa4d8e7","uid":"daf8d3ca-e10d-11e8-bf3c-42010a8a017d","resourceVersion":"7840","creationTimestamp":"2018-11-05T15:17:05Z"},"involvedObject":{"kind":"Pod","namespace":"default","name":"busybox","uid":"daf645df-e10d-11e8-bf3c-42010a8a017d","apiVersion":"v1","resourceVersion":"681388"},"reason":"Scheduled","message":"Successfully assigned busybox to gke-knative-eventing-e2e-default-pool-575bcad9-vz55","source":{"component":"default-scheduler"},"firstTimestamp":"2018-11-05T15:17:05Z","lastTimestamp":"2018-11-05T15:17:05Z","count":1,"type":"Normal","eventTime":null,"reportingComponent":"","reportingInstance":""}
Ce-Source: /apis/v1/namespaces/default/pods/busybox Ce-Source: /apis/v1/namespaces/default/pods/busybox
{"metadata":{"name":"busybox.15644359f59f72f2","namespace":"default","selfLink":"/api/v1/namespaces/default/events/busybox.15644359f59f72f2","uid":"db14ff23-e10d-11e8-bf3c-42010a8a017d","resourceVersion":"7841","creationTimestamp":"2018-11-05T15:17:06Z"},"involvedObject":{"kind":"Pod","namespace":"default","name":"busybox","uid":"daf645df-e10d-11e8-bf3c-42010a8a017d","apiVersion":"v1","resourceVersion":"681389"},"reason":"SuccessfulMountVolume","message":"MountVolume.SetUp succeeded for volume \"default-token-pzr6x\" ","source":{"component":"kubelet","host":"gke-knative-eventing-e2e-default-pool-575bcad9-vz55"},"firstTimestamp":"2018-11-05T15:17:06Z","lastTimestamp":"2018-11-05T15:17:06Z","count":1,"type":"Normal","eventTime":null,"reportingComponent":"","reportingInstance":""} {"metadata":{"name":"busybox.15644359f59f72f2","namespace":"default","selfLink":"/api/v1/namespaces/default/events/busybox.15644359f59f72f2","uid":"db14ff23-e10d-11e8-bf3c-42010a8a017d","resourceVersion":"7841","creationTimestamp":"2018-11-05T15:17:06Z"},"involvedObject":{"kind":"Pod","namespace":"default","name":"busybox","uid":"daf645df-e10d-11e8-bf3c-42010a8a017d","apiVersion":"v1","resourceVersion":"681389"},"reason":"SuccessfulMountVolume","message":"MountVolume.SetUp succeeded for volume \"default-token-pzr6x\" ","source":{"component":"kubelet","host":"gke-knative-eventing-e2e-default-pool-575bcad9-vz55"},"firstTimestamp":"2018-11-05T15:17:06Z","lastTimestamp":"2018-11-05T15:17:06Z","count":1,"type":"Normal","eventTime":null,"reportingComponent":"","reportingInstance":""}
Ce-Source: /apis/v1/namespaces/default/pods/busybox Ce-Source: /apis/v1/namespaces/default/pods/busybox
``` ```

View File

@ -8,7 +8,7 @@ You can find [guides for other platforms here](README.md).
## Before you begin ## Before you begin
Knative requires a Kubernetes cluster v1.10 or newer. `kubectl` v1.10 is also Knative requires a Kubernetes cluster v1.10 or newer. `kubectl` v1.10 is also
required. This guide walks you through creating a cluster with the correct required. This guide walks you through creating a cluster with the correct
specifications for Knative on Azure Kubernetes Service (AKS). specifications for Knative on Azure Kubernetes Service (AKS).
This guide assumes you are using bash in a Mac or Linux environment; some This guide assumes you are using bash in a Mac or Linux environment; some
@ -30,16 +30,16 @@ brew install azure-cli
#### Ubuntu 64-bit #### Ubuntu 64-bit
1. Add the azure-cli repo to your sources: 1. Add the azure-cli repo to your sources:
```console ```console
echo "deb [arch=amd64] https://packages.microsoft.com/repos/azure-cli/ wheezy main" | \ echo "deb [arch=amd64] https://packages.microsoft.com/repos/azure-cli/ wheezy main" | \
sudo tee /etc/apt/sources.list.d/azure-cli.list sudo tee /etc/apt/sources.list.d/azure-cli.list
``` ```
1. Run the following commands to install the Azure CLI and its dependencies: 1. Run the following commands to install the Azure CLI and its dependencies:
```console ```console
sudo apt-key adv --keyserver packages.microsoft.com --recv-keys 52E16F86FEE04B979B07E28DB02C46DF417A0893 sudo apt-key adv --keyserver packages.microsoft.com --recv-keys 52E16F86FEE04B979B07E28DB02C46DF417A0893
sudo apt-get install apt-transport-https sudo apt-get install apt-transport-https
sudo apt-get update && sudo apt-get install azure-cli sudo apt-get update && sudo apt-get install azure-cli
``` ```
### Installing kubectl ### Installing kubectl
@ -59,15 +59,17 @@ First let's identify your Azure subscription and save it for use later.
1. Run `az login` and follow the instructions in the command output to authorize `az` to use your account 1. Run `az login` and follow the instructions in the command output to authorize `az` to use your account
1. List your Azure subscriptions: 1. List your Azure subscriptions:
```bash ```bash
az account list -o table az account list -o table
``` ```
### Create a Resource Group for AKS ### Create a Resource Group for AKS
To simplify the command lines for this walkthrough, we need to define a few To simplify the command lines for this walkthrough, we need to define a few
environment variables. First determine which region you'd like to run AKS in, along with the resource group you'd like to use. environment variables. First determine which region you'd like to run AKS in, along with the resource group you'd like to use.
1. Set `RESOURCE_GROUP` and `LOCATION` variables: 1. Set `RESOURCE_GROUP` and `LOCATION` variables:
```bash ```bash
export LOCATION=eastus export LOCATION=eastus
export RESOURCE_GROUP=knative-group export RESOURCE_GROUP=knative-group
@ -83,64 +85,60 @@ environment variables. First determine which region you'd like to run AKS in, al
Next we will create a managed Kubernetes cluster using AKS. To make sure the cluster is large enough to host all the Knative and Istio components, the recommended configuration for a cluster is: Next we will create a managed Kubernetes cluster using AKS. To make sure the cluster is large enough to host all the Knative and Istio components, the recommended configuration for a cluster is:
* Kubernetes version 1.10 or later - Kubernetes version 1.10 or later
* Three or more nodes - Three or more nodes
* Standard_DS3_v2 nodes - Standard_DS3_v2 nodes
* RBAC enabled - RBAC enabled
1. Enable AKS in your subscription, use the following command with the az cli: 1. Enable AKS in your subscription, use the following command with the az cli:
```bash `bash az provider register -n Microsoft.ContainerService`
az provider register -n Microsoft.ContainerService You should also ensure that the `Microsoft.Compute` and `Microsoft.Network` providers are registered in your subscription. If you need to enable them:
``` `bash az provider register -n Microsoft.Compute az provider register -n Microsoft.Network`
You should also ensure that the `Microsoft.Compute` and `Microsoft.Network` providers are registered in your subscription. If you need to enable them:
```bash
az provider register -n Microsoft.Compute
az provider register -n Microsoft.Network
```
1. Create the AKS cluster! 1. Create the AKS cluster!
```bash
az aks create --resource-group $RESOURCE_GROUP \ ```bash
--name $CLUSTER_NAME \ az aks create --resource-group $RESOURCE_GROUP \
--generate-ssh-keys \ --name $CLUSTER_NAME \
--kubernetes-version 1.10.5 \ --generate-ssh-keys \
--enable-rbac \ --kubernetes-version 1.10.5 \
--node-vm-size Standard_DS3_v2 --enable-rbac \
``` --node-vm-size Standard_DS3_v2
```
1. Configure kubectl to use the new cluster. 1. Configure kubectl to use the new cluster.
```bash
az aks get-credentials --resource-group $RESOURCE_GROUP --name $CLUSTER_NAME --admin ```bash
``` az aks get-credentials --resource-group $RESOURCE_GROUP --name $CLUSTER_NAME --admin
```
1. Verify your cluster is up and running 1. Verify your cluster is up and running
```bash ```bash
kubectl get nodes kubectl get nodes
``` ```
## Installing Istio ## Installing Istio
Knative depends on Istio. Knative depends on Istio.
1. Install Istio: 1. Install Istio:
```bash ```bash
kubectl apply --filename https://raw.githubusercontent.com/knative/serving/v0.2.1/third_party/istio-1.0.2/istio.yaml kubectl apply --filename https://raw.githubusercontent.com/knative/serving/v0.2.1/third_party/istio-1.0.2/istio.yaml
``` ```
1. Label the default namespace with `istio-injection=enabled`: 1. Label the default namespace with `istio-injection=enabled`:
```bash
kubectl label namespace default istio-injection=enabled ```bash
``` kubectl label namespace default istio-injection=enabled
```
1. Monitor the Istio components until all of the components show a `STATUS` of 1. Monitor the Istio components until all of the components show a `STATUS` of
`Running` or `Completed`: `Running` or `Completed`:
```bash `bash kubectl get pods --namespace istio-system`
kubectl get pods --namespace istio-system
```
It will take a few minutes for all the components to be up and running; you can It will take a few minutes for all the components to be up and running; you can
rerun the command to see the current status. rerun the command to see the current status.
> Note: Instead of rerunning the command, you can add `--watch` to the above > Note: Instead of rerunning the command, you can add `--watch` to the above
command to view the component's status updates in real time. Use CTRL + C to exit watch mode. > command to view the component's status updates in real time. Use CTRL + C to exit watch mode.
## Installing Knative components ## Installing Knative components
@ -149,35 +147,36 @@ You can install the Knative Serving and Build components together, or Build on i
### Installing Knative Serving and Build components ### Installing Knative Serving and Build components
1. Run the `kubectl apply` command to install Knative and its dependencies: 1. Run the `kubectl apply` command to install Knative and its dependencies:
```bash ```bash
kubectl apply --filename https://github.com/knative/serving/releases/download/v0.2.1/release.yaml kubectl apply --filename https://github.com/knative/serving/releases/download/v0.2.1/release.yaml
``` ```
1. Monitor the Knative components until all of the components show a 1. Monitor the Knative components until all of the components show a
`STATUS` of `Running`: `STATUS` of `Running`:
```bash ```bash
kubectl get pods --namespace knative-serving kubectl get pods --namespace knative-serving
kubectl get pods --namespace knative-build kubectl get pods --namespace knative-build
``` ```
### Installing Knative Build only ### Installing Knative Build only
1. Run the `kubectl apply` command to install 1. Run the `kubectl apply` command to install
[Knative Build](https://github.com/knative/build) and its dependencies: [Knative Build](https://github.com/knative/build) and its dependencies:
```bash ```bash
kubectl apply --filename https://raw.githubusercontent.com/knative/serving/v0.2.1/third_party/config/build/release.yaml kubectl apply --filename https://raw.githubusercontent.com/knative/serving/v0.2.1/third_party/config/build/release.yaml
``` ```
1. Monitor the Knative Build components until all of the components show a 1. Monitor the Knative Build components until all of the components show a
`STATUS` of `Running`: `STATUS` of `Running`:
```bash ```bash
kubectl get pods --namespace knative-build kubectl get pods --namespace knative-build
```
Just as with the Istio components, it will take a few seconds for the Knative Just as with the Istio components, it will take a few seconds for the Knative
components to be up and running; you can rerun the `kubectl get` command to see components to be up and running; you can rerun the `kubectl get` command to see
the current status. the current status.
> Note: Instead of rerunning the command, you can add `--watch` to the above > Note: Instead of rerunning the command, you can add `--watch` to the above
command to view the component's status updates in real time. Use CTRL + C to > command to view the component's status updates in real time. Use CTRL + C to
exit watch mode. > exit watch mode.
You are now ready to deploy an app or create a build in your new Knative You are now ready to deploy an app or create a build in your new Knative
cluster. cluster.
@ -188,20 +187,21 @@ Now that your cluster has Knative installed, you're ready to deploy an app.
You have two options for deploying your first app: You have two options for deploying your first app:
* You can follow the step-by-step - You can follow the step-by-step
[Getting Started with Knative App Deployment](getting-started-knative-app.md) [Getting Started with Knative App Deployment](getting-started-knative-app.md)
guide. guide.
* You can view the available [sample apps](../serving/samples/README.md) and - You can view the available [sample apps](../serving/samples/README.md) and
deploy one of your choosing. deploy one of your choosing.
## Cleaning up ## Cleaning up
Running a cluster costs money, so you might want to delete the cluster when you're done if Running a cluster costs money, so you might want to delete the cluster when you're done if
you're not using it. Deleting the cluster will also remove Knative, Istio, you're not using it. Deleting the cluster will also remove Knative, Istio,
and any apps you've deployed. and any apps you've deployed.
To delete the cluster, enter the following command: To delete the cluster, enter the following command:
```bash ```bash
az aks delete --resource-group $RESOURCE_GROUP --name $CLUSTER_NAME --yes --no-wait az aks delete --resource-group $RESOURCE_GROUP --name $CLUSTER_NAME --yes --no-wait
``` ```

View File

@ -8,7 +8,7 @@ You can find [guides for other platforms here](README.md).
## Before you begin ## Before you begin
Knative requires a Kubernetes cluster v1.10 or newer. `kubectl` v1.10 is also Knative requires a Kubernetes cluster v1.10 or newer. `kubectl` v1.10 is also
required. This guide walks you through creating a cluster with the correct required. This guide walks you through creating a cluster with the correct
specifications for Knative on Google Cloud Platform (GCP). specifications for Knative on Google Cloud Platform (GCP).
This guide assumes you are using `bash` in a Mac or Linux environment; some This guide assumes you are using `bash` in a Mac or Linux environment; some
@ -18,22 +18,24 @@ commands will need to be adjusted for use in a Windows environment.
1. If you already have `gcloud` installed with `kubectl` version 1.10 or newer, 1. If you already have `gcloud` installed with `kubectl` version 1.10 or newer,
you can skip these steps. you can skip these steps.
> Tip: To check which version of `kubectl` you have installed, enter: > Tip: To check which version of `kubectl` you have installed, enter:
```
kubectl version ```
``` kubectl version
```
1. Download and install the `gcloud` command line tool: 1. Download and install the `gcloud` command line tool:
https://cloud.google.com/sdk/install https://cloud.google.com/sdk/install
1. Install the `kubectl` component: 1. Install the `kubectl` component:
``` ```
gcloud components install kubectl gcloud components install kubectl
``` ```
1. Authorize `gcloud`: 1. Authorize `gcloud`:
``` ```
gcloud auth login gcloud auth login
``` ```
### Setting environment variables ### Setting environment variables
@ -55,7 +57,7 @@ export CLUSTER_ZONE=us-west1-c
### Setting up a Google Cloud Platform project ### Setting up a Google Cloud Platform project
You need a Google Cloud Platform (GCP) project to create a Google Kubernetes Engine cluster. You need a Google Cloud Platform (GCP) project to create a Google Kubernetes Engine cluster.
1. Set `PROJECT` environment variable, you can replace `my-knative-project` with 1. Set `PROJECT` environment variable, you can replace `my-knative-project` with
the desired name of your GCP project. If you don't have one, we'll create one the desired name of your GCP project. If you don't have one, we'll create one
@ -64,6 +66,7 @@ You need a Google Cloud Platform (GCP) project to create a Google Kubernetes En
export PROJECT=my-knative-project export PROJECT=my-knative-project
``` ```
1. If you don't have a GCP project, create and set it as your `gcloud` default: 1. If you don't have a GCP project, create and set it as your `gcloud` default:
```bash ```bash
gcloud projects create $PROJECT --set-as-default gcloud projects create $PROJECT --set-as-default
``` ```
@ -72,11 +75,13 @@ You need a Google Cloud Platform (GCP) project to create a Google Kubernetes En
for your new project. for your new project.
1. If you already have a GCP project, make sure your project is set as your `gcloud` default: 1. If you already have a GCP project, make sure your project is set as your `gcloud` default:
```bash ```bash
gcloud config set core/project $PROJECT gcloud config set core/project $PROJECT
``` ```
> Tip: Enter `gcloud config get-value project` to view the ID of your default GCP project. > Tip: Enter `gcloud config get-value project` to view the ID of your default GCP project.
1. Enable the necessary APIs: 1. Enable the necessary APIs:
```bash ```bash
gcloud services enable \ gcloud services enable \
@ -90,29 +95,29 @@ You need a Google Cloud Platform (GCP) project to create a Google Kubernetes En
To make sure the cluster is large enough to host all the Knative and To make sure the cluster is large enough to host all the Knative and
Istio components, the recommended configuration for a cluster is: Istio components, the recommended configuration for a cluster is:
* Kubernetes version 1.10 or later - Kubernetes version 1.10 or later
* 4 vCPU nodes (`n1-standard-4`) - 4 vCPU nodes (`n1-standard-4`)
* Node autoscaling, up to 10 nodes - Node autoscaling, up to 10 nodes
* API scopes for `cloud-platform`, `logging-write`, `monitoring-write`, and - API scopes for `cloud-platform`, `logging-write`, `monitoring-write`, and
`pubsub` (if those features will be used) `pubsub` (if those features will be used)
1. Create a Kubernetes cluster on GKE with the required specifications: 1. Create a Kubernetes cluster on GKE with the required specifications:
```bash ```bash
gcloud container clusters create $CLUSTER_NAME \ gcloud container clusters create $CLUSTER_NAME \
--zone=$CLUSTER_ZONE \ --zone=$CLUSTER_ZONE \
--cluster-version=latest \ --cluster-version=latest \
--machine-type=n1-standard-4 \ --machine-type=n1-standard-4 \
--enable-autoscaling --min-nodes=1 --max-nodes=10 \ --enable-autoscaling --min-nodes=1 --max-nodes=10 \
--enable-autorepair \ --enable-autorepair \
--scopes=service-control,service-management,compute-rw,storage-ro,cloud-platform,logging-write,monitoring-write,pubsub,datastore \ --scopes=service-control,service-management,compute-rw,storage-ro,cloud-platform,logging-write,monitoring-write,pubsub,datastore \
--num-nodes=3 --num-nodes=3
``` ```
1. Grant cluster-admin permissions to the current user: 1. Grant cluster-admin permissions to the current user:
```bash ```bash
kubectl create clusterrolebinding cluster-admin-binding \ kubectl create clusterrolebinding cluster-admin-binding \
--clusterrole=cluster-admin \ --clusterrole=cluster-admin \
--user=$(gcloud config get-value core/account) --user=$(gcloud config get-value core/account)
``` ```
Admin permissions are required to create the necessary Admin permissions are required to create the necessary
[RBAC rules for Istio](https://istio.io/docs/concepts/security/rbac/). [RBAC rules for Istio](https://istio.io/docs/concepts/security/rbac/).
@ -122,24 +127,22 @@ Admin permissions are required to create the necessary
Knative depends on Istio. Knative depends on Istio.
1. Install Istio: 1. Install Istio:
```bash ```bash
kubectl apply --filename https://raw.githubusercontent.com/knative/serving/v0.2.1/third_party/istio-1.0.2/istio.yaml kubectl apply --filename https://raw.githubusercontent.com/knative/serving/v0.2.1/third_party/istio-1.0.2/istio.yaml
``` ```
1. Label the default namespace with `istio-injection=enabled`: 1. Label the default namespace with `istio-injection=enabled`:
```bash ```bash
kubectl label namespace default istio-injection=enabled kubectl label namespace default istio-injection=enabled
``` ```
1. Monitor the Istio components until all of the components show a `STATUS` of 1. Monitor the Istio components until all of the components show a `STATUS` of
`Running` or `Completed`: `Running` or `Completed`:
```bash `bash kubectl get pods --namespace istio-system`
kubectl get pods --namespace istio-system
```
It will take a few minutes for all the components to be up and running; you can It will take a few minutes for all the components to be up and running; you can
rerun the command to see the current status. rerun the command to see the current status.
> Note: Instead of rerunning the command, you can add `--watch` to the above > Note: Instead of rerunning the command, you can add `--watch` to the above
command to view the component's status updates in real time. Use CTRL + C to exit watch mode. > command to view the component's status updates in real time. Use CTRL + C to exit watch mode.
## Installing Knative components ## Installing Knative components
@ -148,35 +151,36 @@ You can install the Knative Serving and Build components together, or Build on i
### Installing Knative Serving and Build components ### Installing Knative Serving and Build components
1. Run the `kubectl apply` command to install Knative and its dependencies: 1. Run the `kubectl apply` command to install Knative and its dependencies:
```bash ```bash
kubectl apply --filename https://github.com/knative/serving/releases/download/v0.2.1/release.yaml kubectl apply --filename https://github.com/knative/serving/releases/download/v0.2.1/release.yaml
``` ```
1. Monitor the Knative components until all of the components show a 1. Monitor the Knative components until all of the components show a
`STATUS` of `Running`: `STATUS` of `Running`:
```bash ```bash
kubectl get pods --namespace knative-serving kubectl get pods --namespace knative-serving
kubectl get pods --namespace knative-build kubectl get pods --namespace knative-build
``` ```
### Installing Knative Build only ### Installing Knative Build only
1. Run the `kubectl apply` command to install 1. Run the `kubectl apply` command to install
[Knative Build](https://github.com/knative/build) and its dependencies: [Knative Build](https://github.com/knative/build) and its dependencies:
```bash ```bash
kubectl apply --filename https://raw.githubusercontent.com/knative/serving/v0.2.1/third_party/config/build/release.yaml kubectl apply --filename https://raw.githubusercontent.com/knative/serving/v0.2.1/third_party/config/build/release.yaml
``` ```
1. Monitor the Knative Build components until all of the components show a 1. Monitor the Knative Build components until all of the components show a
`STATUS` of `Running`: `STATUS` of `Running`:
```bash ```bash
kubectl get pods --namespace knative-build kubectl get pods --namespace knative-build
```
Just as with the Istio components, it will take a few seconds for the Knative Just as with the Istio components, it will take a few seconds for the Knative
components to be up and running; you can rerun the `kubectl get` command to see components to be up and running; you can rerun the `kubectl get` command to see
the current status. the current status.
> Note: Instead of rerunning the command, you can add `--watch` to the above > Note: Instead of rerunning the command, you can add `--watch` to the above
command to view the component's status updates in real time. Use CTRL + C to > command to view the component's status updates in real time. Use CTRL + C to
exit watch mode. > exit watch mode.
You are now ready to deploy an app or create a build in your new Knative You are now ready to deploy an app or create a build in your new Knative
cluster. cluster.
@ -189,14 +193,14 @@ create a build.
Depending on which Knative component you have installed, there are a few options Depending on which Knative component you have installed, there are a few options
for getting started: for getting started:
* You can follow the step-by-step - You can follow the step-by-step
[Getting Started with Knative App Deployment](getting-started-knative-app.md) [Getting Started with Knative App Deployment](getting-started-knative-app.md)
guide. guide.
* You can view the available [sample apps](../serving/samples/README.md) and - You can view the available [sample apps](../serving/samples/README.md) and
deploy one of your choosing. deploy one of your choosing.
* You can follow the step-by-step - You can follow the step-by-step
[Creating a simple Knative Build](../build/creating-builds.md) guide. [Creating a simple Knative Build](../build/creating-builds.md) guide.
## Cleaning up ## Cleaning up
@ -217,4 +221,3 @@ Except as otherwise noted, the content of this page is licensed under the
[Creative Commons Attribution 4.0 License](https://creativecommons.org/licenses/by/4.0/), [Creative Commons Attribution 4.0 License](https://creativecommons.org/licenses/by/4.0/),
and code samples are licensed under the and code samples are licensed under the
[Apache 2.0 License](https://www.apache.org/licenses/LICENSE-2.0). [Apache 2.0 License](https://www.apache.org/licenses/LICENSE-2.0).

View File

@ -94,35 +94,36 @@ You can install the Knative Serving and Build components together, or Build on i
### Installing Knative Serving and Build components ### Installing Knative Serving and Build components
1. Run the `kubectl apply` command to install Knative and its dependencies: 1. Run the `kubectl apply` command to install Knative and its dependencies:
```bash ```bash
kubectl apply --filename https://github.com/knative/serving/releases/download/v0.2.1/release.yaml kubectl apply --filename https://github.com/knative/serving/releases/download/v0.2.1/release.yaml
``` ```
1. Monitor the Knative components until all of the components show a 1. Monitor the Knative components until all of the components show a
`STATUS` of `Running`: `STATUS` of `Running`:
```bash ```bash
kubectl get pods --namespace knative-serving kubectl get pods --namespace knative-serving
kubectl get pods --namespace knative-build kubectl get pods --namespace knative-build
``` ```
### Installing Knative Build only ### Installing Knative Build only
1. Run the `kubectl apply` command to install 1. Run the `kubectl apply` command to install
[Knative Build](https://github.com/knative/build) and its dependencies: [Knative Build](https://github.com/knative/build) and its dependencies:
```bash ```bash
kubectl apply --filename https://raw.githubusercontent.com/knative/serving/v0.2.1/third_party/config/build/release.yaml kubectl apply --filename https://raw.githubusercontent.com/knative/serving/v0.2.1/third_party/config/build/release.yaml
``` ```
1. Monitor the Knative Build components until all of the components show a 1. Monitor the Knative Build components until all of the components show a
`STATUS` of `Running`: `STATUS` of `Running`:
```bash ```bash
kubectl get pods --namespace knative-build kubectl get pods --namespace knative-build
```
Just as with the Istio components, it will take a few seconds for the Knative Just as with the Istio components, it will take a few seconds for the Knative
components to be up and running; you can rerun the `kubectl get` command to see components to be up and running; you can rerun the `kubectl get` command to see
the current status. the current status.
> Note: Instead of rerunning the command, you can add `--watch` to the above > Note: Instead of rerunning the command, you can add `--watch` to the above
command to view the component's status updates in real time. Use CTRL + C to > command to view the component's status updates in real time. Use CTRL + C to
exit watch mode. > exit watch mode.
You are now ready to deploy an app or create a build in your new Knative You are now ready to deploy an app or create a build in your new Knative
cluster. cluster.

View File

@ -1,10 +1,10 @@
# Knative Install on IBM Cloud Kubernetes Service (IKS) # Knative Install on IBM Cloud Kubernetes Service (IKS)
This guide walks you through the installation of the latest version of Knative This guide walks you through the installation of the latest version of Knative
using pre-built images. using pre-built images.
You may also have it all installed for you by clicking the button below: You may also have it all installed for you by clicking the button below:
[![Deploy to IBM Cloud](https://bluemix.net/deploy/button_x2.png)](https://console.bluemix.net/devops/setup/deploy?repository=https://git.ng.bluemix.net/start-with-knative/toolchain.git) [![Deploy to IBM Cloud](https://bluemix.net/deploy/button_x2.png)](https://console.bluemix.net/devops/setup/deploy?repository=https://git.ng.bluemix.net/start-with-knative/toolchain.git)
More [instructions on the deploy button here](https://git.ng.bluemix.net/start-with-knative/toolchain/blob/master/README.md). More [instructions on the deploy button here](https://git.ng.bluemix.net/start-with-knative/toolchain/blob/master/README.md).
@ -162,35 +162,36 @@ You can install the Knative Serving and Build components together, or Build on i
### Installing Knative Serving and Build components ### Installing Knative Serving and Build components
1. Run the `kubectl apply` command to install Knative and its dependencies: 1. Run the `kubectl apply` command to install Knative and its dependencies:
```bash ```bash
kubectl apply --filename https://github.com/knative/serving/releases/download/v0.2.1/release.yaml kubectl apply --filename https://github.com/knative/serving/releases/download/v0.2.1/release.yaml
``` ```
1. Monitor the Knative components until all of the components show a 1. Monitor the Knative components until all of the components show a
`STATUS` of `Running`: `STATUS` of `Running`:
```bash ```bash
kubectl get pods --namespace knative-serving kubectl get pods --namespace knative-serving
kubectl get pods --namespace knative-build kubectl get pods --namespace knative-build
``` ```
### Installing Knative Build only ### Installing Knative Build only
1. Run the `kubectl apply` command to install 1. Run the `kubectl apply` command to install
[Knative Build](https://github.com/knative/build) and its dependencies: [Knative Build](https://github.com/knative/build) and its dependencies:
```bash ```bash
kubectl apply --filename https://raw.githubusercontent.com/knative/serving/v0.2.1/third_party/config/build/release.yaml kubectl apply --filename https://raw.githubusercontent.com/knative/serving/v0.2.1/third_party/config/build/release.yaml
``` ```
1. Monitor the Knative Build components until all of the components show a 1. Monitor the Knative Build components until all of the components show a
`STATUS` of `Running`: `STATUS` of `Running`:
```bash ```bash
kubectl get pods --namespace knative-build kubectl get pods --namespace knative-build
```
Just as with the Istio components, it will take a few seconds for the Knative Just as with the Istio components, it will take a few seconds for the Knative
components to be up and running; you can rerun the `kubectl get` command to see components to be up and running; you can rerun the `kubectl get` command to see
the current status. the current status.
> Note: Instead of rerunning the command, you can add `--watch` to the above > Note: Instead of rerunning the command, you can add `--watch` to the above
command to view the component's status updates in real time. Use CTRL + C to > command to view the component's status updates in real time. Use CTRL + C to
exit watch mode. > exit watch mode.
You are now ready to deploy an app or create a build in your new Knative You are now ready to deploy an app or create a build in your new Knative
cluster. cluster.

View File

@ -15,14 +15,14 @@ you can create one using [Minikube](https://github.com/kubernetes/minikube).
### Install kubectl and Minikube ### Install kubectl and Minikube
1. If you already have `kubectl` CLI, run `kubectl version` to check the 1. If you already have `kubectl` CLI, run `kubectl version` to check the
version. You need v1.10 or newer. If your `kubectl` is older, follow version. You need v1.10 or newer. If your `kubectl` is older, follow
the next step to install a newer version. the next step to install a newer version.
1. [Install the kubectl CLI](https://kubernetes.io/docs/tasks/tools/install-kubectl/#install-kubectl). 1. [Install the kubectl CLI](https://kubernetes.io/docs/tasks/tools/install-kubectl/#install-kubectl).
1. [Install and configure minikube](https://github.com/kubernetes/minikube#installation) 1. [Install and configure minikube](https://github.com/kubernetes/minikube#installation)
version v0.28.1 or later with a [VM driver](https://github.com/kubernetes/minikube#requirements), version v0.28.1 or later with a [VM driver](https://github.com/kubernetes/minikube#requirements),
e.g. `kvm2` on Linux or `hyperkit` on macOS. e.g. `kvm2` on Linux or `hyperkit` on macOS.
## Creating a Kubernetes cluster ## Creating a Kubernetes cluster
@ -74,7 +74,7 @@ It will take a few minutes for all the components to be up and running; you can
rerun the command to see the current status. rerun the command to see the current status.
> Note: Instead of rerunning the command, you can add `--watch` to the above > Note: Instead of rerunning the command, you can add `--watch` to the above
command to view the component's status updates in real time. Use CTRL+C to exit watch mode. > command to view the component's status updates in real time. Use CTRL+C to exit watch mode.
## Installing Knative Serving ## Installing Knative Serving
@ -102,7 +102,7 @@ Just as with the Istio components, it will take a few seconds for the Knative
components to be up and running; you can rerun the command to see the current status. components to be up and running; you can rerun the command to see the current status.
> Note: Instead of rerunning the command, you can add `--watch` to the above > Note: Instead of rerunning the command, you can add `--watch` to the above
command to view the component's status updates in real time. Use CTRL+C to exit watch mode. > command to view the component's status updates in real time. Use CTRL+C to exit watch mode.
Now you can deploy an app to your newly created Knative cluster. Now you can deploy an app to your newly created Knative cluster.
@ -119,12 +119,13 @@ If you'd like to view the available sample apps and deploy one of your choosing,
head to the [sample apps](../serving/samples/README.md) repo. head to the [sample apps](../serving/samples/README.md) repo.
> Note: When looking up the IP address to use for accessing your app, you need to look up > Note: When looking up the IP address to use for accessing your app, you need to look up
the NodePort for the `knative-ingressgateway` as well as the IP address used for Minikube. > the NodePort for the `knative-ingressgateway` as well as the IP address used for Minikube.
You can use the following command to look up the value to use for the {IP_ADDRESS} placeholder > You can use the following command to look up the value to use for the {IP_ADDRESS} placeholder
used in the samples: > used in the samples:
```shell
echo $(minikube ip):$(kubectl get svc knative-ingressgateway --namespace istio-system --output 'jsonpath={.spec.ports[?(@.port==80)].nodePort}') ```shell
``` echo $(minikube ip):$(kubectl get svc knative-ingressgateway --namespace istio-system --output 'jsonpath={.spec.ports[?(@.port==80)].nodePort}')
```
## Cleaning up ## Cleaning up

View File

@ -53,9 +53,9 @@ minishift addons enable anyuid
minishift start minishift start
``` ```
- The above configuration ensures that Knative gets created in its own [minishift profile](https://docs.okd.io/latest/minishift/using/profiles.html) called `knative` with 8GB of RAM, 4 vCpus and 50GB of hard disk. The image-caching helps in re-starting up the cluster faster every time. - The above configuration ensures that Knative gets created in its own [minishift profile](https://docs.okd.io/latest/minishift/using/profiles.html) called `knative` with 8GB of RAM, 4 vCpus and 50GB of hard disk. The image-caching helps in re-starting up the cluster faster every time.
- The [addon](https://docs.okd.io/latest/minishift/using/addons.html) **admin-user** creates a user called `admin` with password `admin` having the role of cluster-admin. The user gets created only after the addon is applied, that is usually after successful start of Minishift - The [addon](https://docs.okd.io/latest/minishift/using/addons.html) **admin-user** creates a user called `admin` with password `admin` having the role of cluster-admin. The user gets created only after the addon is applied, that is usually after successful start of Minishift
- The [addon](https://docs.okd.io/latest/minishift/using/addons.html) **anyuid** allows the `default` service account to run the application with uid `0` - The [addon](https://docs.okd.io/latest/minishift/using/addons.html) **anyuid** allows the `default` service account to run the application with uid `0`
- The command `minishift profile set knative` is required every time you start and stop minishift to make sure that you are on right `knative` minishift profile that was configured above. - The command `minishift profile set knative` is required every time you start and stop minishift to make sure that you are on right `knative` minishift profile that was configured above.
@ -73,7 +73,8 @@ minishift oc-env
## Preparing Knative Deployment ## Preparing Knative Deployment
### Enable Admission Controller Webhook ### Enable Admission Controller Webhook
To be able to deploy and run serverless Knative applications, its required that you must enable the [Admission Controller Webhook](https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/).
To be able to deploy and run serverless Knative applications, its required that you must enable the [Admission Controller Webhook](https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/).
Run the following command to make OpenShift (run via minishift) to be configured for [Admission Controller Webhook](https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/): Run the following command to make OpenShift (run via minishift) to be configured for [Admission Controller Webhook](https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/):
@ -110,41 +111,41 @@ until oc login -u admin -p admin; do sleep 5; done;
1. Set up the project **myproject** for use with Knative applications. 1. Set up the project **myproject** for use with Knative applications.
```shell ```shell
oc project myproject oc project myproject
oc adm policy add-scc-to-user privileged -z default oc adm policy add-scc-to-user privileged -z default
oc label namespace myproject istio-injection=enabled oc label namespace myproject istio-injection=enabled
``` ```
The `oc adm policy` adds the **privileged** [Security Context Constraints(SCCs)](https://docs.okd.io/3.10/admin_guide/manage_scc.html) to the **default** Service Account. The SCCs are the precursor to the PSP (Pod Security Policy) mechanism in Kubernetes, as isito-sidecars required to be run with **privileged** permissions you need set that here.
Its is also ensured that the project myproject is labelled for Istio automatic sidecar injection, with this `istio-injection=enabled` label to **myproject** each of the Knative applications that will be deployed in **myproject** will have Istio sidecars injected automatically. The `oc adm policy` adds the **privileged** [Security Context Constraints(SCCs)](https://docs.okd.io/3.10/admin_guide/manage_scc.html) to the **default** Service Account. The SCCs are the precursor to the PSP (Pod Security Policy) mechanism in Kubernetes, as isito-sidecars required to be run with **privileged** permissions you need set that here.
> **IMPORTANT:** Avoid using `default` project in OpenShift for deploying Knative applications. As OpenShift deploys few of its mission critical applications in `default` project, it's safer not to touch it to avoid any instabilities in OpenShift. Its is also ensured that the project myproject is labelled for Istio automatic sidecar injection, with this `istio-injection=enabled` label to **myproject** each of the Knative applications that will be deployed in **myproject** will have Istio sidecars injected automatically.
> **IMPORTANT:** Avoid using `default` project in OpenShift for deploying Knative applications. As OpenShift deploys few of its mission critical applications in `default` project, it's safer not to touch it to avoid any instabilities in OpenShift.
### Installing Istio ### Installing Istio
Knative depends on Istio. The [istio-openshift-policies.sh](scripts/istio-openshift-policies.sh) does run the required commands to configure necessary [privileges](https://istio.io/docs/setup/kubernetes/platform-setup/openshift/) to the service accounts used by Istio. Knative depends on Istio. The [istio-openshift-policies.sh](scripts/istio-openshift-policies.sh) does run the required commands to configure necessary [privileges](https://istio.io/docs/setup/kubernetes/platform-setup/openshift/) to the service accounts used by Istio.
```shell ```shell
curl -s https://raw.githubusercontent.com/knative/docs/master/install/scripts/istio-openshift-policies.sh | bash curl -s https://raw.githubusercontent.com/knative/docs/master/install/scripts/istio-openshift-policies.sh | bash
``` ```
1. Run the following to install Istio: 1. Run the following to install Istio:
```shell ```shell
oc apply -f https://storage.googleapis.com/knative-releases/serving/latest/istio.yaml oc apply -f https://storage.googleapis.com/knative-releases/serving/latest/istio.yaml
``` ```
> **NOTE:** If you get a lot of errors after running the above command like: __unable to recognize "STDIN": no matches for kind "Gateway" in version "networking.istio.io/v1alpha3"__, just run the command above again, it's idempotent and hence objects will be created only once.
> **NOTE:** If you get a lot of errors after running the above command like: **unable to recognize "STDIN": no matches for kind "Gateway" in version "networking.istio.io/v1alpha3"**, just run the command above again, it's idempotent and hence objects will be created only once.
2. Ensure the istio-sidecar-injector pods runs as provileged: 2. Ensure the istio-sidecar-injector pods runs as provileged:
```shell ```shell
oc get cm istio-sidecar-injector -n istio-system -oyaml | sed -e 's/securityContext:/securityContext:\\n privileged: true/' | oc replace -f - oc get cm istio-sidecar-injector -n istio-system -oyaml | sed -e 's/securityContext:/securityContext:\\n privileged: true/' | oc replace -f -
``` ```
3. Monitor the Istio components until all of the components show a `STATUS` of `Running` or `Completed`: 3. Monitor the Istio components until all of the components show a `STATUS` of `Running` or `Completed`:
```shell `shell while oc get pods -n istio-system | grep -v -E "(Running|Completed|STATUS)"; do sleep 5; done`
while oc get pods -n istio-system | grep -v -E "(Running|Completed|STATUS)"; do sleep 5; done > **NOTE:** It will take a few minutes for all the components to be up and running.
```
> **NOTE:** It will take a few minutes for all the components to be up and running.
## Install Knative Serving ## Install Knative Serving
@ -156,33 +157,35 @@ The [knative-openshift-policies.sh](scripts/knative-openshift-policies.sh) runs
curl -s https://raw.githubusercontent.com/knative/docs/master/install/scripts/knative-openshift-policies.sh | bash curl -s https://raw.githubusercontent.com/knative/docs/master/install/scripts/knative-openshift-policies.sh | bash
``` ```
>You can safely ignore the warnings: > You can safely ignore the warnings:
- Warning: ServiceAccount 'build-controller' not found cluster role "cluster-admin" added: "build-controller" - Warning: ServiceAccount 'build-controller' not found cluster role "cluster-admin" added: "build-controller"
- Warning: ServiceAccount 'controller' not found cluster role "cluster-admin" added: "controller" - Warning: ServiceAccount 'controller' not found cluster role "cluster-admin" added: "controller"
1. Install Knative serving: 1. Install Knative serving:
```shell ```shell
oc apply -f https://storage.googleapis.com/knative-releases/serving/latest/release-no-mon.yaml oc apply -f https://storage.googleapis.com/knative-releases/serving/latest/release-no-mon.yaml
``` ```
2. Monitor the Knative components until all of the components show a `STATUS` of `Running` or `Completed`: 2. Monitor the Knative components until all of the components show a `STATUS` of `Running` or `Completed`:
```shell ```shell
while oc get pods -n knative-build | grep -v -E "(Running|Completed|STATUS)"; do sleep 5; done while oc get pods -n knative-build | grep -v -E "(Running|Completed|STATUS)"; do sleep 5; done
while oc get pods -n knative-serving | grep -v -E "(Running|Completed|STATUS)"; do sleep 5; done while oc get pods -n knative-serving | grep -v -E "(Running|Completed|STATUS)"; do sleep 5; done
``` ```
The first command watches for all pod status in `knative-build` and the second command will watch for all pod status in `knative-serving`.
> **NOTE:** It will take a few minutes for all the components to be up and running. The first command watches for all pod status in `knative-build` and the second command will watch for all pod status in `knative-serving`.
3. Set route to access the OpenShift ingress CIDR, so that services can be accessed via LoadBalancerIP > **NOTE:** It will take a few minutes for all the components to be up and running.
```shell
# Only for macOS 3. Set route to access the OpenShift ingress CIDR, so that services can be accessed via LoadBalancerIP
sudo route -n add -net $(minishift openshift config view | grep ingressIPNetworkCIDR | awk '{print $NF}') $(minishift ip) ```shell
# Only for Linux # Only for macOS
sudo ip route add $(minishift openshift config view | grep ingressIPNetworkCIDR | sed 's/\r$//' | awk '{print $NF}') via $(minishift ip) sudo route -n add -net $(minishift openshift config view | grep ingressIPNetworkCIDR | awk '{print $NF}') $(minishift ip)
``` # Only for Linux
sudo ip route add $(minishift openshift config view | grep ingressIPNetworkCIDR | sed 's/\r$//' | awk '{print $NF}') via $(minishift ip)
```
## Deploying an app ## Deploying an app
@ -210,7 +213,7 @@ spec:
' | oc create -f - ' | oc create -f -
# Wait for the hello pod to enter its `Running` state # Wait for the hello pod to enter its `Running` state
oc get pod --watch oc get pod --watch
# Call the service # Call the service
export IP_ADDRESS=$(oc get svc knative-ingressgateway -n istio-system -o 'jsonpath={.status.loadBalancer.ingress[0].ip}') export IP_ADDRESS=$(oc get svc knative-ingressgateway -n istio-system -o 'jsonpath={.status.loadBalancer.ingress[0].ip}')
# This should output 'Hello World: Go Sample v1!' # This should output 'Hello World: Go Sample v1!'
curl -H "Host: helloworld-go.myproject.example.com" http://$IP_ADDRESS curl -H "Host: helloworld-go.myproject.example.com" http://$IP_ADDRESS
@ -237,10 +240,11 @@ There are two ways to clean up, either deleting the entire minishift profile or
2. Delete your test cluster by running: 2. Delete your test cluster by running:
```shell ```shell
minishift stop minishift stop
minishift profile delete knative minishift profile delete knative
``` ```
--- ---
Except as otherwise noted, the content of this page is licensed under the Except as otherwise noted, the content of this page is licensed under the

View File

@ -131,8 +131,8 @@ It will take a few minutes for all the components to be up and running; you can
rerun the command to see the current status. rerun the command to see the current status.
> Note: Instead of rerunning the command, you can add `--watch` to the above > Note: Instead of rerunning the command, you can add `--watch` to the above
command to view the component's status updates in real time. Use CTRL+C to exit watch mode. > command to view the component's status updates in real time. Use CTRL+C to exit watch mode.
Set `priviledged` to `true` for the `istio-sidecar-injector`: Set `priviledged` to `true` for the `istio-sidecar-injector`:
```shell ```shell
@ -190,7 +190,7 @@ Just as with the Istio components, it will take a few seconds for the Knative
components to be up and running; you can rerun the command to see the current status. components to be up and running; you can rerun the command to see the current status.
> Note: Instead of rerunning the command, you can add `--watch` to the above > Note: Instead of rerunning the command, you can add `--watch` to the above
command to view the component's status updates in real time. Use CTRL+C to exit watch mode. > command to view the component's status updates in real time. Use CTRL+C to exit watch mode.
Now you can deploy an app to your newly created Knative cluster. Now you can deploy an app to your newly created Knative cluster.
@ -207,13 +207,13 @@ If you'd like to view the available sample apps and deploy one of your choosing,
head to the [sample apps](../serving/samples/README.md) repo. head to the [sample apps](../serving/samples/README.md) repo.
> Note: When looking up the IP address to use for accessing your app, you need to look up > Note: When looking up the IP address to use for accessing your app, you need to look up
the NodePort for the `knative-ingressgateway` as well as the IP address used for OpenShift. > the NodePort for the `knative-ingressgateway` as well as the IP address used for OpenShift.
You can use the following command to look up the value to use for the {IP_ADDRESS} placeholder > You can use the following command to look up the value to use for the {IP_ADDRESS} placeholder
used in the samples: > used in the samples:
```shell ```shell
export IP_ADDRESS=$(oc get node -o 'jsonpath={.items[0].status.addresses[0].address}'):$(oc get svc knative-ingressgateway -n istio-system -o 'jsonpath={.spec.ports[?(@.port==80)].nodePort}') export IP_ADDRESS=$(oc get node -o 'jsonpath={.items[0].status.addresses[0].address}'):$(oc get svc knative-ingressgateway -n istio-system -o 'jsonpath={.spec.ports[?(@.port==80)].nodePort}')
``` ```
## Cleaning up ## Cleaning up
@ -229,4 +229,4 @@ rm -rf openshift.local.clusterup
Except as otherwise noted, the content of this page is licensed under the Except as otherwise noted, the content of this page is licensed under the
[Creative Commons Attribution 4.0 License](https://creativecommons.org/licenses/by/4.0/), [Creative Commons Attribution 4.0 License](https://creativecommons.org/licenses/by/4.0/),
and code samples are licensed under the and code samples are licensed under the
[Apache 2.0 License](https://www.apache.org/licenses/LICENSE-2.0). [Apache 2.0 License](https://www.apache.org/licenses/LICENSE-2.0).

View File

@ -8,7 +8,7 @@ You can find [guides for other platforms here](README.md).
## Before you begin ## Before you begin
Knative requires a Kubernetes cluster v1.10 or newer. `kubectl` v1.10 is also Knative requires a Kubernetes cluster v1.10 or newer. `kubectl` v1.10 is also
required. This guide walks you through creating a cluster with the correct required. This guide walks you through creating a cluster with the correct
specifications for Knative on Pivotal Container Service. specifications for Knative on Pivotal Container Service.
This guide assumes you are using bash in a Mac or Linux environment; some This guide assumes you are using bash in a Mac or Linux environment; some
@ -27,9 +27,9 @@ To enable privileged mode and create a cluster:
1. Enable privileged mode: 1. Enable privileged mode:
1. Open the Pivotal Container Service tile in PCF Ops Manager. 1. Open the Pivotal Container Service tile in PCF Ops Manager.
1. In the plan configuration that you want to use, enable both of the following: 1. In the plan configuration that you want to use, enable both of the following:
* Enable Privileged Containers - Use with caution - Enable Privileged Containers - Use with caution
* Disable DenyEscalatingExec - Disable DenyEscalatingExec
1. Save your changes. 1. Save your changes.
1. In the PCF Ops Manager, review and then apply your changes. 1. In the PCF Ops Manager, review and then apply your changes.
1. [Create a cluster](https://docs.pivotal.io/runtimes/pks/1-1/create-cluster.html). 1. [Create a cluster](https://docs.pivotal.io/runtimes/pks/1-1/create-cluster.html).
@ -42,24 +42,22 @@ To retrieve your cluster credentials, follow the documentation at https://docs.p
Knative depends on Istio. Istio workloads require privileged mode for Init Containers Knative depends on Istio. Istio workloads require privileged mode for Init Containers
1. Install Istio: 1. Install Istio:
```bash ```bash
kubectl apply --filename https://raw.githubusercontent.com/knative/serving/v0.2.1/third_party/istio-1.0.2/istio.yaml kubectl apply --filename https://raw.githubusercontent.com/knative/serving/v0.2.1/third_party/istio-1.0.2/istio.yaml
``` ```
1. Label the default namespace with `istio-injection=enabled`: 1. Label the default namespace with `istio-injection=enabled`:
```bash ```bash
kubectl label namespace default istio-injection=enabled kubectl label namespace default istio-injection=enabled
``` ```
1. Monitor the Istio components until all of the components show a `STATUS` of 1. Monitor the Istio components until all of the components show a `STATUS` of
`Running` or `Completed`: `Running` or `Completed`:
```bash `bash kubectl get pods --namespace istio-system`
kubectl get pods --namespace istio-system
```
It will take a few minutes for all the components to be up and running; you can It will take a few minutes for all the components to be up and running; you can
rerun the command to see the current status. rerun the command to see the current status.
> Note: Instead of rerunning the command, you can add `--watch` to the above > Note: Instead of rerunning the command, you can add `--watch` to the above
command to view the component's status updates in real time. Use CTRL + C to exit watch mode. > command to view the component's status updates in real time. Use CTRL + C to exit watch mode.
## Installing Knative components ## Installing Knative components
@ -68,35 +66,36 @@ You can install the Knative Serving and Build components together, or Build on i
### Installing Knative Serving and Build components ### Installing Knative Serving and Build components
1. Run the `kubectl apply` command to install Knative and its dependencies: 1. Run the `kubectl apply` command to install Knative and its dependencies:
```bash ```bash
kubectl apply --filename https://github.com/knative/serving/releases/download/v0.2.1/release.yaml kubectl apply --filename https://github.com/knative/serving/releases/download/v0.2.1/release.yaml
``` ```
1. Monitor the Knative components until all of the components show a 1. Monitor the Knative components until all of the components show a
`STATUS` of `Running`: `STATUS` of `Running`:
```bash ```bash
kubectl get pods --namespace knative-serving kubectl get pods --namespace knative-serving
kubectl get pods --namespace knative-build kubectl get pods --namespace knative-build
``` ```
### Installing Knative Build only ### Installing Knative Build only
1. Run the `kubectl apply` command to install 1. Run the `kubectl apply` command to install
[Knative Build](https://github.com/knative/build) and its dependencies: [Knative Build](https://github.com/knative/build) and its dependencies:
```bash ```bash
kubectl apply --filename https://raw.githubusercontent.com/knative/serving/v0.2.1/third_party/config/build/release.yaml kubectl apply --filename https://raw.githubusercontent.com/knative/serving/v0.2.1/third_party/config/build/release.yaml
``` ```
1. Monitor the Knative Build components until all of the components show a 1. Monitor the Knative Build components until all of the components show a
`STATUS` of `Running`: `STATUS` of `Running`:
```bash ```bash
kubectl get pods --namespace knative-build kubectl get pods --namespace knative-build
```
Just as with the Istio components, it will take a few seconds for the Knative Just as with the Istio components, it will take a few seconds for the Knative
components to be up and running; you can rerun the `kubectl get` command to see components to be up and running; you can rerun the `kubectl get` command to see
the current status. the current status.
> Note: Instead of rerunning the command, you can add `--watch` to the above > Note: Instead of rerunning the command, you can add `--watch` to the above
command to view the component's status updates in real time. Use CTRL + C to > command to view the component's status updates in real time. Use CTRL + C to
exit watch mode. > exit watch mode.
You are now ready to deploy an app or create a build in your new Knative You are now ready to deploy an app or create a build in your new Knative
cluster. cluster.
@ -107,11 +106,11 @@ Now that your cluster has Knative installed, you're ready to deploy an app.
You have two options for deploying your first app: You have two options for deploying your first app:
* You can follow the step-by-step - You can follow the step-by-step
[Getting Started with Knative App Deployment](getting-started-knative-app.md) [Getting Started with Knative App Deployment](getting-started-knative-app.md)
guide. guide.
* You can view the available [sample apps](../serving/samples/README.md) and - You can view the available [sample apps](../serving/samples/README.md) and
deploy one of your choosing. deploy one of your choosing.
## Cleaning up ## Cleaning up

View File

@ -46,35 +46,36 @@ You can install the Knative Serving and Build components together, or Build on i
### Installing Knative Serving and Build components ### Installing Knative Serving and Build components
1. Run the `kubectl apply` command to install Knative and its dependencies: 1. Run the `kubectl apply` command to install Knative and its dependencies:
```bash ```bash
kubectl apply --filename https://github.com/knative/serving/releases/download/v0.2.2/release.yaml kubectl apply --filename https://github.com/knative/serving/releases/download/v0.2.2/release.yaml
``` ```
1. Monitor the Knative components until all of the components show a 1. Monitor the Knative components until all of the components show a
`STATUS` of `Running`: `STATUS` of `Running`:
```bash ```bash
kubectl get pods --namespace knative-serving kubectl get pods --namespace knative-serving
kubectl get pods --namespace knative-build kubectl get pods --namespace knative-build
``` ```
### Installing Knative Build only ### Installing Knative Build only
1. Run the `kubectl apply` command to install 1. Run the `kubectl apply` command to install
[Knative Build](https://github.com/knative/build) and its dependencies: [Knative Build](https://github.com/knative/build) and its dependencies:
```bash ```bash
kubectl apply --filename https://raw.githubusercontent.com/knative/serving/v0.2.2/third_party/config/build/release.yaml kubectl apply --filename https://raw.githubusercontent.com/knative/serving/v0.2.2/third_party/config/build/release.yaml
``` ```
1. Monitor the Knative Build components until all of the components show a 1. Monitor the Knative Build components until all of the components show a
`STATUS` of `Running`: `STATUS` of `Running`:
```bash ```bash
kubectl get pods --namespace knative-build kubectl get pods --namespace knative-build
```
Just as with the Istio components, it will take a few seconds for the Knative Just as with the Istio components, it will take a few seconds for the Knative
components to be up and running; you can rerun the `kubectl get` command to see components to be up and running; you can rerun the `kubectl get` command to see
the current status. the current status.
> Note: Instead of rerunning the command, you can add `--watch` to the above > Note: Instead of rerunning the command, you can add `--watch` to the above
command to view the component's status updates in real time. Use CTRL + C to > command to view the component's status updates in real time. Use CTRL + C to
exit watch mode. > exit watch mode.
You are now ready to deploy an app or create a build in your new Knative You are now ready to deploy an app or create a build in your new Knative
cluster. cluster.

View File

@ -1,6 +1,6 @@
# Installing Knative # Installing Knative
Follow this guide to install Knative components on a platform of your choice. Follow this guide to install Knative components on a platform of your choice.
## Choosing a Kubernetes cluster ## Choosing a Kubernetes cluster
@ -16,29 +16,29 @@ We provide information for installing Knative on
Follow these step-by-step guides for setting up Kubernetes and installing Follow these step-by-step guides for setting up Kubernetes and installing
Knative components on the following platforms: Knative components on the following platforms:
* [Knative Install on Azure Kubernetes Service](Knative-with-AKS.md) - [Knative Install on Azure Kubernetes Service](Knative-with-AKS.md)
* [Knative Install on Gardener](Knative-with-Gardener.md) - [Knative Install on Gardener](Knative-with-Gardener.md)
* [Knative Install on Google Kubernetes Engine](Knative-with-GKE.md) - [Knative Install on Google Kubernetes Engine](Knative-with-GKE.md)
* [Knative Install on IBM Cloud Kubernetes Service](Knative-with-IKS.md) - [Knative Install on IBM Cloud Kubernetes Service](Knative-with-IKS.md)
* [Knative Install on Minikube](Knative-with-Minikube.md) - [Knative Install on Minikube](Knative-with-Minikube.md)
* [Knative Install on OpenShift](Knative-with-OpenShift.md) - [Knative Install on OpenShift](Knative-with-OpenShift.md)
* [Knative Install on Minishift](Knative-with-Minishift.md) - [Knative Install on Minishift](Knative-with-Minishift.md)
* [Knative Install on Pivotal Container Service](Knative-with-PKS.md) - [Knative Install on Pivotal Container Service](Knative-with-PKS.md)
If you already have a Kubernetes cluster you're comfortable installing If you already have a Kubernetes cluster you're comfortable installing
*alpha* software on, use the following instructions: _alpha_ software on, use the following instructions:
* [Knative Install on any Kubernetes](Knative-with-any-k8s.md) - [Knative Install on any Kubernetes](Knative-with-any-k8s.md)
## Deploying an app ## Deploying an app
Now you're ready to deploy an app: Now you're ready to deploy an app:
* Follow the step-by-step - Follow the step-by-step
[Getting Started with Knative App Deployment](getting-started-knative-app.md) [Getting Started with Knative App Deployment](getting-started-knative-app.md)
guide. guide.
* View the available [sample apps](../serving/samples) and deploy one of your - View the available [sample apps](../serving/samples) and deploy one of your
choosing. choosing.
## Configuring Knative Serving ## Configuring Knative Serving
@ -47,14 +47,14 @@ After your Knative installation is running, you can set up a custom domain with
a static IP address to be able to use Knative for publicly available services a static IP address to be able to use Knative for publicly available services
and set up an Istio IP range for outbound network access: and set up an Istio IP range for outbound network access:
* [Assign a static IP address](../serving/gke-assigning-static-ip-address.md) - [Assign a static IP address](../serving/gke-assigning-static-ip-address.md)
* [Configure a custom domain](../serving/using-a-custom-domain.md) - [Configure a custom domain](../serving/using-a-custom-domain.md)
* [Configure outbound network access](../serving/outbound-network-access.md) - [Configure outbound network access](../serving/outbound-network-access.md)
* [Configuring HTTPS with a custom certificate](../serving/using-an-ssl-cert.md) - [Configuring HTTPS with a custom certificate](../serving/using-an-ssl-cert.md)
## Checking the version of your Knative Serving installation ## Checking the version of your Knative Serving installation
* [Checking the version of your Knative Serving installation](check-install-version.md) - [Checking the version of your Knative Serving installation](check-install-version.md)
--- ---

View File

@ -11,16 +11,16 @@ This will return the description for the `knative-serving` controller; this
information contains the link to the container that was used to install Knative: information contains the link to the container that was used to install Knative:
```yaml ```yaml
...
---
Pod Template: Pod Template:
Labels: app=controller Labels: app=controller
Annotations: sidecar.istio.io/inject=false Annotations: sidecar.istio.io/inject=false
Service Account: controller Service Account: controller
Containers: Containers:
controller: controller:
# Link to container used for Knative install # Link to container used for Knative install
Image: gcr.io/knative-releases/github.com/knative/serving/cmd/controller@sha256:59abc8765d4396a3fc7cac27a932a9cc151ee66343fa5338fb7146b607c6e306 Image: gcr.io/knative-releases/github.com/knative/serving/cmd/controller@sha256:59abc8765d4396a3fc7cac27a932a9cc151ee66343fa5338fb7146b607c6e306
...
``` ```
Copy the full `gcr.io` link to the container and paste it into your browser. Copy the full `gcr.io` link to the container and paste it into your browser.

View File

@ -6,8 +6,9 @@ using cURL requests.
## Before you begin ## Before you begin
You need: You need:
* A Kubernetes cluster with [Knative installed](./README.md).
* An image of the app that you'd like to deploy available on a - A Kubernetes cluster with [Knative installed](./README.md).
- An image of the app that you'd like to deploy available on a
container registry. The image of the sample app used in container registry. The image of the sample app used in
this guide is available on Google Container Registry. this guide is available on Google Container Registry.
@ -19,7 +20,7 @@ the basic workflow for deploying an app, but these steps can be adapted for your
own application if you have an image of it available on [Docker Hub](https://docs.docker.com/docker-hub/repos/), [Google Container Registry](https://cloud.google.com/container-registry/docs/pushing-and-pulling), or another container image registry. own application if you have an image of it available on [Docker Hub](https://docs.docker.com/docker-hub/repos/), [Google Container Registry](https://cloud.google.com/container-registry/docs/pushing-and-pulling), or another container image registry.
The Hello World sample app reads in an `env` variable, `TARGET`, from the The Hello World sample app reads in an `env` variable, `TARGET`, from the
configuration `.yaml` file, then prints "Hello World: ${TARGET}!". If `TARGET` configuration `.yaml` file, then prints "Hello World: \${TARGET}!". If `TARGET`
isn't defined, it will print "NOT SPECIFIED". isn't defined, it will print "NOT SPECIFIED".
## Configuring your deployment ## Configuring your deployment
@ -50,8 +51,8 @@ spec:
container: container:
image: gcr.io/knative-samples/helloworld-go # The URL to the image of the app image: gcr.io/knative-samples/helloworld-go # The URL to the image of the app
env: env:
- name: TARGET # The environment variable printed out by the sample app - name: TARGET # The environment variable printed out by the sample app
value: "Go Sample v1" value: "Go Sample v1"
``` ```
If you want to deploy the sample app, leave the config file as-is. If you're If you want to deploy the sample app, leave the config file as-is. If you're
@ -61,16 +62,18 @@ the image accordingly.
## Deploying your app ## Deploying your app
From the directory where the new `service.yaml` file was created, apply the configuration: From the directory where the new `service.yaml` file was created, apply the configuration:
```bash ```bash
kubectl apply --filename service.yaml kubectl apply --filename service.yaml
``` ```
Now that your service is created, Knative will perform the following steps: Now that your service is created, Knative will perform the following steps:
* Create a new immutable revision for this version of the app.
* Perform network programming to create a route, ingress, service, and load - Create a new immutable revision for this version of the app.
balancer for your app. - Perform network programming to create a route, ingress, service, and load
* Automatically scale your pods up and down based on traffic, including to balancer for your app.
zero active pods. - Automatically scale your pods up and down based on traffic, including to
zero active pods.
### Interacting with your app ### Interacting with your app
@ -81,72 +84,75 @@ Note: If your cluster is new, it can take some time before the service is
asssigned an external IP address. asssigned an external IP address.
1. To find the IP address for your service, enter: 1. To find the IP address for your service, enter:
```shell ```shell
kubectl get svc knative-ingressgateway --namespace istio-system kubectl get svc knative-ingressgateway --namespace istio-system
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
knative-ingressgateway LoadBalancer 10.23.247.74 35.203.155.229 80:32380/TCP,443:32390/TCP,32400:32400/TCP 2d knative-ingressgateway LoadBalancer 10.23.247.74 35.203.155.229 80:32380/TCP,443:32390/TCP,32400:32400/TCP 2d
``` ```
Take note of the `EXTERNAL-IP` address.
You can also export the IP address as a variable with the following command:
```shell Take note of the `EXTERNAL-IP` address.
export IP_ADDRESS=$(kubectl get svc knative-ingressgateway --namespace istio-system --output 'jsonpath={.status.loadBalancer.ingress[0].ip}')
You can also export the IP address as a variable with the following command:
```shell
export IP_ADDRESS=$(kubectl get svc knative-ingressgateway --namespace istio-system --output 'jsonpath={.status.loadBalancer.ingress[0].ip}')
```
```
> Note: if you use minikube or a baremetal cluster that has no external load balancer, the > Note: if you use minikube or a baremetal cluster that has no external load balancer, the
`EXTERNAL-IP` field is shown as `<pending>`. You need to use `NodeIP` and `NodePort` to > `EXTERNAL-IP` field is shown as `<pending>`. You need to use `NodeIP` and `NodePort` to
interact your app instead. To get your app's `NodeIP` and `NodePort`, enter the following command: > interact your app instead. To get your app's `NodeIP` and `NodePort`, enter the following command:
```shell
export IP_ADDRESS=$(kubectl get node --output 'jsonpath={.items[0].status.addresses[0].address}'):$(kubectl get svc knative-ingressgateway --namespace istio-system --output 'jsonpath={.spec.ports[?(@.port==80)].nodePort}') ```shell
``` export IP_ADDRESS=$(kubectl get node --output 'jsonpath={.items[0].status.addresses[0].address}'):$(kubectl get svc knative-ingressgateway --namespace istio-system --output 'jsonpath={.spec.ports[?(@.port==80)].nodePort}')
```
1. To find the host URL for your service, enter: 1. To find the host URL for your service, enter:
```shell ```shell
kubectl get ksvc helloworld-go --output=custom-columns=NAME:.metadata.name,DOMAIN:.status.domain kubectl get ksvc helloworld-go --output=custom-columns=NAME:.metadata.name,DOMAIN:.status.domain
NAME DOMAIN NAME DOMAIN
helloworld-go helloworld-go.default.example.com helloworld-go helloworld-go.default.example.com
``` ```
You can also export the host URL as a variable using the following command: You can also export the host URL as a variable using the following command:
```shell
export HOST_URL=$(kubectl get ksvc helloworld-go --output jsonpath='{.status.domain}')
```
If you changed the name from `helloworld-go` to something else when creating ```shell
the `.yaml` file, replace `helloworld-go` in the above commands with the export HOST_URL=$(kubectl get ksvc helloworld-go --output jsonpath='{.status.domain}')
name you entered. ```
If you changed the name from `helloworld-go` to something else when creating
the `.yaml` file, replace `helloworld-go` in the above commands with the
name you entered.
1. Now you can make a request to your app and see the results. Replace 1. Now you can make a request to your app and see the results. Replace
`IP_ADDRESS` with the `EXTERNAL-IP` you wrote down, and replace `IP_ADDRESS` with the `EXTERNAL-IP` you wrote down, and replace
`helloworld-go.default.example.com` with the domain returned in the previous `helloworld-go.default.example.com` with the domain returned in the previous
step. step.
```shell ```shell
curl -H "Host: helloworld-go.default.example.com" http://${IP_ADDRESS} curl -H "Host: helloworld-go.default.example.com" http://${IP_ADDRESS}
Hello World: Go Sample v1! Hello World: Go Sample v1!
``` ```
If you exported the host URL And IP address as variables in the previous steps, you If you exported the host URL And IP address as variables in the previous steps, you
can use those variables to simplify your cURL request: can use those variables to simplify your cURL request:
```shell ```shell
curl -H "Host: ${HOST_URL}" http://${IP_ADDRESS} curl -H "Host: ${HOST_URL}" http://${IP_ADDRESS}
Hello World: Go Sample v1! Hello World: Go Sample v1!
``` ```
If you deployed your own app, you might want to customize this cURL
request to interact with your application.
It can take a few seconds for Knative to scale up your application and return If you deployed your own app, you might want to customize this cURL
a response. request to interact with your application.
> Note: Add `-v` option to get more detail if the `curl` command failed. It can take a few seconds for Knative to scale up your application and return
a response.
> Note: Add `-v` option to get more detail if the `curl` command failed.
You've successfully deployed your first application using Knative! You've successfully deployed your first application using Knative!

View File

@ -10,7 +10,7 @@ Knative community specifically for use with Knative.
### [`knctl`](https://github.com/cppforlife/knctl) ### [`knctl`](https://github.com/cppforlife/knctl)
`knctl` is an under-development CLI for working with Knative. `knctl` is an under-development CLI for working with Knative.
## Other Resources ## Other Resources
@ -78,9 +78,7 @@ packages by their [import paths](https://golang.org/doc/code.html#ImportPaths)
(e.g., `github.com/kaniko/serving/cmd/controller`) (e.g., `github.com/kaniko/serving/cmd/controller`)
The typical usage is `ko apply -f config.yaml`, which reads in the config YAML, The typical usage is `ko apply -f config.yaml`, which reads in the config YAML,
and looks for Go import paths representing runnable commands (i.e., `package and looks for Go import paths representing runnable commands (i.e., `package main`). When it finds a matching import path, `ko` builds the package using `go build` then pushes a container image containing that binary on top of a base
main`). When it finds a matching import path, `ko` builds the package using `go
build` then pushes a container image containing that binary on top of a base
image (by default, `gcr.io/distroless/base`) to image (by default, `gcr.io/distroless/base`) to
`$KO_DOCKER_REPO/unique-string`. After pushing those images, `ko` replaces `$KO_DOCKER_REPO/unique-string`. After pushing those images, `ko` replaces
instances of matched import paths with fully-qualified references to the images instances of matched import paths with fully-qualified references to the images
@ -89,17 +87,17 @@ it pushed.
So if `ko apply` was passed this config: So if `ko apply` was passed this config:
```yaml ```yaml
...
---
image: github.com/my/repo/cmd/foo image: github.com/my/repo/cmd/foo
...
``` ```
...it would produce YAML like: ...it would produce YAML like:
```yaml ```yaml
...
---
image: gcr.io/my-docker-repo/foo-zyxwvut@sha256:abcdef # image by digest image: gcr.io/my-docker-repo/foo-zyxwvut@sha256:abcdef # image by digest
...
``` ```
(This assumes that you have set the environment variable (This assumes that you have set the environment variable
@ -108,10 +106,11 @@ image: gcr.io/my-docker-repo/foo-zyxwvut@sha256:abcdef # image by digest
`ko apply` then passes this generated YAML config to `kubectl apply`. `ko apply` then passes this generated YAML config to `kubectl apply`.
`ko` also supports: `ko` also supports:
* `ko publish` to simply push images and not produce configs.
* `ko resolve` to push images and output the generated configs, but not - `ko publish` to simply push images and not produce configs.
`kubectl apply` them. - `ko resolve` to push images and output the generated configs, but not
* `ko delete` to simply passthrough to `kubectl delete` for convenience. `kubectl apply` them.
- `ko delete` to simply passthrough to `kubectl delete` for convenience.
`ko` is used during development and release of Knative components, but is not `ko` is used during development and release of Knative components, but is not
intended to be required for _users_ of Knative -- they should only need to intended to be required for _users_ of Knative -- they should only need to
@ -122,8 +121,7 @@ intended to be required for _users_ of Knative -- they should only need to
`skaffold` is a CLI tool to aid in iterative development for Kubernetes. `skaffold` is a CLI tool to aid in iterative development for Kubernetes.
Typically, you would write a [YAML Typically, you would write a [YAML
config](https://github.com/GoogleContainerTools/skaffold/blob/master/examples/annotated-skaffold.yaml) config](https://github.com/GoogleContainerTools/skaffold/blob/master/examples/annotated-skaffold.yaml)
describing to Skaffold how to build and deploy your app, then run `skaffold describing to Skaffold how to build and deploy your app, then run `skaffold dev`, which will watch your local source tree for changes and continuously
dev`, which will watch your local source tree for changes and continuously
builds and deploys based on your config when changes are detected. builds and deploys based on your config when changes are detected.
Skaffold supports many pluggable implementations for building and deploying. Skaffold supports many pluggable implementations for building and deploying.

View File

@ -1,4 +1,3 @@
# Knative Serving # Knative Serving
Knative Serving builds on Kubernetes and Istio to support deploying and serving Knative Serving builds on Kubernetes and Istio to support deploying and serving
@ -7,10 +6,10 @@ and scales to support advanced scenarios.
The Knative Serving project provides middleware primitives that enable: The Knative Serving project provides middleware primitives that enable:
* Rapid deployment of serverless containers - Rapid deployment of serverless containers
* Automatic scaling up and down to zero - Automatic scaling up and down to zero
* Routing and network programming for Istio components - Routing and network programming for Istio components
* Point-in-time snapshots of deployed code and configurations - Point-in-time snapshots of deployed code and configurations
## Serving resources ## Serving resources
@ -18,22 +17,22 @@ Knative Serving defines a set of objects as Kubernetes
Custom Resource Definitions (CRDs). These objects are used to define and control Custom Resource Definitions (CRDs). These objects are used to define and control
how your serverless workload behaves on the cluster: how your serverless workload behaves on the cluster:
* [Service](https://github.com/knative/serving/blob/master/docs/spec/spec.md#service): - [Service](https://github.com/knative/serving/blob/master/docs/spec/spec.md#service):
The `service.serving.knative.dev` resource automatically manages the whole The `service.serving.knative.dev` resource automatically manages the whole
lifecycle of your workload. It controls the creation of other lifecycle of your workload. It controls the creation of other
objects to ensure that your app has a route, a configuration, and a new revision objects to ensure that your app has a route, a configuration, and a new revision
for each update of the service. Service can be defined to always route traffic to the for each update of the service. Service can be defined to always route traffic to the
latest revision or to a pinned revision. latest revision or to a pinned revision.
* [Route](https://github.com/knative/serving/blob/master/docs/spec/spec.md#route): - [Route](https://github.com/knative/serving/blob/master/docs/spec/spec.md#route):
The `route.serving.knative.dev` resource maps a network endpoint to a one or The `route.serving.knative.dev` resource maps a network endpoint to a one or
more revisions. You can manage the traffic in several ways, including fractional more revisions. You can manage the traffic in several ways, including fractional
traffic and named routes. traffic and named routes.
* [Configuration](https://github.com/knative/serving/blob/master/docs/spec/spec.md#configuration): - [Configuration](https://github.com/knative/serving/blob/master/docs/spec/spec.md#configuration):
The `configuration.serving.knative.dev` resource maintains The `configuration.serving.knative.dev` resource maintains
the desired state for your deployment. It provides a clean separation between the desired state for your deployment. It provides a clean separation between
code and configuration and follows the Twelve-Factor App methodology. Modifying a configuration code and configuration and follows the Twelve-Factor App methodology. Modifying a configuration
creates a new revision. creates a new revision.
* [Revision](https://github.com/knative/serving/blob/master/docs/spec/spec.md#revision): - [Revision](https://github.com/knative/serving/blob/master/docs/spec/spec.md#revision):
The `revision.serving.knative.dev` resource is a point-in-time snapshot The `revision.serving.knative.dev` resource is a point-in-time snapshot
of the code and configuration for each modification made to the workload. Revisions of the code and configuration for each modification made to the workload. Revisions
are immutable objects and can be retained for as long as useful. are immutable objects and can be retained for as long as useful.
@ -55,29 +54,29 @@ in the Knative Serving repository.
## More samples and demos ## More samples and demos
* [Autoscaling with Knative Serving](./samples/autoscale-go/README.md) - [Autoscaling with Knative Serving](./samples/autoscale-go/README.md)
* [Source-to-URL with Knative Serving](./samples/source-to-url-go/README.md) - [Source-to-URL with Knative Serving](./samples/source-to-url-go/README.md)
* [Telemetry with Knative Serving](./samples/telemetry-go/README.md) - [Telemetry with Knative Serving](./samples/telemetry-go/README.md)
* [REST API sample](./samples/rest-api-go/README.md) - [REST API sample](./samples/rest-api-go/README.md)
## Setting up Logging and Metrics ## Setting up Logging and Metrics
* [Installing Logging, Metrics and Traces](./installing-logging-metrics-traces.md) - [Installing Logging, Metrics and Traces](./installing-logging-metrics-traces.md)
* [Accessing Logs](./accessing-logs.md) - [Accessing Logs](./accessing-logs.md)
* [Accessing Metrics](./accessing-metrics.md) - [Accessing Metrics](./accessing-metrics.md)
* [Accessing Traces](./accessing-traces.md) - [Accessing Traces](./accessing-traces.md)
* [Setting up a logging plugin](./setting-up-a-logging-plugin.md) - [Setting up a logging plugin](./setting-up-a-logging-plugin.md)
## Debugging Knative Serving issues ## Debugging Knative Serving issues
* [Debugging Application Issues](./debugging-application-issues.md) - [Debugging Application Issues](./debugging-application-issues.md)
* [Debugging Performance Issues](./debugging-performance-issues.md) - [Debugging Performance Issues](./debugging-performance-issues.md)
## Configuration and Networking ## Configuration and Networking
* [Configuring outbound network access](./outbound-network-access.md) - [Configuring outbound network access](./outbound-network-access.md)
* [Using a custom domain](./using-a-custom-domain.md) - [Using a custom domain](./using-a-custom-domain.md)
* [Assigning a static IP address for Knative on Google Kubernetes Engine](./gke-assigning-static-ip-address.md) - [Assigning a static IP address for Knative on Google Kubernetes Engine](./gke-assigning-static-ip-address.md)
## Known Issues ## Known Issues

View File

@ -6,8 +6,9 @@ necessary components first.
## Kibana and Elasticsearch ## Kibana and Elasticsearch
* To open the Kibana UI (the visualization tool for [Elasticsearch](https://info.elastic.co)), - To open the Kibana UI (the visualization tool for [Elasticsearch](https://info.elastic.co)),
start a local proxy with the following command: start a local proxy with the following command:
```shell ```shell
kubectl proxy kubectl proxy
``` ```
@ -15,9 +16,9 @@ start a local proxy with the following command:
This command starts a local proxy of Kibana on port 8001. For security reasons, This command starts a local proxy of Kibana on port 8001. For security reasons,
the Kibana UI is exposed only within the cluster. the Kibana UI is exposed only within the cluster.
* Navigate to the - Navigate to the
[Kibana UI](http://localhost:8001/api/v1/namespaces/knative-monitoring/services/kibana-logging/proxy/app/kibana). [Kibana UI](http://localhost:8001/api/v1/namespaces/knative-monitoring/services/kibana-logging/proxy/app/kibana).
*It might take a couple of minutes for the proxy to work*. _It might take a couple of minutes for the proxy to work_.
The Discover tab of the Kibana UI looks like this: The Discover tab of the Kibana UI looks like this:
@ -26,9 +27,9 @@ start a local proxy with the following command:
You can change the time frame of logs Kibana displays in the upper right corner You can change the time frame of logs Kibana displays in the upper right corner
of the screen. The main search bar is across the top of the Discover page. of the screen. The main search bar is across the top of the Discover page.
* As more logs are ingested, new fields will be discovered. To have them indexed, - As more logs are ingested, new fields will be discovered. To have them indexed,
go to "Management" > "Index Patterns" > Refresh button (on top right) > "Refresh go to "Management" > "Index Patterns" > Refresh button (on top right) > "Refresh
fields". fields".
<!-- TODO: create a video walkthrough of the Kibana UI --> <!-- TODO: create a video walkthrough of the Kibana UI -->
@ -36,23 +37,28 @@ fields".
To access the logs for a configuration: To access the logs for a configuration:
* Find the configuration's name with the following command: - Find the configuration's name with the following command:
``` ```
kubectl get configurations kubectl get configurations
``` ```
* Replace `<CONFIGURATION_NAME>` and enter the following search query in Kibana: - Replace `<CONFIGURATION_NAME>` and enter the following search query in Kibana:
``` ```
kubernetes.labels.serving_knative_dev\/configuration: <CONFIGURATION_NAME> kubernetes.labels.serving_knative_dev\/configuration: <CONFIGURATION_NAME>
``` ```
To access logs for a revision: To access logs for a revision:
* Find the revision's name with the following command:
- Find the revision's name with the following command:
``` ```
kubectl get revisions kubectl get revisions
``` ```
* Replace `<REVISION_NAME>` and enter the following search query in Kibana: - Replace `<REVISION_NAME>` and enter the following search query in Kibana:
``` ```
kubernetes.labels.serving_knative_dev\/revision: <REVISION_NAME> kubernetes.labels.serving_knative_dev\/revision: <REVISION_NAME>
``` ```
@ -61,19 +67,23 @@ kubernetes.labels.serving_knative_dev\/revision: <REVISION_NAME>
To access logs for a [Knative Build](../build/README.md): To access logs for a [Knative Build](../build/README.md):
* Find the build's name in the specified in the `.yaml` file: - Find the build's name in the specified in the `.yaml` file:
```yaml ```yaml
apiVersion: build.knative.dev/v1alpha1 apiVersion: build.knative.dev/v1alpha1
kind: Build kind: Build
metadata: metadata:
name: <BUILD_NAME> name: <BUILD_NAME>
``` ```
Or find build names with the following command: Or find build names with the following command:
``` ```
kubectl get builds kubectl get builds
``` ```
* Replace `<BUILD_NAME>` and enter the following search query in Kibana: - Replace `<BUILD_NAME>` and enter the following search query in Kibana:
``` ```
kubernetes.labels.build\-name: <BUILD_NAME> kubernetes.labels.build\-name: <BUILD_NAME>
``` ```
@ -86,31 +96,31 @@ To access the request logs, enter the following search in Kibana:
tag: "requestlog.logentry.istio-system" tag: "requestlog.logentry.istio-system"
``` ```
Request logs contain details about requests served by the revision. Below is Request logs contain details about requests served by the revision. Below is
a sample request log: a sample request log:
```text ```text
@timestamp July 10th 2018, 10:09:28.000 @timestamp July 10th 2018, 10:09:28.000
destinationConfiguration configuration-example destinationConfiguration configuration-example
destinationNamespace default destinationNamespace default
destinationRevision configuration-example-00001 destinationRevision configuration-example-00001
destinationService configuration-example-00001-service.default.svc.cluster.local destinationService configuration-example-00001-service.default.svc.cluster.local
latency 1.232902ms latency 1.232902ms
method GET method GET
protocol http protocol http
referer unknown referer unknown
requestHost route-example.default.example.com requestHost route-example.default.example.com
requestSize 0 requestSize 0
responseCode 200 responseCode 200
responseSize 36 responseSize 36
severity Info severity Info
sourceNamespace istio-system sourceNamespace istio-system
sourceService unknown sourceService unknown
tag requestlog.logentry.istio-system tag requestlog.logentry.istio-system
traceId 986d6faa02d49533 traceId 986d6faa02d49533
url / url /
userAgent curl/7.60.0 userAgent curl/7.60.0
``` ```
### Accessing end to end request traces ### Accessing end to end request traces

View File

@ -4,28 +4,30 @@ You access metrics through the [Grafana](https://grafana.com/) UI. Grafana is
the visualization tool for [Prometheus](https://prometheus.io/). the visualization tool for [Prometheus](https://prometheus.io/).
1. To open Grafana, enter the following command: 1. To open Grafana, enter the following command:
``` ```
kubectl port-forward --namespace knative-monitoring $(kubectl get pods --namespace knative-monitoring --selector=app=grafana --output=jsonpath="{.items..metadata.name}") 3000 kubectl port-forward --namespace knative-monitoring $(kubectl get pods --namespace knative-monitoring --selector=app=grafana --output=jsonpath="{.items..metadata.name}") 3000
``` ```
* This starts a local proxy of Grafana on port 3000. For security reasons, the Grafana UI is exposed only within the cluster. - This starts a local proxy of Grafana on port 3000. For security reasons, the Grafana UI is exposed only within the cluster.
2. Navigate to the Grafana UI at [http://localhost:3000](http://localhost:3000). 2. Navigate to the Grafana UI at [http://localhost:3000](http://localhost:3000).
3. Select the **Home** button on the top of the page to see the list of pre-installed dashboards (screenshot below): 3. Select the **Home** button on the top of the page to see the list of pre-installed dashboards (screenshot below):
![Knative Dashboards](./images/grafana1.png) ![Knative Dashboards](./images/grafana1.png)
The following dashboards are pre-installed with Knative Serving: The following dashboards are pre-installed with Knative Serving:
* **Revision HTTP Requests:** HTTP request count, latency, and size metrics per revision and per configuration - **Revision HTTP Requests:** HTTP request count, latency, and size metrics per revision and per configuration
* **Nodes:** CPU, memory, network, and disk metrics at node level - **Nodes:** CPU, memory, network, and disk metrics at node level
* **Pods:** CPU, memory, and network metrics at pod level - **Pods:** CPU, memory, and network metrics at pod level
* **Deployment:** CPU, memory, and network metrics aggregated at deployment level - **Deployment:** CPU, memory, and network metrics aggregated at deployment level
* **Istio, Mixer and Pilot:** Detailed Istio mesh, Mixer, and Pilot metrics - **Istio, Mixer and Pilot:** Detailed Istio mesh, Mixer, and Pilot metrics
* **Kubernetes:** Dashboards giving insights into cluster health, deployments, and capacity usage - **Kubernetes:** Dashboards giving insights into cluster health, deployments, and capacity usage
4. Set up an administrator account to modify or add dashboards by signing in with username: `admin` and password: `admin`. 4. Set up an administrator account to modify or add dashboards by signing in with username: `admin` and password: `admin`.
* Before you expose the Grafana UI outside the cluster, make sure to change the password.
- Before you expose the Grafana UI outside the cluster, make sure to change the password.
--- ---

View File

@ -1,10 +1,10 @@
# Accessing request traces # Accessing request traces
If you have not yet installed the logging and monitoring components, go through the If you have not yet installed the logging and monitoring components, go through the
[installation instructions](./installing-logging-metrics-traces.md) to set up the [installation instructions](./installing-logging-metrics-traces.md) to set up the
necessary components. necessary components.
In order to access request traces, you use the Zipkin visualization tool. In order to access request traces, you use the Zipkin visualization tool.
1. To open the Zipkin UI, enter the following command: 1. To open the Zipkin UI, enter the following command:

View File

@ -71,17 +71,17 @@ conditions:
If you see this condition, check the following to continue debugging: If you see this condition, check the following to continue debugging:
* [Check Pod status](#check-pod-status) - [Check Pod status](#check-pod-status)
* [Check application logs](#check-application-logs) - [Check application logs](#check-application-logs)
If you see other conditions, to debug further: If you see other conditions, to debug further:
* Look up the meaning of the conditions in Knative - Look up the meaning of the conditions in Knative
[Error Conditions and Reporting](https://github.com/knative/serving/blob/master/docs/spec/errors.md). Note: some of them [Error Conditions and Reporting](https://github.com/knative/serving/blob/master/docs/spec/errors.md). Note: some of them
are not implemented yet. An alternative is to are not implemented yet. An alternative is to
[check Pod status](#check-pod-status). [check Pod status](#check-pod-status).
* If you are using `BUILD` to deploy and the `BuildComplete` condition is not - If you are using `BUILD` to deploy and the `BuildComplete` condition is not
`True`, [check BUILD status](#check-build-status). `True`, [check BUILD status](#check-build-status).
## Check Pod status ## Check Pod status
@ -124,9 +124,9 @@ Use any of the following filters within Kibana UI to
see build logs. _(See [telemetry guide](../telemetry.md) for more information on see build logs. _(See [telemetry guide](../telemetry.md) for more information on
logging and monitoring features of Knative Serving.)_ logging and monitoring features of Knative Serving.)_
* All build logs: `_exists_:"kubernetes.labels.build-name"` - All build logs: `_exists_:"kubernetes.labels.build-name"`
* Build logs for a specific build: `kubernetes.labels.build-name:"<BUILD NAME>"` - Build logs for a specific build: `kubernetes.labels.build-name:"<BUILD NAME>"`
* Build logs for a specific build and step: `kubernetes.labels.build-name:"<BUILD NAME>" AND kubernetes.container_name:"build-step-<BUILD STEP NAME>"` - Build logs for a specific build and step: `kubernetes.labels.build-name:"<BUILD NAME>" AND kubernetes.container_name:"build-step-<BUILD STEP NAME>"`
--- ---

View File

@ -1,15 +1,15 @@
# Investigating Performance Issues # Investigating Performance Issues
You deployed your application or function to Knative Serving but its performance You deployed your application or function to Knative Serving but its performance
doesn't meet your expectations. Knative Serving provides various dashboards and tools to doesn't meet your expectations. Knative Serving provides various dashboards and tools to
help investigate such issues. This document reviews these dashboards and tools. help investigate such issues. This document reviews these dashboards and tools.
## Request metrics ## Request metrics
Start your investigation with the "Revision - HTTP Requests" dashboard. Start your investigation with the "Revision - HTTP Requests" dashboard.
1. To open this dashboard, open the Grafana UI as described in 1. To open this dashboard, open the Grafana UI as described in
[Accessing Metrics](./accessing-metrics.md) and navigate to [Accessing Metrics](./accessing-metrics.md) and navigate to
"Knative Serving - Revision HTTP Requests". "Knative Serving - Revision HTTP Requests".
1. Select your configuration and revision from the menu on top left of the page. 1. Select your configuration and revision from the menu on top left of the page.
@ -19,14 +19,14 @@ Start your investigation with the "Revision - HTTP Requests" dashboard.
This dashboard gives visibility into the following for each revision: This dashboard gives visibility into the following for each revision:
* Request volume - Request volume
* Request volume per HTTP response code - Request volume per HTTP response code
* Response time - Response time
* Response time per HTTP response code - Response time per HTTP response code
* Request and response sizes - Request and response sizes
This dashboard can show traffic volume or latency discrepancies between different revisions. This dashboard can show traffic volume or latency discrepancies between different revisions.
If, for example, a revision's latency is higher than others revisions, then If, for example, a revision's latency is higher than others revisions, then
focus your investigation on the offending revision through the rest of this guide. focus your investigation on the offending revision through the rest of this guide.
## Request traces ## Request traces
@ -40,9 +40,9 @@ Next, look into request traces to find out where the time is spent for a single
![Zipkin - Trace Overview](./images/zipkin1.png) ![Zipkin - Trace Overview](./images/zipkin1.png)
In this example, you can see that the request spent most of its time in the In this example, you can see that the request spent most of its time in the
[span](https://github.com/opentracing/specification/blob/master/specification.md#the-opentracing-data-model) [span](https://github.com/opentracing/specification/blob/master/specification.md#the-opentracing-data-model)
right before the last, so focus your investigation on that specific span. right before the last, so focus your investigation on that specific span.
1. Click that span to see a view like the following: 1. Click that span to see a view like the following:
@ -65,11 +65,11 @@ that most of the time is spent in your own code, look at autoscaler metrics next
This view shows 4 key metrics from the Knative Serving autoscaler: This view shows 4 key metrics from the Knative Serving autoscaler:
* Actual pod count: # of pods that are running a given revision - Actual pod count: # of pods that are running a given revision
* Desired pod count: # of pods that autoscaler thinks should serve the revision - Desired pod count: # of pods that autoscaler thinks should serve the revision
* Requested pod count: # of pods that the autoscaler requested from Kubernetes - Requested pod count: # of pods that the autoscaler requested from Kubernetes
* Panic mode: If 0, the autoscaler is operating in [stable mode](https://github.com/knative/serving/blob/master/docs/scaling/DEVELOPMENT.md#stable-mode). - Panic mode: If 0, the autoscaler is operating in [stable mode](https://github.com/knative/serving/blob/master/docs/scaling/DEVELOPMENT.md#stable-mode).
If 1, the autoscaler is operating in [panic mode](https://github.com/knative/serving/blob/master/docs/scaling/DEVELOPMENT.md#panic-mode). If 1, the autoscaler is operating in [panic mode](https://github.com/knative/serving/blob/master/docs/scaling/DEVELOPMENT.md#panic-mode).
A large gap between the actual pod count and the requested pod count A large gap between the actual pod count and the requested pod count
indicates that the Kubernetes cluster is unable to keep up allocating new indicates that the Kubernetes cluster is unable to keep up allocating new
@ -85,7 +85,7 @@ but was only granted 8 pods because the cluster is out of resources.
## CPU and memory usage ## CPU and memory usage
You can access total CPU and memory usage of your revision from You can access total CPU and memory usage of your revision from
the "Knative Serving - Revision CPU and Memory Usage" dashboard, which looks like this: the "Knative Serving - Revision CPU and Memory Usage" dashboard, which looks like this:
![Knative Serving - Revision CPU and Memory Usage](./images/cpu_dash1.png) ![Knative Serving - Revision CPU and Memory Usage](./images/cpu_dash1.png)
@ -94,12 +94,12 @@ The first chart shows rate of the CPU usage across all pods serving the revision
The second chart shows total memory consumed across all pods serving the revision. The second chart shows total memory consumed across all pods serving the revision.
Both of these metrics are further divided into per container usage. Both of these metrics are further divided into per container usage.
* user-container: This container runs the user code (application, function, or container). - user-container: This container runs the user code (application, function, or container).
* [istio-proxy](https://github.com/istio/proxy): Sidecar container to form an - [istio-proxy](https://github.com/istio/proxy): Sidecar container to form an
[Istio](https://istio.io/docs/concepts/what-is-istio/overview.html) mesh. [Istio](https://istio.io/docs/concepts/what-is-istio/overview.html) mesh.
* queue-proxy: Knative Serving owned sidecar container to enforce request concurrency limits. - queue-proxy: Knative Serving owned sidecar container to enforce request concurrency limits.
* autoscaler: Knative Serving owned sidecar container to provide autoscaling for the revision. - autoscaler: Knative Serving owned sidecar container to provide autoscaling for the revision.
* fluentd-proxy: Sidecar container to collect logs from /var/log. - fluentd-proxy: Sidecar container to collect logs from /var/log.
## Profiling ## Profiling

View File

@ -9,13 +9,13 @@ configuration to define logging output.
Knative requires the customized Fluentd docker image with the following plugins Knative requires the customized Fluentd docker image with the following plugins
installed: installed:
* [fluentd](https://github.com/fluent/fluentd) >= v0.14.0 - [fluentd](https://github.com/fluent/fluentd) >= v0.14.0
* [fluent-plugin-kubernetes_metadata_filter](https://github.com/fabric8io/fluent-plugin-kubernetes_metadata_filter) >= - [fluent-plugin-kubernetes_metadata_filter](https://github.com/fabric8io/fluent-plugin-kubernetes_metadata_filter) >=
1.0.0 AND < 2.1.0: To enrich log entries with Kubernetes metadata. 1.0.0 AND < 2.1.0: To enrich log entries with Kubernetes metadata.
* [fluent-plugin-detect-exceptions](https://github.com/GoogleCloudPlatform/fluent-plugin-detect-exceptions) >= - [fluent-plugin-detect-exceptions](https://github.com/GoogleCloudPlatform/fluent-plugin-detect-exceptions) >=
0.0.9: To combine multi-line exception stack traces logs into one log entry. 0.0.9: To combine multi-line exception stack traces logs into one log entry.
* [fluent-plugin-multi-format-parser](https://github.com/repeatedly/fluent-plugin-multi-format-parser) >= - [fluent-plugin-multi-format-parser](https://github.com/repeatedly/fluent-plugin-multi-format-parser) >=
1.0.0: To detect log format as Json or plain text. 1.0.0: To detect log format as Json or plain text.
## Sample images ## Sample images

View File

@ -1,15 +1,15 @@
# Assigning a static IP address for Knative on Kubernetes Engine # Assigning a static IP address for Knative on Kubernetes Engine
If you are running Knative on Google Kubernetes Engine and want to use a If you are running Knative on Google Kubernetes Engine and want to use a
[custom domain](./using-a-custom-domain.md) with your apps, you need to configure a [custom domain](./using-a-custom-domain.md) with your apps, you need to configure a
static IP address to ensure that your custom domain mapping doesn't break. static IP address to ensure that your custom domain mapping doesn't break.
Knative uses the shared `knative-shared-gateway` Gateway under the Knative uses the shared `knative-shared-gateway` Gateway under the
`knative-serving` namespace to serve all incoming traffic within the `knative-serving` namespace to serve all incoming traffic within the
Knative service mesh. The IP address to access the gateway is the Knative service mesh. The IP address to access the gateway is the
external IP address of the "knative-ingressgateway" service under the external IP address of the "knative-ingressgateway" service under the
`istio-system` namespace. Therefore, in order to set a static IP for the `istio-system` namespace. Therefore, in order to set a static IP for the
Knative shared gateway `knative-shared-gateway`, you must to set the Knative shared gateway `knative-shared-gateway`, you must to set the
external IP address of the `knative-ingressgateway` service to a static IP. external IP address of the `knative-ingressgateway` service to a static IP.
## Step 1: Reserve a static IP address ## Step 1: Reserve a static IP address
@ -18,36 +18,39 @@ You can reserve a regional static IP address using the Google Cloud SDK or the
Google Cloud Platform console. Google Cloud Platform console.
Using the Google Cloud SDK: Using the Google Cloud SDK:
1. Enter the following command, replacing IP_NAME and REGION with appropriate
values. For example, select the `us-west1` region if you deployed your 1. Enter the following command, replacing IP_NAME and REGION with appropriate
cluster to the `us-west1-c` zone: values. For example, select the `us-west1` region if you deployed your
```shell cluster to the `us-west1-c` zone:
gcloud beta compute addresses create IP_NAME --region=REGION ```shell
``` gcloud beta compute addresses create IP_NAME --region=REGION
For example: ```
```shell For example:
gcloud beta compute addresses create knative-ip --region=us-west1 ```shell
``` gcloud beta compute addresses create knative-ip --region=us-west1
1. Enter the following command to get the newly created static IP address: ```
```shell 1. Enter the following command to get the newly created static IP address:
gcloud beta compute addresses list ```shell
``` gcloud beta compute addresses list
```
In the [GCP console](https://console.cloud.google.com/networking/addresses/add?_ga=2.97521754.-475089713.1523374982): In the [GCP console](https://console.cloud.google.com/networking/addresses/add?_ga=2.97521754.-475089713.1523374982):
1. Enter a name for your static address.
1. For **IP version**, choose IPv4.
1. For **Type**, choose **Regional**.
1. From the **Region** drop-down, choose the region where your Knative cluster is running.
For example, select the `us-west1` region if you deployed your cluster to the `us-west1-c` zone.
1. Leave the **Attached To** field set to `None` since we'll attach the IP address through a config-map later.
1. Copy the **External Address** of the static IP you created.
1. Enter a name for your static address.
1. For **IP version**, choose IPv4.
1. For **Type**, choose **Regional**.
1. From the **Region** drop-down, choose the region where your Knative cluster is running.
For example, select the `us-west1` region if you deployed your cluster to the `us-west1-c` zone.
1. Leave the **Attached To** field set to `None` since we'll attach the IP address through a config-map later.
1. Copy the **External Address** of the static IP you created.
## Step 2: Update the external IP of the `knative-ingressgateway` service ## Step 2: Update the external IP of the `knative-ingressgateway` service
Run following command to configure the external IP of the Run following command to configure the external IP of the
`knative-ingressgateway` service to the static IP that you reserved: `knative-ingressgateway` service to the static IP that you reserved:
```shell ```shell
kubectl patch svc knative-ingressgateway --namespace istio-system --patch '{"spec": { "loadBalancerIP": "<your-reserved-static-ip>" }}' kubectl patch svc knative-ingressgateway --namespace istio-system --patch '{"spec": { "loadBalancerIP": "<your-reserved-static-ip>" }}'
``` ```
@ -55,14 +58,18 @@ kubectl patch svc knative-ingressgateway --namespace istio-system --patch '{"spe
## Step 3: Verify the static IP address of `knative-ingressgateway` service ## Step 3: Verify the static IP address of `knative-ingressgateway` service
Run the following command to ensure that the external IP of the "knative-ingressgateway" service has been updated: Run the following command to ensure that the external IP of the "knative-ingressgateway" service has been updated:
```shell ```shell
kubectl get svc knative-ingressgateway --namespace istio-system kubectl get svc knative-ingressgateway --namespace istio-system
``` ```
The output should show the assigned static IP address under the EXTERNAL-IP column: The output should show the assigned static IP address under the EXTERNAL-IP column:
``` ```
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
knative-ingressgateway LoadBalancer 12.34.567.890 98.765.43.210 80:32380/TCP,443:32390/TCP,32400:32400/TCP 5m knative-ingressgateway LoadBalancer 12.34.567.890 98.765.43.210 80:32380/TCP,443:32390/TCP,32400:32400/TCP 5m
``` ```
> Note: Updating the external IP address can take several minutes. > Note: Updating the external IP address can take several minutes.
--- ---

View File

@ -12,11 +12,11 @@ these two are not supported.
The following instructions assume that you cloned the Knative Serving repository. The following instructions assume that you cloned the Knative Serving repository.
To clone the repository, run the following commands: To clone the repository, run the following commands:
```shell ```shell
git clone https://github.com/knative/serving knative-serving git clone https://github.com/knative/serving knative-serving
cd knative-serving cd knative-serving
git checkout v0.2.1 git checkout v0.2.1
``` ```
## Elasticsearch, Kibana, Prometheus & Grafana Setup ## Elasticsearch, Kibana, Prometheus & Grafana Setup
@ -50,29 +50,29 @@ To configure and setup monitoring:
The installation is complete when logging & monitoring components are all The installation is complete when logging & monitoring components are all
reported `Running` or `Completed`: reported `Running` or `Completed`:
```shell ```shell
kubectl get pods --namespace monitoring --watch kubectl get pods --namespace monitoring --watch
``` ```
``` ```
NAME READY STATUS RESTARTS AGE NAME READY STATUS RESTARTS AGE
elasticsearch-logging-0 1/1 Running 0 2d elasticsearch-logging-0 1/1 Running 0 2d
elasticsearch-logging-1 1/1 Running 0 2d elasticsearch-logging-1 1/1 Running 0 2d
fluentd-ds-5kc85 1/1 Running 0 2d fluentd-ds-5kc85 1/1 Running 0 2d
fluentd-ds-vhrcq 1/1 Running 0 2d fluentd-ds-vhrcq 1/1 Running 0 2d
fluentd-ds-xghk9 1/1 Running 0 2d fluentd-ds-xghk9 1/1 Running 0 2d
grafana-798cf569ff-v4q74 1/1 Running 0 2d grafana-798cf569ff-v4q74 1/1 Running 0 2d
kibana-logging-7d474fbb45-6qb8x 1/1 Running 0 2d kibana-logging-7d474fbb45-6qb8x 1/1 Running 0 2d
kube-state-metrics-75bd4f5b8b-8t2h2 4/4 Running 0 2d kube-state-metrics-75bd4f5b8b-8t2h2 4/4 Running 0 2d
node-exporter-cr6bh 2/2 Running 0 2d node-exporter-cr6bh 2/2 Running 0 2d
node-exporter-mf6k7 2/2 Running 0 2d node-exporter-mf6k7 2/2 Running 0 2d
node-exporter-rhzr7 2/2 Running 0 2d node-exporter-rhzr7 2/2 Running 0 2d
prometheus-system-0 1/1 Running 0 2d prometheus-system-0 1/1 Running 0 2d
prometheus-system-1 1/1 Running 0 2d prometheus-system-1 1/1 Running 0 2d
``` ```
CTRL+C to exit watch.
CTRL+C to exit watch.
1. Verify that each of your nodes have the `beta.kubernetes.io/fluentd-ds-ready=true` label: 1. Verify that each of your nodes have the `beta.kubernetes.io/fluentd-ds-ready=true` label:
```shell ```shell
@ -81,17 +81,17 @@ To configure and setup monitoring:
1. If you receive the `No Resources Found` response: 1. If you receive the `No Resources Found` response:
1. Run the following command to ensure that the Fluentd DaemonSet runs on all your nodes: 1. Run the following command to ensure that the Fluentd DaemonSet runs on all your nodes:
```shell
kubectl label nodes --all beta.kubernetes.io/fluentd-ds-ready="true"
```
1. Run the following command to ensure that the `fluentd-ds` daemonset is ready on at least one node: ```shell
kubectl label nodes --all beta.kubernetes.io/fluentd-ds-ready="true"
```
```shell 1. Run the following command to ensure that the `fluentd-ds` daemonset is ready on at least one node:
kubectl get daemonset fluentd-ds --namespace knative-monitoring
``` ```shell
kubectl get daemonset fluentd-ds --namespace knative-monitoring
```
### Create Elasticsearch Indices ### Create Elasticsearch Indices
@ -102,9 +102,9 @@ for request traces.
- To open the Kibana UI (the visualization tool for [Elasticsearch](https://info.elastic.co)), - To open the Kibana UI (the visualization tool for [Elasticsearch](https://info.elastic.co)),
you must start a local proxy by running the following command: you must start a local proxy by running the following command:
```shell ```shell
kubectl proxy kubectl proxy
``` ```
This command starts a local proxy of Kibana on port 8001. For security This command starts a local proxy of Kibana on port 8001. For security
reasons, the Kibana UI is exposed only within the cluster. reasons, the Kibana UI is exposed only within the cluster.
@ -123,13 +123,12 @@ for request traces.
of the page. Enter `zipkin*` to `Index pattern` and select `timestamp_millis` of the page. Enter `zipkin*` to `Index pattern` and select `timestamp_millis`
from `Time Filter field name` and click on `Create` button. from `Time Filter field name` and click on `Create` button.
## Stackdriver, Prometheus & Grafana Setup ## Stackdriver, Prometheus & Grafana Setup
You must configure and build your own Fluentd image if either of the following are true: You must configure and build your own Fluentd image if either of the following are true:
* Your Knative Serving component is not hosted on a Google Cloud Platform (GCP) based cluster. - Your Knative Serving component is not hosted on a Google Cloud Platform (GCP) based cluster.
* You want to send logs to another GCP project. - You want to send logs to another GCP project.
To configure and setup monitoring: To configure and setup monitoring:
@ -151,29 +150,29 @@ To configure and setup monitoring:
--filename config/monitoring/200-common/100-istio.yaml --filename config/monitoring/200-common/100-istio.yaml
``` ```
The installation is complete when logging & monitoring components are all The installation is complete when logging & monitoring components are all
reported `Running` or `Completed`: reported `Running` or `Completed`:
```shell ```shell
kubectl get pods --namespace monitoring --watch kubectl get pods --namespace monitoring --watch
``` ```
``` ```
NAME READY STATUS RESTARTS AGE NAME READY STATUS RESTARTS AGE
fluentd-ds-5kc85 1/1 Running 0 2d fluentd-ds-5kc85 1/1 Running 0 2d
fluentd-ds-vhrcq 1/1 Running 0 2d fluentd-ds-vhrcq 1/1 Running 0 2d
fluentd-ds-xghk9 1/1 Running 0 2d fluentd-ds-xghk9 1/1 Running 0 2d
grafana-798cf569ff-v4q74 1/1 Running 0 2d grafana-798cf569ff-v4q74 1/1 Running 0 2d
kube-state-metrics-75bd4f5b8b-8t2h2 4/4 Running 0 2d kube-state-metrics-75bd4f5b8b-8t2h2 4/4 Running 0 2d
node-exporter-cr6bh 2/2 Running 0 2d node-exporter-cr6bh 2/2 Running 0 2d
node-exporter-mf6k7 2/2 Running 0 2d node-exporter-mf6k7 2/2 Running 0 2d
node-exporter-rhzr7 2/2 Running 0 2d node-exporter-rhzr7 2/2 Running 0 2d
prometheus-system-0 1/1 Running 0 2d prometheus-system-0 1/1 Running 0 2d
prometheus-system-1 1/1 Running 0 2d prometheus-system-1 1/1 Running 0 2d
``` ```
CTRL+C to exit watch.
CTRL+C to exit watch.
1. Verify that each of your nodes have the `beta.kubernetes.io/fluentd-ds-ready=true` label: 1. Verify that each of your nodes have the `beta.kubernetes.io/fluentd-ds-ready=true` label:
```shell ```shell
@ -182,17 +181,17 @@ To configure and setup monitoring:
1. If you receive the `No Resources Found` response: 1. If you receive the `No Resources Found` response:
1. Run the following command to ensure that the Fluentd DaemonSet runs on all your nodes: 1. Run the following command to ensure that the Fluentd DaemonSet runs on all your nodes:
```shell
kubectl label nodes --all beta.kubernetes.io/fluentd-ds-ready="true"
```
1. Run the following command to ensure that the `fluentd-ds` daemonset is ready on at least one node: ```shell
kubectl label nodes --all beta.kubernetes.io/fluentd-ds-ready="true"
```
```shell 1. Run the following command to ensure that the `fluentd-ds` daemonset is ready on at least one node:
kubectl get daemonset fluentd-ds --namespace knative-monitoring
``` ```shell
kubectl get daemonset fluentd-ds --namespace knative-monitoring
```
## Learn More ## Learn More

View File

@ -2,32 +2,32 @@
This guides walks you through enabling outbound network access for a Knative app. This guides walks you through enabling outbound network access for a Knative app.
Knative blocks all outbound traffic by default. To enable outbound access (when you want to connect Knative blocks all outbound traffic by default. To enable outbound access (when you want to connect
to the Cloud Storage API, for example), you need to change the scope of the proxy IP range by editing to the Cloud Storage API, for example), you need to change the scope of the proxy IP range by editing
the `config-network` map. the `config-network` map.
## Determining the IP scope of your cluster ## Determining the IP scope of your cluster
To set the correct scope, you need to determine the IP ranges of your cluster. The scope varies To set the correct scope, you need to determine the IP ranges of your cluster. The scope varies
depending on your platform: depending on your platform:
* For Google Kubernetes Engine (GKE) run the following command to determine the scope. Make sure - For Google Kubernetes Engine (GKE) run the following command to determine the scope. Make sure
to replace the variables or export these values first. to replace the variables or export these values first.
```shell ```shell
gcloud container clusters describe ${CLUSTER_ID} \ gcloud container clusters describe ${CLUSTER_ID} \
--zone=${GCP_ZONE} | grep -e clusterIpv4Cidr -e servicesIpv4Cidr --zone=${GCP_ZONE} | grep -e clusterIpv4Cidr -e servicesIpv4Cidr
``` ```
* For IBM Cloud Private run the following command: - For IBM Cloud Private run the following command:
```shell ```shell
cat cluster/config.yaml | grep service_cluster_ip_range cat cluster/config.yaml | grep service_cluster_ip_range
``` ```
* For IBM Cloud Kubernetes Service use `172.30.0.0/16,172.20.0.0/16,10.10.10.0/24` - For IBM Cloud Kubernetes Service use `172.30.0.0/16,172.20.0.0/16,10.10.10.0/24`
* For Azure Container Service (ACS) use `10.244.0.0/16,10.240.0.0/16` - For Azure Container Service (ACS) use `10.244.0.0/16,10.240.0.0/16`
* For Minikube use `10.0.0.1/24` - For Minikube use `10.0.0.1/24`
## Setting the IP scope ## Setting the IP scope
The `istio.sidecar.includeOutboundIPRanges` parameter in the `config-network` map specifies The `istio.sidecar.includeOutboundIPRanges` parameter in the `config-network` map specifies
the IP ranges that Istio sidecar intercepts. To allow outbound access, replace the default parameter the IP ranges that Istio sidecar intercepts. To allow outbound access, replace the default parameter
value with the IP ranges of your cluster. value with the IP ranges of your cluster.
@ -38,7 +38,7 @@ kubectl edit configmap config-network --namespace knative-serving
``` ```
Then, use an editor of your choice to change the `istio.sidecar.includeOutboundIPRanges` parameter value Then, use an editor of your choice to change the `istio.sidecar.includeOutboundIPRanges` parameter value
from `*` to the IP range you need. Separate multiple IP entries with a comma. For example: from `*` to the IP range you need. Separate multiple IP entries with a comma. For example:
``` ```
# Please edit the object below. Lines beginning with a '#' will be ignored, # Please edit the object below. Lines beginning with a '#' will be ignored,
@ -53,16 +53,16 @@ metadata:
... ...
``` ```
By default, the `istio.sidecar.includeOutboundIPRanges` parameter is set to `*`, By default, the `istio.sidecar.includeOutboundIPRanges` parameter is set to `*`,
which means that Istio intercepts all traffic within the cluster as well as all traffic that is going which means that Istio intercepts all traffic within the cluster as well as all traffic that is going
outside the cluster. Istio blocks all traffic that is going outside the cluster unless outside the cluster. Istio blocks all traffic that is going outside the cluster unless
you create the necessary egress rules. you create the necessary egress rules.
When you set the parameter to a valid set of IP address ranges, Istio will no longer intercept When you set the parameter to a valid set of IP address ranges, Istio will no longer intercept
traffic that is going to the IP addresses outside the provided ranges, and you don't need to specify traffic that is going to the IP addresses outside the provided ranges, and you don't need to specify
any egress rules. any egress rules.
If you omit the parameter or set it to `''`, Knative uses the value of the `global.proxy.includeIPRanges` If you omit the parameter or set it to `''`, Knative uses the value of the `global.proxy.includeIPRanges`
parameter that is provided at Istio deployment time. In the default Knative Serving parameter that is provided at Istio deployment time. In the default Knative Serving
deployment, `global.proxy.includeIPRanges` value is set to `*`. deployment, `global.proxy.includeIPRanges` value is set to `*`.

View File

@ -4,19 +4,19 @@ This directory contains sample applications, developed on Knative, to illustrate
different use-cases and resources. See [Knative serving](https://github.com/knative/docs/tree/master/serving) different use-cases and resources. See [Knative serving](https://github.com/knative/docs/tree/master/serving)
to learn more about Knative Serving resources. to learn more about Knative Serving resources.
| Name | Description | Languages | | Name | Description | Languages |
| ---- | ----------- |:---------:| | -------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: |
| Hello World | A quick introduction that highlights how to deploy an app using Knative Serving. | [C#](helloworld-csharp/README.md), [Clojure](helloworld-clojure/README.md), [Eclipse Vert.x](helloworld-vertx/README.md), [Go](helloworld-go/README.md), [Java](helloworld-java/README.md), [Kotlin](helloworld-kotlin/README.md), [Node.js](helloworld-nodejs/README.md), [PHP](helloworld-php/README.md), [Python](helloworld-python/README.md), [Ruby](helloworld-ruby/README.md), [Rust](helloworld-rust/README.md) | | Hello World | A quick introduction that highlights how to deploy an app using Knative Serving. | [C#](helloworld-csharp/README.md), [Clojure](helloworld-clojure/README.md), [Eclipse Vert.x](helloworld-vertx/README.md), [Go](helloworld-go/README.md), [Java](helloworld-java/README.md), [Kotlin](helloworld-kotlin/README.md), [Node.js](helloworld-nodejs/README.md), [PHP](helloworld-php/README.md), [Python](helloworld-python/README.md), [Ruby](helloworld-ruby/README.md), [Rust](helloworld-rust/README.md) |
| Advanced Deployment | Simple blue/green-like application deployment pattern illustrating the process of updating a live application without dropping any traffic. | [YAML](blue-green-deployment.md) | | Advanced Deployment | Simple blue/green-like application deployment pattern illustrating the process of updating a live application without dropping any traffic. | [YAML](blue-green-deployment.md) |
| Autoscale | A demonstration of the autoscaling capabilities of Knative. | [Go](autoscale-go/README.md) | | Autoscale | A demonstration of the autoscaling capabilities of Knative. | [Go](autoscale-go/README.md) |
| Private Repo Build | An example of deploying a Knative Serving Service using a Github deploy-key and a DockerHub image pull secret. | [Go](build-private-repo-go/README.md) | | Private Repo Build | An example of deploying a Knative Serving Service using a Github deploy-key and a DockerHub image pull secret. | [Go](build-private-repo-go/README.md) |
| Buildpack for Applications | A sample app that demonstrates using Cloud Foundry buildpacks on Knative Serving. | [.NET](buildpack-app-dotnet/README.md) | | Buildpack for Applications | A sample app that demonstrates using Cloud Foundry buildpacks on Knative Serving. | [.NET](buildpack-app-dotnet/README.md) |
| Buildpack for Functions | A sample function that demonstrates using Cloud Foundry buildpacks on Knative Serving. | [Node.js](buildpack-function-nodejs/README.md) | | Buildpack for Functions | A sample function that demonstrates using Cloud Foundry buildpacks on Knative Serving. | [Node.js](buildpack-function-nodejs/README.md) |
| Github Webhook | A simple webhook handler that demonstrates interacting with Github. | [Go](gitwebhook-go/README.md) | | Github Webhook | A simple webhook handler that demonstrates interacting with Github. | [Go](gitwebhook-go/README.md) |
| gRPC | A simple gRPC server. | [Go](grpc-ping-go/README.md) | | gRPC | A simple gRPC server. | [Go](grpc-ping-go/README.md) |
| Knative Routing | An example of mapping multiple Knative services to different paths under a single domain name using the Istio VirtualService concept. | [Go](knative-routing-go/README.md) | | Knative Routing | An example of mapping multiple Knative services to different paths under a single domain name using the Istio VirtualService concept. | [Go](knative-routing-go/README.md) |
| REST API | A simple Restful service that exposes an endpoint defined by an environment variable described in the Knative Configuration. | [Go](rest-api-go/README.md) | | REST API | A simple Restful service that exposes an endpoint defined by an environment variable described in the Knative Configuration. | [Go](rest-api-go/README.md) |
| Source to URL | A sample that shows how to use Knative to go from source code in a git repository to a running application with a URL. | [Go](source-to-url-go/README.md) | | Source to URL | A sample that shows how to use Knative to go from source code in a git repository to a running application with a URL. | [Go](source-to-url-go/README.md) |
| Telemetry | This sample runs a simple web server that makes calls to other in-cluster services and responds to requests with "Hello World!". The purpose of this sample is to show generating metrics, logs, and distributed traces. | [Go](telemetry-go/README.md) | | Telemetry | This sample runs a simple web server that makes calls to other in-cluster services and responds to requests with "Hello World!". The purpose of this sample is to show generating metrics, logs, and distributed traces. | [Go](telemetry-go/README.md) |
| Thumbnailer | An example of deploying a "dockerized" application to Knative Serving which takes video URL as an input and generates its thumbnail image. | [Go](thumbnailer-go/README.md) | | Thumbnailer | An example of deploying a "dockerized" application to Knative Serving which takes video URL as an input and generates its thumbnail image. | [Go](thumbnailer-go/README.md) |
| Traffic Splitting | This samples builds off the [Creating a RESTful Service](./rest-api-go) sample to illustrate applying a revision, then using that revision for manual traffic splitting. | [YAML](traffic-splitting/README.md) | | Traffic Splitting | This samples builds off the [Creating a RESTful Service](./rest-api-go) sample to illustrate applying a revision, then using that revision for manual traffic splitting. | [YAML](traffic-splitting/README.md) |

View File

@ -8,6 +8,7 @@ A demonstration of the autoscaling capabilities of a Knative Serving Revision.
1. A [metrics installation](https://github.com/knative/docs/blob/master/serving/installing-logging-metrics-traces.md) for viewing scaling graphs (optional). 1. A [metrics installation](https://github.com/knative/docs/blob/master/serving/installing-logging-metrics-traces.md) for viewing scaling graphs (optional).
1. Install [Docker](https://docs.docker.com/get-started/#prepare-your-docker-environment). 1. Install [Docker](https://docs.docker.com/get-started/#prepare-your-docker-environment).
1. Check out the code: 1. Check out the code:
``` ```
go get -d github.com/knative/docs/serving/samples/autoscale-go go get -d github.com/knative/docs/serving/samples/autoscale-go
``` ```
@ -17,19 +18,23 @@ go get -d github.com/knative/docs/serving/samples/autoscale-go
Build the application container and publish it to a container registry: Build the application container and publish it to a container registry:
1. Move into the sample directory: 1. Move into the sample directory:
``` ```
cd $GOPATH/src/github.com/knative/docs cd $GOPATH/src/github.com/knative/docs
``` ```
1. Set your preferred container registry: 1. Set your preferred container registry:
``` ```
export REPO="gcr.io/<YOUR_PROJECT_ID>" export REPO="gcr.io/<YOUR_PROJECT_ID>"
``` ```
* This example shows how to use Google Container Registry (GCR). You will need a
Google Cloud Project and to enable the - This example shows how to use Google Container Registry (GCR). You will need a
[Google Container Registry API](https://console.cloud.google.com/apis/library/containerregistry.googleapis.com). Google Cloud Project and to enable the
[Google Container Registry API](https://console.cloud.google.com/apis/library/containerregistry.googleapis.com).
1. Use Docker to build your application container: 1. Use Docker to build your application container:
``` ```
docker build \ docker build \
--tag "${REPO}/serving/samples/autoscale-go" \ --tag "${REPO}/serving/samples/autoscale-go" \
@ -37,7 +42,8 @@ Build the application container and publish it to a container registry:
``` ```
1. Push your container to a container registry: 1. Push your container to a container registry:
```
```
docker push "${REPO}/serving/samples/autoscale-go" docker push "${REPO}/serving/samples/autoscale-go"
``` ```
@ -51,6 +57,7 @@ Build the application container and publish it to a container registry:
## Deploy the Service ## Deploy the Service
1. Deploy the Knative Serving sample: 1. Deploy the Knative Serving sample:
``` ```
kubectl apply --filename serving/samples/autoscale-go/service.yaml kubectl apply --filename serving/samples/autoscale-go/service.yaml
``` ```
@ -63,9 +70,11 @@ Build the application container and publish it to a container registry:
## View the Autoscaling Capabilities ## View the Autoscaling Capabilities
1. Make a request to the autoscale app to see it consume some resources. 1. Make a request to the autoscale app to see it consume some resources.
``` ```
curl --header "Host: autoscale-go.default.example.com" "http://${IP_ADDRESS?}?sleep=100&prime=10000&bloat=5" curl --header "Host: autoscale-go.default.example.com" "http://${IP_ADDRESS?}?sleep=100&prime=10000&bloat=5"
``` ```
``` ```
Allocated 5 Mb of memory. Allocated 5 Mb of memory.
The largest prime less than 10000 is 9973. The largest prime less than 10000 is 9973.
@ -77,6 +86,7 @@ Build the application container and publish it to a container registry:
``` ```
go run serving/samples/autoscale-go/test/test.go -sleep 100 -prime 10000 -bloat 5 -qps 9999 -concurrency 300 go run serving/samples/autoscale-go/test/test.go -sleep 100 -prime 10000 -bloat 5 -qps 9999 -concurrency 300
``` ```
``` ```
REQUEST STATS: REQUEST STATS:
Total: 439 Inflight: 299 Done: 439 Success Rate: 100.00% Avg Latency: 0.4655 sec Total: 439 Inflight: 299 Done: 439 Success Rate: 100.00% Avg Latency: 0.4655 sec
@ -86,6 +96,7 @@ Build the application container and publish it to a container registry:
Total: 2911 Inflight: 300 Done: 577 Success Rate: 100.00% Avg Latency: 0.4401 sec Total: 2911 Inflight: 300 Done: 577 Success Rate: 100.00% Avg Latency: 0.4401 sec
... ...
``` ```
> Note: Use CTRL+C to exit the load test. > Note: Use CTRL+C to exit the load test.
1. Watch the Knative Serving deployment pod count increase. 1. Watch the Knative Serving deployment pod count increase.
@ -110,7 +121,7 @@ ceil(1.75) = 2 pods
#### Tuning #### Tuning
By default Knative Serving does not limit concurrency in Revision containers. A limit can be set per-Configuration using the [`ContainerConcurrency`](https://github.com/knative/serving/blob/3f00c39e289ed4bfb84019131651c2e4ea660ab5/pkg/apis/serving/v1alpha1/revision_types.go#L149) field. The autoscaler will target a percentage of `ContainerConcurrency` instead of the default `100.0`. By default Knative Serving does not limit concurrency in Revision containers. A limit can be set per-Configuration using the [`ContainerConcurrency`](https://github.com/knative/serving/blob/3f00c39e289ed4bfb84019131651c2e4ea660ab5/pkg/apis/serving/v1alpha1/revision_types.go#L149) field. The autoscaler will target a percentage of `ContainerConcurrency` instead of the default `100.0`.
### Dashboards ### Dashboards
@ -127,21 +138,25 @@ kubectl port-forward --namespace knative-monitoring $(kubectl get pods --namespa
### Other Experiments ### Other Experiments
1. Maintain 1000 concurrent requests. 1. Maintain 1000 concurrent requests.
``` ```
go run serving/samples/autoscale-go/test/test.go -qps 9999 -concurrency 1000 go run serving/samples/autoscale-go/test/test.go -qps 9999 -concurrency 1000
``` ```
1. Maintain 100 qps with fast requests. 1. Maintain 100 qps with fast requests.
``` ```
go run serving/samples/autoscale-go/test/test.go -qps 100 -concurrency 9999 go run serving/samples/autoscale-go/test/test.go -qps 100 -concurrency 9999
``` ```
1. Maintain 100 qps with slow requests. 1. Maintain 100 qps with slow requests.
``` ```
go run serving/samples/autoscale-go/test/test.go -qps 100 -concurrency 9999 -sleep 500 go run serving/samples/autoscale-go/test/test.go -qps 100 -concurrency 9999 -sleep 500
``` ```
1. Heavy CPU usage. 1. Heavy CPU usage.
``` ```
go run serving/samples/autoscale-go/test/test.go -qps 9999 -concurrency 10 -prime 40000000 go run serving/samples/autoscale-go/test/test.go -qps 9999 -concurrency 10 -prime 40000000
``` ```

View File

@ -8,8 +8,9 @@ configuration.
## Before you begin ## Before you begin
You need: You need:
* A Kubernetes cluster with [Knative installed](../../install/README.md).
* (Optional) [A custom domain configured](../../serving/using-a-custom-domain.md) for use with Knative. - A Kubernetes cluster with [Knative installed](../../install/README.md).
- (Optional) [A custom domain configured](../../serving/using-a-custom-domain.md) for use with Knative.
## Deploying Revision 1 (Blue) ## Deploying Revision 1 (Blue)
@ -39,6 +40,7 @@ spec:
``` ```
Save the file, then deploy the configuration to your cluster: Save the file, then deploy the configuration to your cluster:
```bash ```bash
kubectl apply --filename blue-green-demo-config.yaml kubectl apply --filename blue-green-demo-config.yaml
@ -57,32 +59,33 @@ metadata:
namespace: default # The namespace we're working in; also appears in the URL to access the app namespace: default # The namespace we're working in; also appears in the URL to access the app
spec: spec:
traffic: traffic:
- revisionName: blue-green-demo-00001 - revisionName: blue-green-demo-00001
percent: 100 # All traffic goes to this revision percent: 100 # All traffic goes to this revision
``` ```
Save the file, then apply the route to your cluster: Save the file, then apply the route to your cluster:
```bash ```bash
kubectl apply --filename blue-green-demo-route.yaml kubectl apply --filename blue-green-demo-route.yaml
route "blue-green-demo" configured route "blue-green-demo" configured
``` ```
You'll now be able to view the sample app at You'll now be able to view the sample app at
http://blue-green-demo.default.YOUR_CUSTOM_DOMAIN.com (replace `YOUR_CUSTOM_DOMAIN`) http://blue-green-demo.default.YOUR_CUSTOM_DOMAIN.com (replace `YOUR_CUSTOM_DOMAIN`)
with the [custom domain](../../serving/using-a-custom-domain.md) you configured for with the [custom domain](../../serving/using-a-custom-domain.md) you configured for
use with Knative. use with Knative.
> Note: If you don't have a custom domain configured for use with Knative, you can interact > Note: If you don't have a custom domain configured for use with Knative, you can interact
with your app using cURL requests if you have the host URL and IP address: > with your app using cURL requests if you have the host URL and IP address:
`curl -H "Host: blue-green-demo.default.example.com" http://IP_ADDRESS` > `curl -H "Host: blue-green-demo.default.example.com" http://IP_ADDRESS`
Knative creates the host URL by combining the name of your Route object, > Knative creates the host URL by combining the name of your Route object,
the namespace, and `example.com`, if you haven't configured a custom domain. > the namespace, and `example.com`, if you haven't configured a custom domain.
For example, `[route-name].[namespace].example.com`. > For example, `[route-name].[namespace].example.com`.
You can get the IP address by entering `kubectl get svc knative-ingressgateway --namespace istio-system` > You can get the IP address by entering `kubectl get svc knative-ingressgateway --namespace istio-system`
and copying the `EXTERNAL-IP` returned by that command. > and copying the `EXTERNAL-IP` returned by that command.
See [Interacting with your app](../../install/getting-started-knative-app.md#interacting-with-your-app) > See [Interacting with your app](../../install/getting-started-knative-app.md#interacting-with-your-app)
for more information. > for more information.
## Deploying Revision 2 (Green) ## Deploying Revision 2 (Green)
@ -111,6 +114,7 @@ spec:
``` ```
Save the file, then apply the updated configuration to your cluster: Save the file, then apply the updated configuration to your cluster:
```bash ```bash
kubectl apply --filename blue-green-demo-config.yaml kubectl apply --filename blue-green-demo-config.yaml
@ -131,14 +135,15 @@ metadata:
namespace: default namespace: default
spec: spec:
traffic: traffic:
- revisionName: blue-green-demo-00001 - revisionName: blue-green-demo-00001
percent: 100 # All traffic still going to the first revision percent: 100 # All traffic still going to the first revision
- revisionName: blue-green-demo-00002 - revisionName: blue-green-demo-00002
percent: 0 # 0% of traffic routed to the second revision percent: 0 # 0% of traffic routed to the second revision
name: v2 # A named route name: v2 # A named route
``` ```
Save the file, then apply the updated route to your cluster: Save the file, then apply the updated route to your cluster:
```bash ```bash
kubectl apply --filename blue-green-demo-route.yaml kubectl apply --filename blue-green-demo-route.yaml
@ -147,8 +152,8 @@ route "blue-green-demo" configured
Revision 2 of the app is staged at this point. That means: Revision 2 of the app is staged at this point. That means:
* No traffic will be routed to revision 2 at the main URL, http://blue-green-demo.default.YOUR_CUSTOM_DOMAIN.com - No traffic will be routed to revision 2 at the main URL, http://blue-green-demo.default.YOUR_CUSTOM_DOMAIN.com
* Knative creates a new route named v2 for testing the newly deployed version at http://v2.blue-green-demo.default.YOUR_CUSTOM_DOMAIN.com - Knative creates a new route named v2 for testing the newly deployed version at http://v2.blue-green-demo.default.YOUR_CUSTOM_DOMAIN.com
This allows you to validate that the new version of the app is behaving as expected before switching This allows you to validate that the new version of the app is behaving as expected before switching
any traffic over to it. any traffic over to it.
@ -166,14 +171,15 @@ metadata:
namespace: default namespace: default
spec: spec:
traffic: traffic:
- revisionName: blue-green-demo-00001 - revisionName: blue-green-demo-00001
percent: 50 # Updating the percentage from 100 to 50 percent: 50 # Updating the percentage from 100 to 50
- revisionName: blue-green-demo-00002 - revisionName: blue-green-demo-00002
percent: 50 # Updating the percentage from 0 to 50 percent: 50 # Updating the percentage from 0 to 50
name: v2 name: v2
``` ```
Save the file, then apply the updated route to your cluster: Save the file, then apply the updated route to your cluster:
```bash ```bash
kubectl apply --filename blue-green-demo-route.yaml kubectl apply --filename blue-green-demo-route.yaml
@ -184,8 +190,7 @@ Refresh the original route (http://blue-green-demo.default.YOUR_CUSTOM_DOMAIN.co
few times to see that some traffic now goes to version 2 of the app. few times to see that some traffic now goes to version 2 of the app.
> Note: This sample shows a 50/50 split to assure you don't have to refresh too much, > Note: This sample shows a 50/50 split to assure you don't have to refresh too much,
but it's recommended to start with 1-2% of traffic in a production environment > but it's recommended to start with 1-2% of traffic in a production environment
## Rerouting all traffic to the new version ## Rerouting all traffic to the new version
@ -200,15 +205,16 @@ metadata:
namespace: default namespace: default
spec: spec:
traffic: traffic:
- revisionName: blue-green-demo-00001 - revisionName: blue-green-demo-00001
percent: 0 percent: 0
name: v1 # Adding a new named route for v1 name: v1 # Adding a new named route for v1
- revisionName: blue-green-demo-00002 - revisionName: blue-green-demo-00002
percent: 100 percent: 100
# Named route for v2 has been removed, since we don't need it anymore # Named route for v2 has been removed, since we don't need it anymore
``` ```
Save the file, then apply the updated route to your cluster: Save the file, then apply the updated route to your cluster:
```bash ```bash
kubectl apply --filename blue-green-demo-route.yaml kubectl apply --filename blue-green-demo-route.yaml
@ -218,7 +224,7 @@ route "blue-green-demo" configured
Refresh the original route (http://blue-green-demo.default.YOUR_CUSTOM_DOMAIN.com) a Refresh the original route (http://blue-green-demo.default.YOUR_CUSTOM_DOMAIN.com) a
few times to verify that no traffic is being routed to v1 of the app. few times to verify that no traffic is being routed to v1 of the app.
We added a named route to v1 of the app, so you can now access it at We added a named route to v1 of the app, so you can now access it at
http://v1.blue-green-demo.default.YOUR_CUSTOM_DOMAIN.com. http://v1.blue-green-demo.default.YOUR_CUSTOM_DOMAIN.com.
With all inbound traffic being directed to the second revision of the With all inbound traffic being directed to the second revision of the

View File

@ -1,21 +1,22 @@
# Deploying to Knative from a Private GitHub Repo # Deploying to Knative from a Private GitHub Repo
This sample demonstrates: This sample demonstrates:
* Pulling source code from a private Github repository using a deploy-key
* Pushing a Docker container to a private DockerHub repository using a username / password - Pulling source code from a private Github repository using a deploy-key
* Deploying to Knative Serving using image pull secrets - Pushing a Docker container to a private DockerHub repository using a username / password
- Deploying to Knative Serving using image pull secrets
## Before you begin ## Before you begin
* [Install Knative Serving](../../../install/README.md) - [Install Knative Serving](../../../install/README.md)
* Create a local folder for this sample and download the files in this directory into it. - Create a local folder for this sample and download the files in this directory into it.
## Setup ## Setup
### 1. Setting up the default service account ### 1. Setting up the default service account
Knative Serving will run pods as the default service account in the namespace where Knative Serving will run pods as the default service account in the namespace where
you created your resources. You can see its body by entering the following command: you created your resources. You can see its body by entering the following command:
```shell ```shell
$ kubectl get serviceaccount default --output yaml $ kubectl get serviceaccount default --output yaml
@ -32,6 +33,7 @@ secrets:
We are going to add to this an image pull Secret. We are going to add to this an image pull Secret.
1. Create your image pull Secret with the following command, replacing values as neccesary: 1. Create your image pull Secret with the following command, replacing values as neccesary:
```shell ```shell
kubectl create secret docker-registry dockerhub-pull-secret \ kubectl create secret docker-registry dockerhub-pull-secret \
--docker-server=https://index.docker.io/v1/ --docker-email=not@val.id \ --docker-server=https://index.docker.io/v1/ --docker-email=not@val.id \
@ -40,8 +42,9 @@ We are going to add to this an image pull Secret.
To learn more about Kubernetes pull Secrets, see To learn more about Kubernetes pull Secrets, see
[Creating a Secret in the cluster that holds your authorization token](https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/#create-a-secret-in-the-cluster-that-holds-your-authorization-token). [Creating a Secret in the cluster that holds your authorization token](https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/#create-a-secret-in-the-cluster-that-holds-your-authorization-token).
2. Add the newly created `imagePullSecret` to your default service account by entering: 2. Add the newly created `imagePullSecret` to your default service account by entering:
```shell ```shell
kubectl edit serviceaccount default kubectl edit serviceaccount default
``` ```
@ -50,13 +53,12 @@ We are going to add to this an image pull Secret.
```yaml ```yaml
secrets: secrets:
- name: default-token-zd84v - name: default-token-zd84v
# This is the secret we just created: # This is the secret we just created:
imagePullSecrets: imagePullSecrets:
- name: dockerhub-pull-secret - name: dockerhub-pull-secret
``` ```
### 2. Configuring the build ### 2. Configuring the build
The objects in this section are all defined in `build-bot.yaml`, and the fields that The objects in this section are all defined in `build-bot.yaml`, and the fields that
@ -67,6 +69,7 @@ The following sections explain the different configurations in the `build-bot.ya
as well as the necessary changes for each section. as well as the necessary changes for each section.
#### Setting up our Build service account #### Setting up our Build service account
To separate our Build's credentials from our applications credentials, the To separate our Build's credentials from our applications credentials, the
Build runs as its own service account: Build runs as its own service account:
@ -76,15 +79,15 @@ kind: ServiceAccount
metadata: metadata:
name: build-bot name: build-bot
secrets: secrets:
- name: deploy-key - name: deploy-key
- name: dockerhub-push-secrets - name: dockerhub-push-secrets
``` ```
#### Creating a deploy key #### Creating a deploy key
You can set up a deploy key for a private Github repository following You can set up a deploy key for a private Github repository following
[these](https://developer.github.com/v3/guides/managing-deploy-keys/) [these](https://developer.github.com/v3/guides/managing-deploy-keys/)
instructions. The deploy key in the `build-bot.yaml` file in this folder is *real*; instructions. The deploy key in the `build-bot.yaml` file in this folder is _real_;
you do not need to change it for the sample to work. you do not need to change it for the sample to work.
```yaml ```yaml
@ -133,6 +136,7 @@ kubectl create --filename build-bot.yaml
``` ```
### 3. Installing a Build template and updating `manifest.yaml` ### 3. Installing a Build template and updating `manifest.yaml`
1. Install the 1. Install the
[Kaniko build template](https://github.com/knative/build-templates/blob/master/kaniko/kaniko.yaml) [Kaniko build template](https://github.com/knative/build-templates/blob/master/kaniko/kaniko.yaml)
by entering the following command: by entering the following command:
@ -140,7 +144,7 @@ kubectl create --filename build-bot.yaml
```shell ```shell
kubectl apply --filename https://raw.githubusercontent.com/knative/build-templates/master/kaniko/kaniko.yaml kubectl apply --filename https://raw.githubusercontent.com/knative/build-templates/master/kaniko/kaniko.yaml
``` ```
1. Open `manifest.yaml` and substitute your private DockerHub repository name for 1. Open `manifest.yaml` and substitute your private DockerHub repository name for
`REPLACE_ME`. `REPLACE_ME`.
@ -168,14 +172,14 @@ export SERVICE_IP=$(kubectl get svc knative-ingressgateway --namespace istio-sys
``` ```
> Note: If your cluster is running outside a cloud provider (for example, on Minikube), > Note: If your cluster is running outside a cloud provider (for example, on Minikube),
your services will never get an external IP address. In that case, use the Istio > your services will never get an external IP address. In that case, use the Istio
`hostIP` and `nodePort` as the service IP: > `hostIP` and `nodePort` as the service IP:
```shell ```shell
export SERVICE_IP=$(kubectl get po --selector knative=ingressgateway --namespace istio-system \ export SERVICE_IP=$(kubectl get po --selector knative=ingressgateway --namespace istio-system \
--output 'jsonpath= . {.items[0].status.hostIP}'):$(kubectl get svc knative-ingressgateway \ --output 'jsonpath= . {.items[0].status.hostIP}'):$(kubectl get svc knative-ingressgateway \
--namespace istio-system --output 'jsonpath={.spec.ports[? (@.port==80)].nodePort}') --namespace istio-system --output 'jsonpath={.spec.ports[? (@.port==80)].nodePort}')
``` ```
Now curl the service IP to make sure the deployment succeeded: Now curl the service IP to make sure the deployment succeeded:
@ -183,12 +187,12 @@ Now curl the service IP to make sure the deployment succeeded:
curl -H "Host: $SERVICE_HOST" http://$SERVICE_IP curl -H "Host: $SERVICE_HOST" http://$SERVICE_IP
``` ```
## Appendix: Sample Code ## Appendix: Sample Code
The sample code is in a private Github repository consisting of two files. The sample code is in a private Github repository consisting of two files.
1. `Dockerfile` 1. `Dockerfile`
```Dockerfile ```Dockerfile
# Use golang:alpine to optimize the image size. # Use golang:alpine to optimize the image size.
# See https://hub.docker.com/_/golang/ for more information # See https://hub.docker.com/_/golang/ for more information
@ -210,8 +214,8 @@ The sample code is in a private Github repository consisting of two files.
package main package main
import ( import (
"fmt" "
"net/http" "
) )
const ( const (
@ -219,11 +223,11 @@ The sample code is in a private Github repository consisting of two files.
) )
func helloWorld(w http.ResponseWriter, r *http.Request) { func helloWorld(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "Hello World.") )
} }
func main() { func main() {
http.HandleFunc("/", helloWorld) )
http.ListenAndServe(port, nil) )
} }
``` ```

View File

@ -8,7 +8,7 @@ sample app for Cloud Foundry.
## Prerequisites ## Prerequisites
* [Install Knative Serving](../../../install/README.md) - [Install Knative Serving](../../../install/README.md)
## Running ## Running

View File

@ -8,7 +8,7 @@ sample function for riff.
## Prerequisites ## Prerequisites
* [Install Knative Serving](../../../install/README.md) - [Install Knative Serving](../../../install/README.md)
## Running ## Running
@ -53,6 +53,7 @@ items:
Once the `BuildComplete` status is `True`, resource creation begins. Once the `BuildComplete` status is `True`, resource creation begins.
To access this service using `curl`, we first need to determine its ingress address: To access this service using `curl`, we first need to determine its ingress address:
```shell ```shell
watch kubectl get svc knative-ingressgateway --namespace istio-system watch kubectl get svc knative-ingressgateway --namespace istio-system
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE

View File

@ -5,28 +5,28 @@ through a webhook.
## Prerequisites ## Prerequisites
* A Kubernetes cluster with Knative installed. Follow the - A Kubernetes cluster with Knative installed. Follow the
[installation instructions](https://github.com/knative/docs/blob/master/install/README.md) [installation instructions](https://github.com/knative/docs/blob/master/install/README.md)
if you need to create one. if you need to create one.
* [Docker](https://www.docker.com) installed and running on your local machine, - [Docker](https://www.docker.com) installed and running on your local machine,
and a Docker Hub account configured (we'll use it for a container registry). and a Docker Hub account configured (we'll use it for a container registry).
* An account on [GitHub](https://github.com) with read/write access to a - An account on [GitHub](https://github.com) with read/write access to a
repository. repository.
## Build the sample code ## Build the sample code
1. Use Docker to build a container image for this service. Replace 1. Use Docker to build a container image for this service. Replace
`username` with your Docker Hub username in the following commands. `username` with your Docker Hub username in the following commands.
```shell ```shell
export DOCKER_HUB_USERNAME=username export DOCKER_HUB_USERNAME=username
# Build the container, run from the project folder # Build the container, run from the project folder
docker build -t ${DOCKER_HUB_USERNAME}/gitwebhook-go . docker build -t ${DOCKER_HUB_USERNAME}/gitwebhook-go .
# Push the container to the registry # Push the container to the registry
docker push ${DOCKER_HUB_USERNAME}/gitwebhook-go docker push ${DOCKER_HUB_USERNAME}/gitwebhook-go
``` ```
1. Create a secret that holds two values from GitHub, a personal access token 1. Create a secret that holds two values from GitHub, a personal access token
used to make API requests to GitHub, and a webhook secret, used to validate used to make API requests to GitHub, and a webhook secret, used to validate
@ -53,28 +53,28 @@ through a webhook.
1. Apply the secret to your cluster: 1. Apply the secret to your cluster:
```shell ```shell
kubectl apply --filename github-secret.yaml kubectl apply --filename github-secret.yaml
``` ```
1. Next, update the `service.yaml` file in the project to reference the tagged 1. Next, update the `service.yaml` file in the project to reference the tagged
image from step 1. image from step 1.
```yaml ```yaml
apiVersion: serving.knative.dev/v1alpha1 apiVersion: serving.knative.dev/v1alpha1
kind: Service kind: Service
metadata: metadata:
name: gitwebhook name: gitwebhook
namespace: default namespace: default
spec: spec:
runLatest: runLatest:
configuration: configuration:
revisionTemplate: revisionTemplate:
spec: spec:
container: container:
# Replace {DOCKER_HUB_USERNAME} with your actual docker hub username # Replace {DOCKER_HUB_USERNAME} with your actual docker hub username
image: docker.io/{DOCKER_HUB_USERNAME}/gitwebhook-go image: docker.io/{DOCKER_HUB_USERNAME}/gitwebhook-go
env: env:
- name: SECRET_TOKEN - name: SECRET_TOKEN
valueFrom: valueFrom:
secretKeyRef: secretKeyRef:
@ -82,10 +82,10 @@ through a webhook.
key: secretToken key: secretToken
- name: ACCESS_TOKEN - name: ACCESS_TOKEN
valueFrom: valueFrom:
secretKeyRef: secretKeyRef:
name: githubsecret name: githubsecret
key: accessToken key: accessToken
``` ```
1. Use `kubectl` to apply the `service.yaml` file. 1. Use `kubectl` to apply the `service.yaml` file.
@ -99,23 +99,23 @@ service "gitwebhook" created
need to [configure a custom domain](https://github.com/knative/docs/blob/master/serving/using-a-custom-domain.md) need to [configure a custom domain](https://github.com/knative/docs/blob/master/serving/using-a-custom-domain.md)
and [assign a static IP address](https://github.com/knative/docs/blob/master/serving/gke-assigning-static-ip-address.md). and [assign a static IP address](https://github.com/knative/docs/blob/master/serving/gke-assigning-static-ip-address.md).
1. Retrieve the hostname for this service, using the following command: 1. Retrieve the hostname for this service, using the following command:
```shell ```shell
$ kubectl get ksvc gitwebhook \ $ kubectl get ksvc gitwebhook \
--output=custom-columns=NAME:.metadata.name,DOMAIN:.status.domain --output=custom-columns=NAME:.metadata.name,DOMAIN:.status.domain
NAME DOMAIN NAME DOMAIN
gitwebhook gitwebhook.default.example.com gitwebhook gitwebhook.default.example.com
``` ```
1. Browse on GitHub to the repository where you want to create a webhook. 1. Browse on GitHub to the repository where you want to create a webhook.
1. Click **Settings**, then **Webhooks**, then **Add webhook**. 1. Click **Settings**, then **Webhooks**, then **Add webhook**.
1. Enter the **Payload URL** as `http://{DOMAIN}`, with the value of DOMAIN listed above. 1. Enter the **Payload URL** as `http://{DOMAIN}`, with the value of DOMAIN listed above.
1. Set the **Content type** to `application/json`. 1. Set the **Content type** to `application/json`.
1. Enter the **Secret** value to be the same as the original base used for 1. Enter the **Secret** value to be the same as the original base used for
`webhookSecret` above (the original value, not the base64 encoded value). `webhookSecret` above (the original value, not the base64 encoded value).
1. Select **Disable** under SSL Validation, unless you've [enabled SSL](https://github.com/knative/docs/blob/master/serving/using-an-ssl-cert.md). 1. Select **Disable** under SSL Validation, unless you've [enabled SSL](https://github.com/knative/docs/blob/master/serving/using-an-ssl-cert.md).
1. Click **Add webhook** to create the webhook. 1. Click **Add webhook** to create the webhook.
## Exploring ## Exploring
@ -149,4 +149,3 @@ To clean up the sample service:
```shell ```shell
kubectl delete --filename service.yaml kubectl delete --filename service.yaml
``` ```

View File

@ -1,15 +1,15 @@
# Hello World - Clojure sample # Hello World - Clojure sample
A simple web app written in Clojure that you can use for testing. A simple web app written in Clojure that you can use for testing.
It reads in an env variable `TARGET` and prints "Hello ${TARGET}!". If It reads in an env variable `TARGET` and prints "Hello \${TARGET}!". If
TARGET is not specified, it will use "World" as the TARGET. TARGET is not specified, it will use "World" as the TARGET.
## Prerequisites ## Prerequisites
* A Kubernetes cluster with Knative installed. Follow the - A Kubernetes cluster with Knative installed. Follow the
[installation instructions](https://github.com/knative/docs/blob/master/install/README.md) if you need [installation instructions](https://github.com/knative/docs/blob/master/install/README.md) if you need
to create one. to create one.
* [Docker](https://www.docker.com) installed and running on your local machine, - [Docker](https://www.docker.com) installed and running on your local machine,
and a Docker Hub account configured (we'll use it for a container registry). and a Docker Hub account configured (we'll use it for a container registry).
## Recreating the sample code ## Recreating the sample code
@ -21,29 +21,29 @@ following instructions recreate the source files from this folder.
1. Create a new file named `src/helloworld/core.clj` and paste the following code. This 1. Create a new file named `src/helloworld/core.clj` and paste the following code. This
code creates a basic web server which listens on port 8080: code creates a basic web server which listens on port 8080:
```clojure ```clojure
(ns helloworld.core (ns helloworld.core
(:use ring.adapter.jetty) (:use ring.adapter.jetty)
(:gen-class)) (:gen-class))
(defn handler [request] (defn handler [request]
{:status 200 {:status 200
:headers {"Content-Type" "text/html"} :headers {"Content-Type" "text/html"}
:body (str "Hello " :body (str "Hello "
(if-let [target (System/getenv "TARGET")] (if-let [target (System/getenv "TARGET")]
target target
"World") "World")
"!\n")}) "!\n")})
(defn -main [& args]
(run-jetty handler {:port (if-let [port (System/getenv "PORT")]
(Integer/parseInt port)
8080)}))
```
(defn -main [& args]
(run-jetty handler {:port (if-let [port (System/getenv "PORT")]
(Integer/parseInt port)
8080)}))
```
1. In your project directory, create a file named `project.clj` and copy the code 1. In your project directory, create a file named `project.clj` and copy the code
below into it. This code defines the project's dependencies and entrypoint. below into it. This code defines the project's dependencies and entrypoint.
```clojure ```clojure
(defproject helloworld "1.0.0-SNAPSHOT" (defproject helloworld "1.0.0-SNAPSHOT"
:description "Hello World - Clojure sample" :description "Hello World - Clojure sample"
@ -57,50 +57,50 @@ following instructions recreate the source files from this folder.
block below into it. For detailed instructions on dockerizing a Clojure app, see block below into it. For detailed instructions on dockerizing a Clojure app, see
[the clojure image documentation](https://github.com/docker-library/docs/tree/master/clojure). [the clojure image documentation](https://github.com/docker-library/docs/tree/master/clojure).
```docker ```docker
# Use the official Clojure image. # Use the official Clojure image.
# https://hub.docker.com/_/clojure # https://hub.docker.com/_/clojure
FROM clojure FROM clojure
# Create the project and download dependencies. # Create the project and download dependencies.
WORKDIR /usr/src/app WORKDIR /usr/src/app
COPY project.clj . COPY project.clj .
RUN lein deps RUN lein deps
# Copy local code to the container image. # Copy local code to the container image.
COPY . . COPY . .
# Build an uberjar release artifact. # Build an uberjar release artifact.
RUN mv "$(lein uberjar | sed -n 's/^Created \(.*standalone\.jar\)/\1/p')" app-standalone.jar RUN mv "$(lein uberjar | sed -n 's/^Created \(.*standalone\.jar\)/\1/p')" app-standalone.jar
# Configure and document the service HTTP port. # Configure and document the service HTTP port.
ENV PORT 8080 ENV PORT 8080
EXPOSE $PORT EXPOSE $PORT
# Run the web service on container startup. # Run the web service on container startup.
CMD ["java", "-jar", "app-standalone.jar"] CMD ["java", "-jar", "app-standalone.jar"]
``` ```
1. Create a new file, `service.yaml` and copy the following service definition 1. Create a new file, `service.yaml` and copy the following service definition
into the file. Make sure to replace `{username}` with your Docker Hub username. into the file. Make sure to replace `{username}` with your Docker Hub username.
```yaml ```yaml
apiVersion: serving.knative.dev/v1alpha1 apiVersion: serving.knative.dev/v1alpha1
kind: Service kind: Service
metadata: metadata:
name: helloworld-clojure name: helloworld-clojure
namespace: default namespace: default
spec: spec:
runLatest: runLatest:
configuration: configuration:
revisionTemplate: revisionTemplate:
spec: spec:
container: container:
image: docker.io/{username}/helloworld-clojure image: docker.io/{username}/helloworld-clojure
env: env:
- name: TARGET - name: TARGET
value: "Clojure Sample v1" value: "Clojure Sample v1"
``` ```
## Building and deploying the sample ## Building and deploying the sample
@ -111,55 +111,57 @@ folder) you're ready to build and deploy the sample app.
Docker Hub, run these commands replacing `{username}` with your Docker Hub, run these commands replacing `{username}` with your
Docker Hub username: Docker Hub username:
```shell ```shell
# Build the container on your local machine # Build the container on your local machine
docker build -t {username}/helloworld-clojure . docker build -t {username}/helloworld-clojure .
# Push the container to docker registry # Push the container to docker registry
docker push {username}/helloworld-clojure docker push {username}/helloworld-clojure
``` ```
1. After the build has completed and the container is pushed to docker hub, you 1. After the build has completed and the container is pushed to docker hub, you
can deploy the app into your cluster. Ensure that the container image value can deploy the app into your cluster. Ensure that the container image value
in `service.yaml` matches the container you built in in `service.yaml` matches the container you built in
the previous step. Apply the configuration using `kubectl`: the previous step. Apply the configuration using `kubectl`:
```shell ```shell
kubectl apply --filename service.yaml kubectl apply --filename service.yaml
``` ```
1. Now that your service is created, Knative will perform the following steps: 1. Now that your service is created, Knative will perform the following steps:
* Create a new immutable revision for this version of the app.
* Network programming to create a route, ingress, service, and load balance for your app. - Create a new immutable revision for this version of the app.
* Automatically scale your pods up and down (including to zero active pods). - Network programming to create a route, ingress, service, and load balance for your app.
- Automatically scale your pods up and down (including to zero active pods).
1. To find the IP address for your service, use 1. To find the IP address for your service, use
`kubectl get svc knative-ingressgateway --namespace istio-system` to get the ingress IP for your `kubectl get svc knative-ingressgateway --namespace istio-system` to get the ingress IP for your
cluster. If your cluster is new, it may take sometime for the service to get asssigned cluster. If your cluster is new, it may take sometime for the service to get asssigned
an external IP address. an external IP address.
```shell ```shell
kubectl get svc knative-ingressgateway --namespace istio-system kubectl get svc knative-ingressgateway --namespace istio-system
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
knative-ingressgateway LoadBalancer 10.23.247.74 35.203.155.229 80:32380/TCP,443:32390/TCP,32400:32400/TCP 2d knative-ingressgateway LoadBalancer 10.23.247.74 35.203.155.229 80:32380/TCP,443:32390/TCP,32400:32400/TCP 2d
``` ```
1. To find the URL for your service, use 1. To find the URL for your service, use
```
kubectl get ksvc helloworld-clojure --output=custom-columns=NAME:.metadata.name,DOMAIN:.status.domain ```
NAME DOMAIN kubectl get ksvc helloworld-clojure --output=custom-columns=NAME:.metadata.name,DOMAIN:.status.domain
helloworld-clojure helloworld-clojure.default.example.com NAME DOMAIN
``` helloworld-clojure helloworld-clojure.default.example.com
```
1. Now you can make a request to your app to see the results. Replace 1. Now you can make a request to your app to see the results. Replace
`{IP_ADDRESS}` with the address you see returned in the previous step. `{IP_ADDRESS}` with the address you see returned in the previous step.
```shell ```shell
curl -H "Host: helloworld-clojure.default.example.com" http://{$IP_ADDRESS} curl -H "Host: helloworld-clojure.default.example.com" http://{$IP_ADDRESS}
Hello World: Clojure Sample v1! Hello World: Clojure Sample v1!
``` ```
## Removing the sample app deployment ## Removing the sample app deployment

View File

@ -1,17 +1,17 @@
# Hello World - .NET Core sample # Hello World - .NET Core sample
A simple web app written in C# using .NET Core 2.1 that you can use for testing. A simple web app written in C# using .NET Core 2.1 that you can use for testing.
It reads in an env variable `TARGET` and prints "Hello ${TARGET}!". If It reads in an env variable `TARGET` and prints "Hello \${TARGET}!". If
TARGET is not specified, it will use "World" as the TARGET. TARGET is not specified, it will use "World" as the TARGET.
## Prerequisites ## Prerequisites
* A Kubernetes cluster with Knative installed. Follow the - A Kubernetes cluster with Knative installed. Follow the
[installation instructions](https://github.com/knative/docs/blob/master/install/README.md) if you need [installation instructions](https://github.com/knative/docs/blob/master/install/README.md) if you need
to create one. to create one.
* [Docker](https://www.docker.com) installed and running on your local machine, - [Docker](https://www.docker.com) installed and running on your local machine,
and a Docker Hub account configured (we'll use it for a container registry). and a Docker Hub account configured (we'll use it for a container registry).
* You have installed [.NET Core SDK 2.1](https://www.microsoft.com/net/core). - You have installed [.NET Core SDK 2.1](https://www.microsoft.com/net/core).
## Recreating the sample code ## Recreating the sample code
@ -21,84 +21,84 @@ recreate the source files from this folder.
1. From the console, create a new empty web project using the dotnet command: 1. From the console, create a new empty web project using the dotnet command:
```shell ```shell
dotnet new web -o helloworld-csharp dotnet new web -o helloworld-csharp
``` ```
1. Update the `CreateWebHostBuilder` definition in `Program.cs` by adding 1. Update the `CreateWebHostBuilder` definition in `Program.cs` by adding
`.UseUrls()` to define the serving port: `.UseUrls()` to define the serving port:
```csharp ```csharp
public static IWebHostBuilder CreateWebHostBuilder(string[] args) public static IWebHostBuilder CreateWebHostBuilder(string[] args)
{ {
string port = Environment.GetEnvironmentVariable("PORT") ?? "8080"; string port = Environment.GetEnvironmentVariable("PORT") ?? "8080";
string url = String.Concat("http://0.0.0.0:", port); string url = String.Concat("http://0.0.0.0:", port);
return WebHost.CreateDefaultBuilder(args) return WebHost.CreateDefaultBuilder(args)
.UseStartup<Startup>().UseUrls(url); .UseStartup<Startup>().UseUrls(url);
} }
``` ```
1. Update the `app.Run(...)` statement in `Startup.cs` to read and return the 1. Update the `app.Run(...)` statement in `Startup.cs` to read and return the
TARGET environment variable: TARGET environment variable:
```csharp ```csharp
app.Run(async (context) => app.Run(async (context) =>
{ {
var target = Environment.GetEnvironmentVariable("TARGET") ?? "World"; var target = Environment.GetEnvironmentVariable("TARGET") ?? "World";
await context.Response.WriteAsync($"Hello {target}\n"); await context.Response.WriteAsync($"Hello {target}\n");
}); });
``` ```
1. In your project directory, create a file named `Dockerfile` and copy the code 1. In your project directory, create a file named `Dockerfile` and copy the code
block below into it. For detailed instructions on dockerizing a .NET core app, block below into it. For detailed instructions on dockerizing a .NET core app,
see [dockerizing a .NET core app](https://docs.microsoft.com/en-us/dotnet/core/docker/docker-basics-dotnet-core#dockerize-the-net-core-application). see [dockerizing a .NET core app](https://docs.microsoft.com/en-us/dotnet/core/docker/docker-basics-dotnet-core#dockerize-the-net-core-application).
```docker ```docker
# Use Microsoft's official .NET image. # Use Microsoft's official .NET image.
# https://hub.docker.com/r/microsoft/dotnet # https://hub.docker.com/r/microsoft/dotnet
FROM microsoft/dotnet:2.1-sdk FROM microsoft/dotnet:2.1-sdk
# Install production dependencies. # Install production dependencies.
# Copy csproj and restore as distinct layers. # Copy csproj and restore as distinct layers.
WORKDIR /app WORKDIR /app
COPY *.csproj . COPY *.csproj .
RUN dotnet restore RUN dotnet restore
# Copy local code to the container image. # Copy local code to the container image.
COPY . . COPY . .
# Build a release artifact. # Build a release artifact.
RUN dotnet publish -c Release -o out RUN dotnet publish -c Release -o out
# Configure and document the service HTTP port. # Configure and document the service HTTP port.
ENV PORT 8080 ENV PORT 8080
EXPOSE $PORT EXPOSE $PORT
# Run the web service on container startup. # Run the web service on container startup.
CMD ["dotnet", "out/helloworld-csharp.dll"] CMD ["dotnet", "out/helloworld-csharp.dll"]
``` ```
1. Create a new file, `service.yaml` and copy the following service definition 1. Create a new file, `service.yaml` and copy the following service definition
into the file. Make sure to replace `{username}` with your Docker Hub username. into the file. Make sure to replace `{username}` with your Docker Hub username.
```yaml ```yaml
apiVersion: serving.knative.dev/v1alpha1 apiVersion: serving.knative.dev/v1alpha1
kind: Service kind: Service
metadata: metadata:
name: helloworld-csharp name: helloworld-csharp
namespace: default namespace: default
spec: spec:
runLatest: runLatest:
configuration: configuration:
revisionTemplate: revisionTemplate:
spec: spec:
container: container:
image: docker.io/{username}/helloworld-csharp image: docker.io/{username}/helloworld-csharp
env: env:
- name: TARGET - name: TARGET
value: "C# Sample v1" value: "C# Sample v1"
``` ```
## Building and deploying the sample ## Building and deploying the sample
@ -109,55 +109,57 @@ folder) you're ready to build and deploy the sample app.
Docker Hub, run these commands replacing `{username}` with your Docker Hub, run these commands replacing `{username}` with your
Docker Hub username: Docker Hub username:
```shell ```shell
# Build the container on your local machine # Build the container on your local machine
docker build -t {username}/helloworld-csharp . docker build -t {username}/helloworld-csharp .
# Push the container to docker registry # Push the container to docker registry
docker push {username}/helloworld-csharp docker push {username}/helloworld-csharp
``` ```
1. After the build has completed and the container is pushed to docker hub, you 1. After the build has completed and the container is pushed to docker hub, you
can deploy the app into your cluster. Ensure that the container image value can deploy the app into your cluster. Ensure that the container image value
in `service.yaml` matches the container you built in in `service.yaml` matches the container you built in
the previous step. Apply the configuration using `kubectl`: the previous step. Apply the configuration using `kubectl`:
```shell ```shell
kubectl apply --filename service.yaml kubectl apply --filename service.yaml
``` ```
1. Now that your service is created, Knative will perform the following steps: 1. Now that your service is created, Knative will perform the following steps:
* Create a new immutable revision for this version of the app.
* Network programming to create a route, ingress, service, and load balance for your app. - Create a new immutable revision for this version of the app.
* Automatically scale your pods up and down (including to zero active pods). - Network programming to create a route, ingress, service, and load balance for your app.
- Automatically scale your pods up and down (including to zero active pods).
1. To find the IP address for your service, use 1. To find the IP address for your service, use
`kubectl get svc knative-ingressgateway --namespace istio-system` to get the ingress IP for your `kubectl get svc knative-ingressgateway --namespace istio-system` to get the ingress IP for your
cluster. If your cluster is new, it may take sometime for the service to get asssigned cluster. If your cluster is new, it may take sometime for the service to get asssigned
an external IP address. an external IP address.
```shell ```shell
kubectl get svc knative-ingressgateway --namespace istio-system kubectl get svc knative-ingressgateway --namespace istio-system
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
knative-ingressgateway LoadBalancer 10.23.247.74 35.203.155.229 80:32380/TCP,443:32390/TCP,32400:32400/TCP 2d knative-ingressgateway LoadBalancer 10.23.247.74 35.203.155.229 80:32380/TCP,443:32390/TCP,32400:32400/TCP 2d
``` ```
1. To find the URL for your service, use 1. To find the URL for your service, use
```
kubectl get ksvc helloworld-csharp --output=custom-columns=NAME:.metadata.name,DOMAIN:.status.domain ```
NAME DOMAIN kubectl get ksvc helloworld-csharp --output=custom-columns=NAME:.metadata.name,DOMAIN:.status.domain
helloworld-csharp helloworld-csharp.default.example.com NAME DOMAIN
``` helloworld-csharp helloworld-csharp.default.example.com
```
1. Now you can make a request to your app to see the result. Replace 1. Now you can make a request to your app to see the result. Replace
`{IP_ADDRESS}` with the address you see returned in the previous step. `{IP_ADDRESS}` with the address you see returned in the previous step.
```shell ```shell
curl -H "Host: helloworld-csharp.default.example.com" http://{IP_ADDRESS} curl -H "Host: helloworld-csharp.default.example.com" http://{IP_ADDRESS}
Hello World! Hello World!
``` ```
## Removing the sample app deployment ## Removing the sample app deployment

View File

@ -6,12 +6,12 @@ that you can use for testing. It reads in the env variable `TARGET` and prints
## Prerequisites ## Prerequisites
* A Kubernetes cluster with Knative installed. Follow the - A Kubernetes cluster with Knative installed. Follow the
[installation instructions](https://github.com/knative/docs/blob/master/install/README.md) [installation instructions](https://github.com/knative/docs/blob/master/install/README.md)
if you need to create one. if you need to create one.
* [Docker](https://www.docker.com) installed and running on your local machine, - [Docker](https://www.docker.com) installed and running on your local machine,
and a Docker Hub account configured (we'll use it for a container registry). and a Docker Hub account configured (we'll use it for a container registry).
* [dart-sdk](https://www.dartlang.org/tools/sdk#install) installed and configured - [dart-sdk](https://www.dartlang.org/tools/sdk#install) installed and configured
if you want to run the program locally. if you want to run the program locally.
## Recreating the sample code ## Recreating the sample code
@ -22,84 +22,84 @@ created using the following instructions.
1. Create a new directory and write `pubspec.yaml` as follows: 1. Create a new directory and write `pubspec.yaml` as follows:
```yaml ```yaml
name: hello_world_dart name: hello_world_dart
private: True # let's not accidentally publish this to pub.dartlang.org private: True # let's not accidentally publish this to pub.dartlang.org
description: >- description: >-
Hello world server example in dart. Hello world server example in dart.
dependencies: dependencies:
shelf: ^0.7.3 shelf: ^0.7.3
environment: environment:
sdk: '>=2.0.0 <3.0.0' sdk: ">=2.0.0 <3.0.0"
``` ```
2. If you want to run locally, install dependencies. If you only want to run in 2. If you want to run locally, install dependencies. If you only want to run in
Docker or Knative, you can skip this step. Docker or Knative, you can skip this step.
```shell ```shell
pub get pub get
``` ```
3. Create a new file `bin/main.dart` and write the following code: 3. Create a new file `bin/main.dart` and write the following code:
```dart ```dart
import 'dart:io'; import 'dart:io';
import 'package:shelf/shelf.dart'; import 'package:shelf/shelf.dart';
import 'package:shelf/shelf_io.dart'; import 'package:shelf/shelf_io.dart';
void main() { void main() {
// Find port to listen on from environment variable. // Find port to listen on from environment variable.
var port = int.tryParse(Platform.environment['PORT']); var port = int.tryParse(Platform.environment['PORT']);
// Read $TARGET from environment variable.
var target = Platform.environment['TARGET'] ?? 'World';
// Create handler. // Read $TARGET from environment variable.
var handler = Pipeline().addMiddleware(logRequests()).addHandler((request) { var target = Platform.environment['TARGET'] ?? 'World';
return Response.ok('Hello $target');
});
// Serve handler on given port. // Create handler.
serve(handler, InternetAddress.anyIPv4, port).then((server) { var handler = Pipeline().addMiddleware(logRequests()).addHandler((request) {
print('Serving at http://${server.address.host}:${server.port}'); return Response.ok('Hello $target');
}); });
}
```
4. Create a new file named `Dockerfile`, this file defines instructions for // Serve handler on given port.
serve(handler, InternetAddress.anyIPv4, port).then((server) {
print('Serving at http://${server.address.host}:${server.port}');
});
}
```
4. Create a new file named `Dockerfile`, this file defines instructions for
dockerizing your applications, for dart apps this can be done as follows: dockerizing your applications, for dart apps this can be done as follows:
```Dockerfile ```Dockerfile
# Use Google's official Dart image. # Use Google's official Dart image.
# https://hub.docker.com/r/google/dart-runtime/ # https://hub.docker.com/r/google/dart-runtime/
FROM google/dart-runtime FROM google/dart-runtime
# Configure and document the service HTTP port. # Configure and document the service HTTP port.
ENV PORT 8080 ENV PORT 8080
EXPOSE $PORT EXPOSE $PORT
``` ```
5. Create a new file, `service.yaml` and copy the following service definition 5. Create a new file, `service.yaml` and copy the following service definition
into the file. Make sure to replace `{username}` with your Docker Hub username. into the file. Make sure to replace `{username}` with your Docker Hub username.
```yaml ```yaml
apiVersion: serving.knative.dev/v1alpha1 apiVersion: serving.knative.dev/v1alpha1
kind: Service kind: Service
metadata: metadata:
name: helloworld-dart name: helloworld-dart
namespace: default namespace: default
spec: spec:
runLatest: runLatest:
configuration: configuration:
revisionTemplate: revisionTemplate:
spec: spec:
container: container:
image: docker.io/{username}/helloworld-dart image: docker.io/{username}/helloworld-dart
env: env:
- name: TARGET - name: TARGET
value: "Dart Sample v1" value: "Dart Sample v1"
``` ```
## Building and deploying the sample ## Building and deploying the sample
@ -110,55 +110,57 @@ folder) you're ready to build and deploy the sample app.
Docker Hub, run these commands replacing `{username}` with your Docker Hub, run these commands replacing `{username}` with your
Docker Hub username: Docker Hub username:
```shell ```shell
# Build the container on your local machine # Build the container on your local machine
docker build -t {username}/helloworld-dart . docker build -t {username}/helloworld-dart .
# Push the container to docker registry # Push the container to docker registry
docker push {username}/helloworld-dart docker push {username}/helloworld-dart
``` ```
1. After the build has completed and the container is pushed to docker hub, you 1. After the build has completed and the container is pushed to docker hub, you
can deploy the app into your cluster. Ensure that the container image value can deploy the app into your cluster. Ensure that the container image value
in `service.yaml` matches the container you built in in `service.yaml` matches the container you built in
the previous step. Apply the configuration using `kubectl`: the previous step. Apply the configuration using `kubectl`:
```shell ```shell
kubectl apply --filename service.yaml kubectl apply --filename service.yaml
``` ```
1. Now that your service is created, Knative will perform the following steps: 1. Now that your service is created, Knative will perform the following steps:
* Create a new immutable revision for this version of the app.
* Network programming to create a route, ingress, service, and load balance for your app. - Create a new immutable revision for this version of the app.
* Automatically scale your pods up and down (including to zero active pods). - Network programming to create a route, ingress, service, and load balance for your app.
- Automatically scale your pods up and down (including to zero active pods).
1. To find the IP address for your service, use 1. To find the IP address for your service, use
`kubectl get svc knative-ingressgateway --namespace istio-system` to get the ingress IP for your `kubectl get svc knative-ingressgateway --namespace istio-system` to get the ingress IP for your
cluster. If your cluster is new, it may take sometime for the service to get asssigned cluster. If your cluster is new, it may take sometime for the service to get asssigned
an external IP address. an external IP address.
```shell ```shell
kubectl get svc knative-ingressgateway --namespace istio-system kubectl get svc knative-ingressgateway --namespace istio-system
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
knative-ingressgateway LoadBalancer 10.23.247.74 35.203.155.229 80:32380/TCP,443:32390/TCP,32400:32400/TCP 2d knative-ingressgateway LoadBalancer 10.23.247.74 35.203.155.229 80:32380/TCP,443:32390/TCP,32400:32400/TCP 2d
``` ```
1. To find the URL for your service, use 1. To find the URL for your service, use
```
kubectl get ksvc helloworld-dart --output=custom-columns=NAME:.metadata.name,DOMAIN:.status.domain ```
NAME DOMAIN kubectl get ksvc helloworld-dart --output=custom-columns=NAME:.metadata.name,DOMAIN:.status.domain
helloworld-dart helloworld-dart.default.example.com NAME DOMAIN
``` helloworld-dart helloworld-dart.default.example.com
```
1. Now you can make a request to your app to see the result. Replace 1. Now you can make a request to your app to see the result. Replace
`{IP_ADDRESS}` with the address you see returned in the previous step. `{IP_ADDRESS}` with the address you see returned in the previous step.
```shell ```shell
curl -H "Host: helloworld-dart.default.example.com" http://{IP_ADDRESS} curl -H "Host: helloworld-dart.default.example.com" http://{IP_ADDRESS}
Hello Dart Sample v1 Hello Dart Sample v1
``` ```
## Removing the sample app deployment ## Removing the sample app deployment
@ -167,4 +169,3 @@ To remove the sample app from your cluster, delete the service record:
```shell ```shell
kubectl delete --filename service.yaml kubectl delete --filename service.yaml
``` ```

View File

@ -14,9 +14,9 @@ building, running, and packaging Elixir Web applications.
To start your Phoenix server: To start your Phoenix server:
* Install dependencies with `mix deps.get` - Install dependencies with `mix deps.get`
* Install Node.js dependencies with `cd assets && npm install` - Install Node.js dependencies with `cd assets && npm install`
* Start Phoenix endpoint with `mix phx.server` - Start Phoenix endpoint with `mix phx.server`
Now you can visit [`localhost:4000`](http://localhost:4000) from your browser. Now you can visit [`localhost:4000`](http://localhost:4000) from your browser.
@ -24,11 +24,11 @@ Now you can visit [`localhost:4000`](http://localhost:4000) from your browser.
1. Generate a new project. 1. Generate a new project.
```shell ```shell
mix phoenix.new helloelixir mix phoenix.new helloelixir
``` ```
When asked, if you want to `Fetch and install dependencies? [Yn]` select `y` When asked, if you want to `Fetch and install dependencies? [Yn]` select `y`
1. Follow the direction in the output to change directories into 1. Follow the direction in the output to change directories into
start your local server with `mix phoenix.server` start your local server with `mix phoenix.server`
@ -109,9 +109,9 @@ Now you can visit [`localhost:4000`](http://localhost:4000) from your browser.
container: container:
image: docker.io/{username}/helloworld-elixir image: docker.io/{username}/helloworld-elixir
env: env:
- name: TARGET - name: TARGET
value: "elixir Sample v1" value: "elixir Sample v1"
``` ```
# Building and deploying the sample # Building and deploying the sample
@ -119,56 +119,58 @@ The sample in this directory is ready to build and deploy without changes.
You can deploy the sample as is, or use you created version following the You can deploy the sample as is, or use you created version following the
directions above. directions above.
1. Generate a new `secret_key_base` in the `config/prod.secret.exs` file. 1. Generate a new `secret_key_base` in the `config/prod.secret.exs` file.
Phoenix applications use a secrets file on production deployments and, by Phoenix applications use a secrets file on production deployments and, by
default, that file is not checked into source control. We have provides default, that file is not checked into source control. We have provides
shell of an example on `config/prod.secret.exs.sample` and you can use the shell of an example on `config/prod.secret.exs.sample` and you can use the
following command to generate a new prod secrets file. following command to generate a new prod secrets file.
```shell ```shell
SECRET_KEY_BASE=$(elixir -e ":crypto.strong_rand_bytes(48) |> Base.encode64 |> IO.puts") SECRET_KEY_BASE=$(elixir -e ":crypto.strong_rand_bytes(48) |> Base.encode64 |> IO.puts")
sed "s|SECRET+KEY+BASE|$SECRET_KEY_BASE|" config/prod.secret.exs.sample >config/prod.secret.exs sed "s|SECRET+KEY+BASE|$SECRET_KEY_BASE|" config/prod.secret.exs.sample >config/prod.secret.exs
```
1. Use Docker to build the sample code into a container. To build and push
with Docker Hub, run these commands replacing `{username}` with your Docker
Hub username:
```shell
# Build the container on your local machine
docker build -t {username}/helloworld-elixir .
# Push the container to docker registry
docker push {username}/helloworld-elixir
``` ```
1. After the build has completed and the container is pushed to docker hub, you 1. Use Docker to build the sample code into a container. To build and push
can deploy the app into your cluster. Ensure that the container image value with Docker Hub, run these commands replacing `{username}` with your Docker
in `service.yaml` matches the container you built in Hub username:
the previous step. Apply the configuration using `kubectl`:
```shell
# Build the container on your local machine
docker build -t {username}/helloworld-elixir .
# Push the container to docker registry
docker push {username}/helloworld-elixir
```
1. After the build has completed and the container is pushed to docker hub, you
can deploy the app into your cluster. Ensure that the container image value
in `service.yaml` matches the container you built in
the previous step. Apply the configuration using `kubectl`:
```shell ```shell
kubectl apply --filename service.yaml kubectl apply --filename service.yaml
``` ```
1. Now that your service is created, Knative will perform the following steps: 1. Now that your service is created, Knative will perform the following steps:
* Create a new immutable revision for this version of the app.
* Network programming to create a route, ingress, service, and load balance for your app.
* Automatically scale your pods up and down (including to zero active pods).
1. To find the IP address for your service, use - Create a new immutable revision for this version of the app.
`kubectl get svc knative-ingressgateway --namespace istio-system` to get the ingress IP for your - Network programming to create a route, ingress, service, and load balance for your app.
cluster. If your cluster is new, it may take sometime for the service to get asssigned - Automatically scale your pods up and down (including to zero active pods).
an external IP address.
``` 1. To find the IP address for your service, use
kubectl get svc knative-ingressgateway --namespace istio-system `kubectl get svc knative-ingressgateway --namespace istio-system` to get the ingress IP for your
cluster. If your cluster is new, it may take sometime for the service to get asssigned
an external IP address.
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE ```
knative-ingressgateway LoadBalancer 10.35.254.218 35.225.171.32 80:32380/TCP,443:32390/TCP,32400:32400/TCP 1h kubectl get svc knative-ingressgateway --namespace istio-system
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
knative-ingressgateway LoadBalancer 10.35.254.218 35.225.171.32 80:32380/TCP,443:32390/TCP,32400:32400/TCP 1h
``` ```
1. To find the URL for your service, use 1. To find the URL for your service, use
``` ```
kubectl get ksvc helloworld-elixir --output=custom-columns=NAME:.metadata.name,DOMAIN:.status.domain kubectl get ksvc helloworld-elixir --output=custom-columns=NAME:.metadata.name,DOMAIN:.status.domain
@ -177,32 +179,33 @@ knative-ingressgateway LoadBalancer 10.35.254.218 35.225.171.32 80:32380
helloworld-elixir helloworld-elixir.default.example.com helloworld-elixir helloworld-elixir.default.example.com
``` ```
1. Now you can make a request to your app to see the results. Replace 1. Now you can make a request to your app to see the results. Replace
`{IP_ADDRESS}` with the address you see returned in the previous step. `{IP_ADDRESS}` with the address you see returned in the previous step.
```shell ```shell
curl -H "Host: helloworld-elixir.default.example.com" http://{IP_ADDRESS} curl -H "Host: helloworld-elixir.default.example.com" http://{IP_ADDRESS}
... ...
# HTML from your application is returned. # HTML from your application is returned.
```
Here is the HTML returned from our deployed sample application:
```HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<title>Hello Knative</title>
<link rel="stylesheet" type="text/css" href="/css/app-833cc7e8eeed7a7953c5a02e28130dbd.css?vsn=d">
</head>
``` ```
Here is the HTML returned from our deployed sample application:
```HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<title>Hello Knative</title>
<link rel="stylesheet" type="text/css" href="/css/app-833cc7e8eeed7a7953c5a02e28130dbd.css?vsn=d">
</head>
<body> <body>
<div class="container"> <div class="container">
<header class="header"> <header class="header">
@ -215,6 +218,7 @@ knative-ingressgateway LoadBalancer 10.35.254.218 35.225.171.32 80:32380
<p class="alert alert-danger" role="alert"></p> <p class="alert alert-danger" role="alert"></p>
<main role="main"> <main role="main">
<div class="jumbotron"> <div class="jumbotron">
<h2>Welcome to Knative and Elixir</h2> <h2>Welcome to Knative and Elixir</h2>
@ -291,6 +295,7 @@ knative-ingressgateway LoadBalancer 10.35.254.218 35.225.171.32 80:32380
</div> <!-- /container --> </div> <!-- /container -->
<script src="/js/app-930ab1950e10d7b5ab5083423c28f06e.js?vsn=d"></script> <script src="/js/app-930ab1950e10d7b5ab5083423c28f06e.js?vsn=d"></script>
</body> </body>
</html> </html>
``` ```

View File

@ -6,10 +6,10 @@ It reads in an env variable `TARGET` and prints `Hello ${TARGET}!`. If
## Prerequisites ## Prerequisites
* A Kubernetes cluster with Knative installed. Follow the - A Kubernetes cluster with Knative installed. Follow the
[installation instructions](https://github.com/knative/docs/blob/master/install/README.md) if you need [installation instructions](https://github.com/knative/docs/blob/master/install/README.md) if you need
to create one. to create one.
* [Docker](https://www.docker.com) installed and running on your local machine, - [Docker](https://www.docker.com) installed and running on your local machine,
and a Docker Hub account configured (we'll use it for a container registry). and a Docker Hub account configured (we'll use it for a container registry).
## Recreating the sample code ## Recreating the sample code
@ -21,92 +21,92 @@ following instructions recreate the source files from this folder.
1. Create a new file named `helloworld.go` and paste the following code. This 1. Create a new file named `helloworld.go` and paste the following code. This
code creates a basic web server which listens on port 8080: code creates a basic web server which listens on port 8080:
```go ```go
package main package main
import ( import (
"fmt" "fmt"
"log" "log"
"net/http" "net/http"
"os" "os"
) )
func handler(w http.ResponseWriter, r *http.Request) { func handler(w http.ResponseWriter, r *http.Request) {
log.Print("Hello world received a request.") log.Print("Hello world received a request.")
target := os.Getenv("TARGET") target := os.Getenv("TARGET")
if target == "" { if target == "" {
target = "World" target = "World"
} }
fmt.Fprintf(w, "Hello %s!\n", target) fmt.Fprintf(w, "Hello %s!\n", target)
} }
func main() { func main() {
log.Print("Hello world sample started.") log.Print("Hello world sample started.")
http.HandleFunc("/", handler) http.HandleFunc("/", handler)
port := os.Getenv("PORT") port := os.Getenv("PORT")
if port == "" { if port == "" {
port = "8080" port = "8080"
} }
log.Fatal(http.ListenAndServe(fmt.Sprintf(":%s", port), nil)) log.Fatal(http.ListenAndServe(fmt.Sprintf(":%s", port), nil))
} }
``` ```
1. In your project directory, create a file named `Dockerfile` and copy the code 1. In your project directory, create a file named `Dockerfile` and copy the code
block below into it. For detailed instructions on dockerizing a Go app, see block below into it. For detailed instructions on dockerizing a Go app, see
[Deploying Go servers with Docker](https://blog.golang.org/docker). [Deploying Go servers with Docker](https://blog.golang.org/docker).
```docker ```docker
# Use the offical Golang image to create a build artifact. # Use the offical Golang image to create a build artifact.
# This is based on Debian and sets the GOPATH to /go. # This is based on Debian and sets the GOPATH to /go.
FROM golang as builder FROM golang as builder
# Copy local code to the container image. # Copy local code to the container image.
WORKDIR /go/src/github.com/knative/docs/helloworld WORKDIR /go/src/github.com/knative/docs/helloworld
COPY . . COPY . .
# Build the helloworld command inside the container. # Build the helloworld command inside the container.
# (You may fetch or manage dependencies here, # (You may fetch or manage dependencies here,
# either manually or with a tool like "godep".) # either manually or with a tool like "godep".)
RUN CGO_ENABLED=0 GOOS=linux go build -v -o helloworld RUN CGO_ENABLED=0 GOOS=linux go build -v -o helloworld
# Use a Docker multi-stage build to create a lean production image. # Use a Docker multi-stage build to create a lean production image.
# https://docs.docker.com/develop/develop-images/multistage-build/#use-multi-stage-builds # https://docs.docker.com/develop/develop-images/multistage-build/#use-multi-stage-builds
FROM alpine FROM alpine
# Copy the binary to the production image from the builder stage. # Copy the binary to the production image from the builder stage.
COPY --from=builder /go/src/github.com/knative/docs/helloworld/helloworld /helloworld COPY --from=builder /go/src/github.com/knative/docs/helloworld/helloworld /helloworld
# Configure and document the service HTTP port. # Configure and document the service HTTP port.
ENV PORT 8080 ENV PORT 8080
EXPOSE $PORT EXPOSE $PORT
# Run the web service on container startup. # Run the web service on container startup.
CMD ["/helloworld"] CMD ["/helloworld"]
``` ```
1. Create a new file, `service.yaml` and copy the following service definition 1. Create a new file, `service.yaml` and copy the following service definition
into the file. Make sure to replace `{username}` with your Docker Hub username. into the file. Make sure to replace `{username}` with your Docker Hub username.
```yaml ```yaml
apiVersion: serving.knative.dev/v1alpha1 apiVersion: serving.knative.dev/v1alpha1
kind: Service kind: Service
metadata: metadata:
name: helloworld-go name: helloworld-go
namespace: default namespace: default
spec: spec:
runLatest: runLatest:
configuration: configuration:
revisionTemplate: revisionTemplate:
spec: spec:
container: container:
image: docker.io/{username}/helloworld-go image: docker.io/{username}/helloworld-go
env: env:
- name: TARGET - name: TARGET
value: "Go Sample v1" value: "Go Sample v1"
``` ```
## Building and deploying the sample ## Building and deploying the sample
@ -117,69 +117,74 @@ folder) you're ready to build and deploy the sample app.
Docker Hub, run these commands replacing `{username}` with your Docker Hub, run these commands replacing `{username}` with your
Docker Hub username: Docker Hub username:
```shell ```shell
# Build the container on your local machine # Build the container on your local machine
docker build -t {username}/helloworld-go . docker build -t {username}/helloworld-go .
# Push the container to docker registry # Push the container to docker registry
docker push {username}/helloworld-go docker push {username}/helloworld-go
``` ```
1. After the build has completed and the container is pushed to docker hub, you 1. After the build has completed and the container is pushed to docker hub, you
can deploy the app into your cluster. Ensure that the container image value can deploy the app into your cluster. Ensure that the container image value
in `service.yaml` matches the container you built in in `service.yaml` matches the container you built in
the previous step. Apply the configuration using `kubectl`: the previous step. Apply the configuration using `kubectl`:
```shell ```shell
kubectl apply --filename service.yaml kubectl apply --filename service.yaml
``` ```
1. Now that your service is created, Knative will perform the following steps: 1. Now that your service is created, Knative will perform the following steps:
* Create a new immutable revision for this version of the app.
* Network programming to create a route, ingress, service, and load balance for your app. - Create a new immutable revision for this version of the app.
* Automatically scale your pods up and down (including to zero active pods). - Network programming to create a route, ingress, service, and load balance for your app.
- Automatically scale your pods up and down (including to zero active pods).
1. Run the following command to find the external IP address for your service. The ingress IP for your 1. Run the following command to find the external IP address for your service. The ingress IP for your
cluster is returned. If you just created your cluster, you might need to wait and rerun the command until cluster is returned. If you just created your cluster, you might need to wait and rerun the command until
your service gets asssigned an external IP address. your service gets asssigned an external IP address.
```shell ```shell
kubectl get svc knative-ingressgateway --namespace istio-system kubectl get svc knative-ingressgateway --namespace istio-system
``` ```
Example:
```shell
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
knative-ingressgateway LoadBalancer 10.23.247.74 35.203.155.229 80:32380/TCP,443:32390/TCP,32400:32400/TCP 2d
``` Example:
```shell
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
knative-ingressgateway LoadBalancer 10.23.247.74 35.203.155.229 80:32380/TCP,443:32390/TCP,32400:32400/TCP 2d
```
1. Run the following command to find the domain URL for your service: 1. Run the following command to find the domain URL for your service:
```shell
kubectl get ksvc helloworld-go --output=custom-columns=NAME:.metadata.name,DOMAIN:.status.domain ```shell
``` kubectl get ksvc helloworld-go --output=custom-columns=NAME:.metadata.name,DOMAIN:.status.domain
```
Example:
```shell Example:
NAME DOMAIN
helloworld-go helloworld-go.default.example.com ```shell
``` NAME DOMAIN
helloworld-go helloworld-go.default.example.com
```
1. Test your app by sending it a request. Use the following 1. Test your app by sending it a request. Use the following
`curl` command with the domain URL `helloworld-go.default.example.com` and `EXTERNAL-IP` address that you retrieved `curl` command with the domain URL `helloworld-go.default.example.com` and `EXTERNAL-IP` address that you retrieved
in the previous steps: in the previous steps:
```shell ```shell
curl -H "Host: helloworld-go.default.example.com" http://{EXTERNAL_IP_ADDRESS} curl -H "Host: helloworld-go.default.example.com" http://{EXTERNAL_IP_ADDRESS}
``` ```
Example:
```shell
curl -H "Host: helloworld-go.default.example.com" http://35.203.155.229
Hello World: Go Sample v1!
```
> Note: Add `-v` option to get more detail if the `curl` command failed. Example:
```shell
curl -H "Host: helloworld-go.default.example.com" http://35.203.155.229
Hello World: Go Sample v1!
```
> Note: Add `-v` option to get more detail if the `curl` command failed.
## Removing the sample app deployment ## Removing the sample app deployment

View File

@ -1,15 +1,15 @@
# Hello World - Haskell sample # Hello World - Haskell sample
A simple web app written in Haskell that you can use for testing. A simple web app written in Haskell that you can use for testing.
It reads in an env variable `TARGET` and prints "Hello ${TARGET}!". If It reads in an env variable `TARGET` and prints "Hello \${TARGET}!". If
TARGET is not specified, it will use "World" as the TARGET. TARGET is not specified, it will use "World" as the TARGET.
## Prerequisites ## Prerequisites
* A Kubernetes cluster with Knative installed. Follow the - A Kubernetes cluster with Knative installed. Follow the
[installation instructions](https://github.com/knative/docs/blob/master/install/README.md) if you need [installation instructions](https://github.com/knative/docs/blob/master/install/README.md) if you need
to create one. to create one.
* [Docker](https://www.docker.com) installed and running on your local machine, - [Docker](https://www.docker.com) installed and running on your local machine,
and a Docker Hub account configured (we'll use it for a container registry). and a Docker Hub account configured (we'll use it for a container registry).
## Recreating the sample code ## Recreating the sample code
@ -20,114 +20,115 @@ following instructions recreate the source files from this folder.
1. Create a new file named `stack.yaml` and paste the following code: 1. Create a new file named `stack.yaml` and paste the following code:
```yaml ```yaml
flags: {} flags: {}
packages: packages:
- . - .
extra-deps: [] extra-deps: []
resolver: lts-10.7 resolver: lts-10.7
``` ```
1. Create a new file named `package.yaml` and paste the following code 1. Create a new file named `package.yaml` and paste the following code
```yaml ```yaml
name: helloworld-haskell name: helloworld-haskell
version: 0.1.0.0 version: 0.1.0.0
dependencies: dependencies:
- base >= 4.7 && < 5 - base >= 4.7 && < 5
- scotty - scotty
- text - text
executables: executables:
helloworld-haskell-exe: helloworld-haskell-exe:
main: Main.hs main: Main.hs
source-dirs: app source-dirs: app
ghc-options: ghc-options:
- -threaded - -threaded
- -rtsopts - -rtsopts
- -with-rtsopts=-N - -with-rtsopts=-N
``` ```
1. Create a `app` folder, then create a new file named `Main.hs` in that folder 1. Create a `app` folder, then create a new file named `Main.hs` in that folder
and paste the following code. This code creates a basic web server which and paste the following code. This code creates a basic web server which
listens on port 8080: listens on port 8080:
```haskell ```haskell
{-# LANGUAGE OverloadedStrings #-} }
import Data.Maybe e
import Data.Monoid ((<>)) )
import Data.Text.Lazy (Text) )
import Data.Text.Lazy y
import System.Environment (lookupEnv) )
import Web.Scotty (ActionM, ScottyM, scotty) )
import Web.Scotty.Trans s
main :: IO () )
main = do o
t <- fromMaybe "World" <$> lookupEnv "TARGET" "
pStr <- fromMaybe "8080" <$> lookupEnv "PORT" "
let p = read pStr :: Int t
scotty p (route t) )
route :: String -> ScottyM() )
route t = get "/" $ hello t t
hello :: String -> ActionM() )
hello t = text $ pack ("Hello " ++ t) )
``` ```
1. In your project directory, create a file named `Dockerfile` and copy the code 1. In your project directory, create a file named `Dockerfile` and copy the code
block below into it. block below into it.
```docker ```docker
# Use the official Haskell image to create a build artifact. # Use the official Haskell image to create a build artifact.
# https://hub.docker.com/_/haskell/ # https://hub.docker.com/_/haskell/
FROM haskell:8.2.2 as builder FROM haskell:8.2.2 as builder
# Copy local code to the container image. # Copy local code to the container image.
WORKDIR /app WORKDIR /app
COPY . . COPY . .
# Build and test our code, then build the “helloworld-haskell-exe” executable. # Build and test our code, then build the “helloworld-haskell-exe” executable.
RUN stack setup RUN stack setup
RUN stack build --copy-bins RUN stack build --copy-bins
# Use a Docker multi-stage build to create a lean production image. # Use a Docker multi-stage build to create a lean production image.
# https://docs.docker.com/develop/develop-images/multistage-build/#use-multi-stage-builds # https://docs.docker.com/develop/develop-images/multistage-build/#use-multi-stage-builds
FROM fpco/haskell-scratch:integer-gmp FROM fpco/haskell-scratch:integer-gmp
# Copy the "helloworld-haskell-exe" executable from the builder stage to the production image. # Copy the "helloworld-haskell-exe" executable from the builder stage to the production image.
WORKDIR /root/ WORKDIR /root/
COPY --from=builder /root/.local/bin/helloworld-haskell-exe . COPY --from=builder /root/.local/bin/helloworld-haskell-exe .
# Configure and document the service HTTP port. # Configure and document the service HTTP port.
ENV PORT 8080 ENV PORT 8080
EXPOSE $PORT EXPOSE $PORT
# Run the web service on container startup. # Run the web service on container startup.
CMD ["./helloworld-haskell-exe"] CMD ["./helloworld-haskell-exe"]
``` ```
1. Create a new file, `service.yaml` and copy the following service definition 1. Create a new file, `service.yaml` and copy the following service definition
into the file. Make sure to replace `{username}` with your Docker Hub username. into the file. Make sure to replace `{username}` with your Docker Hub username.
```yaml ```yaml
apiVersion: serving.knative.dev/v1alpha1 apiVersion: serving.knative.dev/v1alpha1
kind: Service kind: Service
metadata: metadata:
name: helloworld-haskell name: helloworld-haskell
namespace: default namespace: default
spec: spec:
runLatest: runLatest:
configuration: configuration:
revisionTemplate: revisionTemplate:
spec: spec:
container: container:
image: docker.io/{username}/helloworld-haskell image: docker.io/{username}/helloworld-haskell
env: env:
- name: TARGET - name: TARGET
value: "Haskell Sample v1" value: "Haskell Sample v1"
``` ```
## Build and deploy this sample ## Build and deploy this sample
@ -138,62 +139,64 @@ folder) you're ready to build and deploy the sample app.
Docker Hub, enter these commands replacing `{username}` with your Docker Hub, enter these commands replacing `{username}` with your
Docker Hub username: Docker Hub username:
```shell ```shell
# Build the container on your local machine # Build the container on your local machine
docker build -t {username}/helloworld-haskell . docker build -t {username}/helloworld-haskell .
# Push the container to docker registry # Push the container to docker registry
docker push {username}/helloworld-haskell docker push {username}/helloworld-haskell
``` ```
1. After the build has completed and the container is pushed to Docker Hub, you 1. After the build has completed and the container is pushed to Docker Hub, you
can deploy the app into your cluster. Ensure that the container image value can deploy the app into your cluster. Ensure that the container image value
in `service.yaml` matches the container you built in in `service.yaml` matches the container you built in
the previous step. Apply the configuration using `kubectl`: the previous step. Apply the configuration using `kubectl`:
```shell ```shell
kubectl apply --filename service.yaml kubectl apply --filename service.yaml
``` ```
1. Now that your service is created, Knative will perform the following steps: 1. Now that your service is created, Knative will perform the following steps:
* Create a new immutable revision for this version of the app.
* Network programming to create a route, ingress, service, and load balance for your app. - Create a new immutable revision for this version of the app.
* Automatically scale your pods up and down (including to zero active pods). - Network programming to create a route, ingress, service, and load balance for your app.
- Automatically scale your pods up and down (including to zero active pods).
1. To find the IP address for your service, enter 1. To find the IP address for your service, enter
`kubectl get svc knative-ingressgateway --namespace istio-system` to get the ingress IP for your `kubectl get svc knative-ingressgateway --namespace istio-system` to get the ingress IP for your
cluster. If your cluster is new, it may take some time for the service to get assigned cluster. If your cluster is new, it may take some time for the service to get assigned
an external IP address. an external IP address.
```shell ```shell
kubectl get svc knative-ingressgateway --namespace istio-system kubectl get svc knative-ingressgateway --namespace istio-system
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
knative-ingressgateway LoadBalancer 10.23.247.74 35.203.155.229 80:32380/TCP,443:32390/TCP,32400:32400/TCP 2d knative-ingressgateway LoadBalancer 10.23.247.74 35.203.155.229 80:32380/TCP,443:32390/TCP,32400:32400/TCP 2d
``` ```
For minikube or bare-metal, get IP_ADDRESS by running the following command For minikube or bare-metal, get IP_ADDRESS by running the following command
```shell ```shell
echo $(kubectl get node --output 'jsonpath={.items[0].status.addresses[0].address}'):$(kubectl get svc knative-ingressgateway --namespace istio-system --output 'jsonpath={.spec.ports[?(@.port==80)].nodePort}') echo $(kubectl get node --output 'jsonpath={.items[0].status.addresses[0].address}'):$(kubectl get svc knative-ingressgateway --namespace istio-system --output 'jsonpath={.spec.ports[?(@.port==80)].nodePort}')
``` ```
1. To find the URL for your service, enter: 1. To find the URL for your service, enter:
```
kubectl get ksvc helloworld-haskell --output=custom-columns=NAME:.metadata.name,DOMAIN:.status.domain ```
NAME DOMAIN kubectl get ksvc helloworld-haskell --output=custom-columns=NAME:.metadata.name,DOMAIN:.status.domain
helloworld-haskell helloworld-haskell.default.example.com NAME DOMAIN
``` helloworld-haskell helloworld-haskell.default.example.com
```
1. Now you can make a request to your app and see the result. Replace 1. Now you can make a request to your app and see the result. Replace
`{IP_ADDRESS}` with the address you see returned in the previous step. `{IP_ADDRESS}` with the address you see returned in the previous step.
```shell ```shell
curl -H "Host: helloworld-haskell.default.example.com" http://{IP_ADDRESS} curl -H "Host: helloworld-haskell.default.example.com" http://{IP_ADDRESS}
Hello world: Haskell Sample v1 Hello world: Haskell Sample v1
``` ```
## Removing the sample app deployment ## Removing the sample app deployment
@ -202,4 +205,3 @@ To remove the sample app from your cluster, delete the service record:
```shell ```shell
kubectl delete --filename service.yaml kubectl delete --filename service.yaml
``` ```

View File

@ -1,17 +1,17 @@
# Hello World - Spring Boot Java sample # Hello World - Spring Boot Java sample
A simple web app written in Java using Spring Boot 2.0 that you can use for testing. A simple web app written in Java using Spring Boot 2.0 that you can use for testing.
It reads in an env variable `TARGET` and prints "Hello ${TARGET}!". If It reads in an env variable `TARGET` and prints "Hello \${TARGET}!". If
TARGET is not specified, it will use "World" as the TARGET. TARGET is not specified, it will use "World" as the TARGET.
## Prerequisites ## Prerequisites
* A Kubernetes cluster with Knative installed. Follow the - A Kubernetes cluster with Knative installed. Follow the
[installation instructions](https://github.com/knative/docs/blob/master/install/README.md) if you need [installation instructions](https://github.com/knative/docs/blob/master/install/README.md) if you need
to create one. to create one.
* [Docker](https://www.docker.com) installed and running on your local machine, - [Docker](https://www.docker.com) installed and running on your local machine,
and a Docker Hub account configured (we'll use it for a container registry). and a Docker Hub account configured (we'll use it for a container registry).
* You have installed [Java SE 8 or later JDK](http://www.oracle.com/technetwork/java/javase/downloads/index.html). - You have installed [Java SE 8 or later JDK](http://www.oracle.com/technetwork/java/javase/downloads/index.html).
## Recreating the sample code ## Recreating the sample code
@ -21,53 +21,54 @@ recreate the source files from this folder.
1. From the console, create a new empty web project using the curl and unzip commands: 1. From the console, create a new empty web project using the curl and unzip commands:
```shell ```shell
curl https://start.spring.io/starter.zip \ curl https://start.spring.io/starter.zip \
-d dependencies=web \ -d dependencies=web \
-d name=helloworld \ -d name=helloworld \
-d artifactId=helloworld \ -d artifactId=helloworld \
-o helloworld.zip -o helloworld.zip
unzip helloworld.zip unzip helloworld.zip
``` ```
If you don't have curl installed, you can accomplish the same by visiting the If you don't have curl installed, you can accomplish the same by visiting the
[Spring Initializr](https://start.spring.io/) page. Specify Artifact as `helloworld` [Spring Initializr](https://start.spring.io/) page. Specify Artifact as `helloworld`
and add the `Web` dependency. Then click `Generate Project`, download and unzip the and add the `Web` dependency. Then click `Generate Project`, download and unzip the
sample archive. sample archive.
1. Update the `SpringBootApplication` class in 1. Update the `SpringBootApplication` class in
`src/main/java/com/example/helloworld/HelloworldApplication.java` by adding `src/main/java/com/example/helloworld/HelloworldApplication.java` by adding
a `@RestController` to handle the "/" mapping and also add a `@Value` field to a `@RestController` to handle the "/" mapping and also add a `@Value` field to
provide the TARGET environment variable: provide the TARGET environment variable:
```java ```java
package com.example.helloworld; package com.example.helloworld;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
@SpringBootApplication @SpringBootApplication
public class HelloworldApplication { public class HelloworldApplication {
@Value("${TARGET:World}") @Value("${TARGET:World}")
String target; String target;
@RestController @RestController
class HelloworldController { class HelloworldController {
@GetMapping("/") @GetMapping("/")
String hello() { String hello() {
return "Hello " + target + "!"; return "Hello " + target + "!";
} }
} }
public static void main(String[] args) {
SpringApplication.run(HelloworldApplication.class, args);
}
}
```
public static void main(String[] args) {
SpringApplication.run(HelloworldApplication.class, args);
}
}
```
1. Run the application locally: 1. Run the application locally:
```shell ```shell
@ -82,55 +83,55 @@ recreate the source files from this folder.
For additional information on multi-stage docker builds for Java see For additional information on multi-stage docker builds for Java see
[Creating Smaller Java Image using Docker Multi-stage Build](http://blog.arungupta.me/smaller-java-image-docker-multi-stage-build/). [Creating Smaller Java Image using Docker Multi-stage Build](http://blog.arungupta.me/smaller-java-image-docker-multi-stage-build/).
```docker ```docker
# Use the official maven/Java 8 image to create a build artifact. # Use the official maven/Java 8 image to create a build artifact.
# https://hub.docker.com/_/maven # https://hub.docker.com/_/maven
FROM maven:3.5-jdk-8-alpine as builder FROM maven:3.5-jdk-8-alpine as builder
# Copy local code to the container image. # Copy local code to the container image.
WORKDIR /app WORKDIR /app
COPY pom.xml . COPY pom.xml .
COPY src ./src COPY src ./src
# Build a release artifact. # Build a release artifact.
RUN mvn package -DskipTests RUN mvn package -DskipTests
# Use the Official OpenJDK image for a lean production stage of our multi-stage build. # Use the Official OpenJDK image for a lean production stage of our multi-stage build.
# https://hub.docker.com/_/openjdk # https://hub.docker.com/_/openjdk
# https://docs.docker.com/develop/develop-images/multistage-build/#use-multi-stage-builds # https://docs.docker.com/develop/develop-images/multistage-build/#use-multi-stage-builds
FROM openjdk:8-jre-alpine FROM openjdk:8-jre-alpine
# Copy the jar to the production image from the builder stage. # Copy the jar to the production image from the builder stage.
COPY --from=builder /app/target/helloworld-*.jar /helloworld.jar COPY --from=builder /app/target/helloworld-*.jar /helloworld.jar
# Configure and document the service HTTP port. # Configure and document the service HTTP port.
ENV PORT 8080 ENV PORT 8080
EXPOSE $PORT EXPOSE $PORT
# Run the web service on container startup. # Run the web service on container startup.
CMD ["java","-Djava.security.egd=file:/dev/./urandom","-Dserver.port=${PORT}","-jar","/helloworld.jar"] CMD ["java","-Djava.security.egd=file:/dev/./urandom","-Dserver.port=${PORT}","-jar","/helloworld.jar"]
``` ```
1. Create a new file, `service.yaml` and copy the following service definition 1. Create a new file, `service.yaml` and copy the following service definition
into the file. Make sure to replace `{username}` with your Docker Hub username. into the file. Make sure to replace `{username}` with your Docker Hub username.
```yaml ```yaml
apiVersion: serving.knative.dev/v1alpha1 apiVersion: serving.knative.dev/v1alpha1
kind: Service kind: Service
metadata: metadata:
name: helloworld-java name: helloworld-java
namespace: default namespace: default
spec: spec:
runLatest: runLatest:
configuration: configuration:
revisionTemplate: revisionTemplate:
spec: spec:
container: container:
image: docker.io/{username}/helloworld-java image: docker.io/{username}/helloworld-java
env: env:
- name: TARGET - name: TARGET
value: "Spring Boot Sample v1" value: "Spring Boot Sample v1"
``` ```
## Building and deploying the sample ## Building and deploying the sample
@ -141,56 +142,57 @@ folder) you're ready to build and deploy the sample app.
Docker Hub, run these commands replacing `{username}` with your Docker Hub, run these commands replacing `{username}` with your
Docker Hub username: Docker Hub username:
```shell ```shell
# Build the container on your local machine # Build the container on your local machine
docker build -t {username}/helloworld-java . docker build -t {username}/helloworld-java .
# Push the container to docker registry # Push the container to docker registry
docker push {username}/helloworld-java docker push {username}/helloworld-java
``` ```
1. After the build has completed and the container is pushed to docker hub, you 1. After the build has completed and the container is pushed to docker hub, you
can deploy the app into your cluster. Ensure that the container image value can deploy the app into your cluster. Ensure that the container image value
in `service.yaml` matches the container you built in in `service.yaml` matches the container you built in
the previous step. Apply the configuration using `kubectl`: the previous step. Apply the configuration using `kubectl`:
```shell ```shell
kubectl apply --filename service.yaml kubectl apply --filename service.yaml
``` ```
1. Now that your service is created, Knative will perform the following steps: 1. Now that your service is created, Knative will perform the following steps:
* Create a new immutable revision for this version of the app.
* Network programming to create a route, ingress, service, and load balancer for your app. - Create a new immutable revision for this version of the app.
* Automatically scale your pods up and down (including to zero active pods). - Network programming to create a route, ingress, service, and load balancer for your app.
- Automatically scale your pods up and down (including to zero active pods).
1. To find the IP address for your service, use. If your cluster is new, it may take sometime for the service to get asssigned 1. To find the IP address for your service, use. If your cluster is new, it may take sometime for the service to get asssigned
an external IP address. an external IP address.
```shell ```shell
kubectl get svc knative-ingressgateway --namespace istio-system kubectl get svc knative-ingressgateway --namespace istio-system
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
knative-ingressgateway LoadBalancer 10.23.247.74 35.203.155.229 80:32380/TCP,443:32390/TCP,32400:32400/TCP 2d knative-ingressgateway LoadBalancer 10.23.247.74 35.203.155.229 80:32380/TCP,443:32390/TCP,32400:32400/TCP 2d
``` ```
1. To find the URL for your service, use 1. To find the URL for your service, use
```shell ```shell
kubectl get ksvc helloworld-java \ kubectl get ksvc helloworld-java \
--output=custom-columns=NAME:.metadata.name,DOMAIN:.status.domain --output=custom-columns=NAME:.metadata.name,DOMAIN:.status.domain
NAME DOMAIN NAME DOMAIN
helloworld-java helloworld-java.default.example.com helloworld-java helloworld-java.default.example.com
``` ```
1. Now you can make a request to your app to see the result. Replace 1. Now you can make a request to your app to see the result. Replace
`{IP_ADDRESS}` with the address you see returned in the previous step. `{IP_ADDRESS}` with the address you see returned in the previous step.
```shell ```shell
curl -H "Host: helloworld-java.default.example.com" http://{IP_ADDRESS} curl -H "Host: helloworld-java.default.example.com" http://{IP_ADDRESS}
Hello World: Spring Boot Sample v1 Hello World: Spring Boot Sample v1
``` ```
## Removing the sample app deployment ## Removing the sample app deployment

View File

@ -1,15 +1,15 @@
# Hello World - Kotlin sample # Hello World - Kotlin sample
A simple web app written in Kotlin using [Ktor](https://ktor.io/) that you can use for testing. A simple web app written in Kotlin using [Ktor](https://ktor.io/) that you can use for testing.
It reads in an env variable `TARGET` and prints "Hello ${TARGET}". If It reads in an env variable `TARGET` and prints "Hello \${TARGET}". If
TARGET is not specified, it will use "World" as the TARGET. TARGET is not specified, it will use "World" as the TARGET.
## Prerequisites ## Prerequisites
* A Kubernetes cluster with Knative installed. Follow the - A Kubernetes cluster with Knative installed. Follow the
[installation instructions](https://github.com/knative/docs/blob/master/install/README.md) if you need [installation instructions](https://github.com/knative/docs/blob/master/install/README.md) if you need
to create one. to create one.
* [Docker](https://www.docker.com) installed and running on your local machine, - [Docker](https://www.docker.com) installed and running on your local machine,
and a Docker Hub account configured (we'll use it for a container registry). and a Docker Hub account configured (we'll use it for a container registry).
## Steps to recreate the sample code ## Steps to recreate the sample code
@ -20,38 +20,40 @@ The following instructions recreate the source files from this folder.
1. Create a new directory and cd into it: 1. Create a new directory and cd into it:
```shell ```shell
mkdir hello mkdir hello
cd hello cd hello
``` ```
2. Create a file named `Main.kt` at `src/main/kotlin/com/example/hello` and copy the code block below into it: 2. Create a file named `Main.kt` at `src/main/kotlin/com/example/hello` and copy the code block below into it:
```shell ```shell
mkdir -p src/main/kotlin/com/example/hello mkdir -p src/main/kotlin/com/example/hello
``` ```
```kotlin
package com.example.hello
import io.ktor.application.* ```kotlin
import io.ktor.http.* package com.example.hello
import io.ktor.response.*
import io.ktor.routing.* import io.ktor.application.*
import io.ktor.server.engine.* import io.ktor.http.*
import io.ktor.server.netty.* import io.ktor.response.*
import io.ktor.routing.*
import io.ktor.server.engine.*
import io.ktor.server.netty.*
fun main(args: Array<String>) {
val target = System.getenv("TARGET") ?: "World"
val port = System.getenv("PORT") ?: "8080"
embeddedServer(Netty, port.toInt()) {
routing {
get("/") {
call.respondText("Hello $target", ContentType.Text.Html)
}
}
}.start(wait = true)
}
```
fun main(args: Array<String>) {
val target = System.getenv("TARGET") ?: "World"
val port = System.getenv("PORT") ?: "8080"
embeddedServer(Netty, port.toInt()) {
routing {
get("/") {
call.respondText("Hello $target", ContentType.Text.Html)
}
}
}.start(wait = true)
}
```
3. Switch back to `hello` directory 3. Switch back to `hello` directory
4. Create a new file, `build.gradle` and copy the following setting 4. Create a new file, `build.gradle` and copy the following setting
@ -77,7 +79,7 @@ The following instructions recreate the source files from this folder.
compileKotlin { compileKotlin {
kotlinOptions.jvmTarget = "1.8" kotlinOptions.jvmTarget = "1.8"
} }
compileTestKotlin { compileTestKotlin {
kotlinOptions.jvmTarget = "1.8" kotlinOptions.jvmTarget = "1.8"
} }
@ -105,54 +107,54 @@ The following instructions recreate the source files from this folder.
5. Create a file named `Dockerfile` and copy the code block below into it. 5. Create a file named `Dockerfile` and copy the code block below into it.
```docker ```docker
# Use the official gradle image to create a build artifact. # Use the official gradle image to create a build artifact.
# https://hub.docker.com/_/gradle # https://hub.docker.com/_/gradle
FROM gradle as builder FROM gradle as builder
# Copy local code to the container image. # Copy local code to the container image.
COPY build.gradle . COPY build.gradle .
COPY src ./src COPY src ./src
# Build a release artifact. # Build a release artifact.
RUN gradle clean build --no-daemon RUN gradle clean build --no-daemon
# Use the Official OpenJDK image for a lean production stage of our multi-stage build. # Use the Official OpenJDK image for a lean production stage of our multi-stage build.
# https://hub.docker.com/_/openjdk # https://hub.docker.com/_/openjdk
# https://docs.docker.com/develop/develop-images/multistage-build/#use-multi-stage-builds # https://docs.docker.com/develop/develop-images/multistage-build/#use-multi-stage-builds
FROM openjdk:8-jre-alpine FROM openjdk:8-jre-alpine
# Copy the jar to the production image from the builder stage. # Copy the jar to the production image from the builder stage.
COPY --from=builder /home/gradle/build/libs/gradle.jar /helloworld.jar COPY --from=builder /home/gradle/build/libs/gradle.jar /helloworld.jar
# Configure and document the service HTTP port. # Configure and document the service HTTP port.
ENV PORT 8080 ENV PORT 8080
EXPOSE $PORT EXPOSE $PORT
# Run the web service on container startup. # Run the web service on container startup.
CMD [ "java", "-jar", "-Djava.security.egd=file:/dev/./urandom", "/helloworld.jar" ] CMD [ "java", "-jar", "-Djava.security.egd=file:/dev/./urandom", "/helloworld.jar" ]
``` ```
6. Create a new file, `service.yaml` and copy the following service definition 6. Create a new file, `service.yaml` and copy the following service definition
into the file. Make sure to replace `{username}` with your Docker Hub username. into the file. Make sure to replace `{username}` with your Docker Hub username.
```yaml ```yaml
apiVersion: serving.knative.dev/v1alpha1 apiVersion: serving.knative.dev/v1alpha1
kind: Service kind: Service
metadata: metadata:
name: helloworld-kotlin name: helloworld-kotlin
namespace: default namespace: default
spec: spec:
runLatest: runLatest:
configuration: configuration:
revisionTemplate: revisionTemplate:
spec: spec:
container: container:
image: docker.io/{username}/helloworld-kotlin image: docker.io/{username}/helloworld-kotlin
env: env:
- name: TARGET - name: TARGET
value: "Kotlin Sample v1" value: "Kotlin Sample v1"
``` ```
## Build and deploy this sample ## Build and deploy this sample
@ -163,59 +165,64 @@ folder) you're ready to build and deploy the sample app.
Docker Hub, run these commands replacing `{username}` with your Docker Hub, run these commands replacing `{username}` with your
Docker Hub username: Docker Hub username:
```shell ```shell
# Build the container on your local machine # Build the container on your local machine
docker build -t {username}/helloworld-kotlin . docker build -t {username}/helloworld-kotlin .
# Push the container to docker registry # Push the container to docker registry
docker push {username}/helloworld-kotlin docker push {username}/helloworld-kotlin
``` ```
2. After the build has completed and the container is pushed to docker hub, you 2. After the build has completed and the container is pushed to docker hub, you
can deploy the app into your cluster. Ensure that the container image value can deploy the app into your cluster. Ensure that the container image value
in `service.yaml` matches the container you built in in `service.yaml` matches the container you built in
the previous step. Apply the configuration using `kubectl`: the previous step. Apply the configuration using `kubectl`:
```shell ```shell
kubectl apply --filename service.yaml kubectl apply --filename service.yaml
``` ```
3. Now that your service is created, Knative will perform the following steps: 3. Now that your service is created, Knative will perform the following steps:
* Create a new immutable revision for this version of the app.
* Network programming to create a route, ingress, service, and load balance for your app. - Create a new immutable revision for this version of the app.
* Automatically scale your pods up and down (including to zero active pods). - Network programming to create a route, ingress, service, and load balance for your app.
- Automatically scale your pods up and down (including to zero active pods).
4. To find the IP address for your service, use 4. To find the IP address for your service, use
`kubectl get service knative-ingressgateway --namespace istio-system` to get the ingress IP for your `kubectl get service knative-ingressgateway --namespace istio-system` to get the ingress IP for your
cluster. If your cluster is new, it may take sometime for the service to get assigned cluster. If your cluster is new, it may take sometime for the service to get assigned
an external IP address. an external IP address.
```shell ```shell
kubectl get service knative-ingressgateway --namespace istio-system kubectl get service knative-ingressgateway --namespace istio-system
``` ```
```shell
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE ```shell
knative-ingressgateway LoadBalancer 10.23.247.74 35.203.155.229 80:32380/TCP,443:32390/TCP,32400:32400/TCP 2d NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
``` knative-ingressgateway LoadBalancer 10.23.247.74 35.203.155.229 80:32380/TCP,443:32390/TCP,32400:32400/TCP 2d
```
5. To find the URL for your service, use 5. To find the URL for your service, use
```shell
kubectl get ksvc helloworld-kotlin --output=custom-columns=NAME:.metadata.name,DOMAIN:.status.domain ```shell
``` kubectl get ksvc helloworld-kotlin --output=custom-columns=NAME:.metadata.name,DOMAIN:.status.domain
```shell ```
NAME DOMAIN
helloworld-kotlin helloworld-kotlin.default.example.com ```shell
``` NAME DOMAIN
helloworld-kotlin helloworld-kotlin.default.example.com
```
6. Now you can make a request to your app to see the result. Replace `{IP_ADDRESS}` 6. Now you can make a request to your app to see the result. Replace `{IP_ADDRESS}`
with the address you see returned in the previous step. with the address you see returned in the previous step.
```shell ```shell
curl -H "Host: helloworld-kotlin.default.example.com" http://{IP_ADDRESS} curl -H "Host: helloworld-kotlin.default.example.com" http://{IP_ADDRESS}
``` ```
```shell
Hello Kotlin Sample v1 ```shell
``` Hello Kotlin Sample v1
```
## Remove the sample app deployment ## Remove the sample app deployment

View File

@ -1,17 +1,17 @@
# Hello World - Node.js sample # Hello World - Node.js sample
A simple web app written in Node.js that you can use for testing. A simple web app written in Node.js that you can use for testing.
It reads in an env variable `TARGET` and prints "Hello ${TARGET}!". If It reads in an env variable `TARGET` and prints "Hello \${TARGET}!". If
TARGET is not specified, it will use "World" as the TARGET. TARGET is not specified, it will use "World" as the TARGET.
## Prerequisites ## Prerequisites
* A Kubernetes cluster with Knative installed. Follow the - A Kubernetes cluster with Knative installed. Follow the
[installation instructions](https://github.com/knative/docs/blob/master/install/README.md) if you need [installation instructions](https://github.com/knative/docs/blob/master/install/README.md) if you need
to create one. to create one.
* [Docker](https://www.docker.com) installed and running on your local machine, - [Docker](https://www.docker.com) installed and running on your local machine,
and a Docker Hub account configured (we'll use it for a container registry). and a Docker Hub account configured (we'll use it for a container registry).
* [Node.js](https://nodejs.org/en/) installed and configured. - [Node.js](https://nodejs.org/en/) installed and configured.
## Recreating the sample code ## Recreating the sample code
@ -23,112 +23,112 @@ recreate the source files from this folder.
but change the entry point to `app.js` to be consistent with the sample but change the entry point to `app.js` to be consistent with the sample
code here. code here.
```shell ```shell
npm init npm init
package name: (helloworld-nodejs) package name: (helloworld-nodejs)
version: (1.0.0) version: (1.0.0)
description: description:
entry point: (index.js) app.js entry point: (index.js) app.js
test command: test command:
git repository: git repository:
keywords: keywords:
author: author:
license: (ISC) Apache-2.0 license: (ISC) Apache-2.0
``` ```
1. Install the `express` package: 1. Install the `express` package:
```shell ```shell
npm install express --save npm install express --save
``` ```
1. Create a new file named `app.js` and paste the following code: 1. Create a new file named `app.js` and paste the following code:
```js ```js
const express = require('express'); const express = require("express");
const app = express(); const app = express();
app.get('/', function (req, res) { app.get("/", function(req, res) {
console.log('Hello world received a request.'); console.log("Hello world received a request.");
const target = process.env.TARGET || 'World'; const target = process.env.TARGET || "World";
res.send('Hello ' + target + '!'); res.send("Hello " + target + "!");
}); });
const port = process.env.PORT || 8080; const port = process.env.PORT || 8080;
app.listen(port, function () { app.listen(port, function() {
console.log('Hello world listening on port', port); console.log("Hello world listening on port", port);
}); });
``` ```
1. Modify the `package.json` file to add a start command to the scripts section: 1. Modify the `package.json` file to add a start command to the scripts section:
```json ```json
{ {
"name": "knative-serving-helloworld", "name": "knative-serving-helloworld",
"version": "1.0.0", "version": "1.0.0",
"description": "", "description": "",
"main": "app.js", "main": "app.js",
"scripts": { "scripts": {
"start": "node app.js" "start": "node app.js"
}, },
"author": "", "author": "",
"license": "Apache-2.0" "license": "Apache-2.0"
} }
``` ```
1. In your project directory, create a file named `Dockerfile` and copy the code 1. In your project directory, create a file named `Dockerfile` and copy the code
block below into it. For detailed instructions on dockerizing a Node.js app, block below into it. For detailed instructions on dockerizing a Node.js app,
see [Dockerizing a Node.js web app](https://nodejs.org/en/docs/guides/nodejs-docker-webapp/). see [Dockerizing a Node.js web app](https://nodejs.org/en/docs/guides/nodejs-docker-webapp/).
```Dockerfile ```Dockerfile
# Use the official Node 8 image. # Use the official Node 8 image.
# https://hub.docker.com/_/node # https://hub.docker.com/_/node
FROM node:8 FROM node:8
# Create and change to the app directory. # Create and change to the app directory.
WORKDIR /usr/src/app WORKDIR /usr/src/app
# Copy application dependency manifests to the container image. # Copy application dependency manifests to the container image.
# A wildcard is used to ensure both package.json AND package-lock.json are copied. # A wildcard is used to ensure both package.json AND package-lock.json are copied.
# Copying this separately prevents re-running npm install on every code change. # Copying this separately prevents re-running npm install on every code change.
COPY package*.json ./ COPY package*.json ./
# Install production dependencies. # Install production dependencies.
RUN npm install --only=production RUN npm install --only=production
# Copy local code to the container image. # Copy local code to the container image.
COPY . . COPY . .
# Configure and document the service HTTP port. # Configure and document the service HTTP port.
ENV PORT 8080 ENV PORT 8080
EXPOSE $PORT EXPOSE $PORT
# Run the web service on container startup. # Run the web service on container startup.
CMD [ "npm", "start" ] CMD [ "npm", "start" ]
``` ```
1. Create a new file, `service.yaml` and copy the following service definition 1. Create a new file, `service.yaml` and copy the following service definition
into the file. Make sure to replace `{username}` with your Docker Hub username. into the file. Make sure to replace `{username}` with your Docker Hub username.
```yaml ```yaml
apiVersion: serving.knative.dev/v1alpha1 apiVersion: serving.knative.dev/v1alpha1
kind: Service kind: Service
metadata: metadata:
name: helloworld-nodejs name: helloworld-nodejs
namespace: default namespace: default
spec: spec:
runLatest: runLatest:
configuration: configuration:
revisionTemplate: revisionTemplate:
spec: spec:
container: container:
image: docker.io/{username}/helloworld-nodejs image: docker.io/{username}/helloworld-nodejs
env: env:
- name: TARGET - name: TARGET
value: "Node.js Sample v1" value: "Node.js Sample v1"
``` ```
## Building and deploying the sample ## Building and deploying the sample
@ -139,55 +139,57 @@ folder) you're ready to build and deploy the sample app.
Docker Hub, run these commands replacing `{username}` with your Docker Hub, run these commands replacing `{username}` with your
Docker Hub username: Docker Hub username:
```shell ```shell
# Build the container on your local machine # Build the container on your local machine
docker build -t {username}/helloworld-nodejs . docker build -t {username}/helloworld-nodejs .
# Push the container to docker registry # Push the container to docker registry
docker push {username}/helloworld-nodejs docker push {username}/helloworld-nodejs
``` ```
1. After the build has completed and the container is pushed to docker hub, you 1. After the build has completed and the container is pushed to docker hub, you
can deploy the app into your cluster. Ensure that the container image value can deploy the app into your cluster. Ensure that the container image value
in `service.yaml` matches the container you built in in `service.yaml` matches the container you built in
the previous step. Apply the configuration using `kubectl`: the previous step. Apply the configuration using `kubectl`:
```shell ```shell
kubectl apply --filename service.yaml kubectl apply --filename service.yaml
``` ```
1. Now that your service is created, Knative will perform the following steps: 1. Now that your service is created, Knative will perform the following steps:
* Create a new immutable revision for this version of the app.
* Network programming to create a route, ingress, service, and load balance for your app. - Create a new immutable revision for this version of the app.
* Automatically scale your pods up and down (including to zero active pods). - Network programming to create a route, ingress, service, and load balance for your app.
- Automatically scale your pods up and down (including to zero active pods).
1. To find the IP address for your service, use 1. To find the IP address for your service, use
`kubectl get svc knative-ingressgateway --namespace istio-system` to get the ingress IP for your `kubectl get svc knative-ingressgateway --namespace istio-system` to get the ingress IP for your
cluster. If your cluster is new, it may take sometime for the service to get asssigned cluster. If your cluster is new, it may take sometime for the service to get asssigned
an external IP address. an external IP address.
```shell ```shell
kubectl get svc knative-ingressgateway --namespace istio-system kubectl get svc knative-ingressgateway --namespace istio-system
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
knative-ingressgateway LoadBalancer 10.23.247.74 35.203.155.229 80:32380/TCP,443:32390/TCP,32400:32400/TCP 2d knative-ingressgateway LoadBalancer 10.23.247.74 35.203.155.229 80:32380/TCP,443:32390/TCP,32400:32400/TCP 2d
``` ```
1. To find the URL for your service, use 1. To find the URL for your service, use
```
kubectl get ksvc helloworld-nodejs --output=custom-columns=NAME:.metadata.name,DOMAIN:.status.domain ```
NAME DOMAIN kubectl get ksvc helloworld-nodejs --output=custom-columns=NAME:.metadata.name,DOMAIN:.status.domain
helloworld-nodejs helloworld-nodejs.default.example.com NAME DOMAIN
``` helloworld-nodejs helloworld-nodejs.default.example.com
```
1. Now you can make a request to your app to see the result. Replace 1. Now you can make a request to your app to see the result. Replace
`{IP_ADDRESS}` with the address you see returned in the previous step. `{IP_ADDRESS}` with the address you see returned in the previous step.
```shell ```shell
curl -H "Host: helloworld-nodejs.default.example.com" http://{IP_ADDRESS} curl -H "Host: helloworld-nodejs.default.example.com" http://{IP_ADDRESS}
Hello Node.js Sample v1! Hello Node.js Sample v1!
``` ```
## Removing the sample app deployment ## Removing the sample app deployment

View File

@ -1,15 +1,15 @@
# Hello World - PHP sample # Hello World - PHP sample
A simple web app written in PHP that you can use for testing. A simple web app written in PHP that you can use for testing.
It reads in an env variable `TARGET` and prints "Hello ${TARGET}!". If It reads in an env variable `TARGET` and prints "Hello \${TARGET}!". If
TARGET is not specified, it will use "World" as the TARGET. TARGET is not specified, it will use "World" as the TARGET.
## Prerequisites ## Prerequisites
* A Kubernetes cluster with Knative installed. Follow the - A Kubernetes cluster with Knative installed. Follow the
[installation instructions](https://github.com/knative/docs/blob/master/install/README.md) if you need [installation instructions](https://github.com/knative/docs/blob/master/install/README.md) if you need
to create one. to create one.
* [Docker](https://www.docker.com) installed and running on your local machine, - [Docker](https://www.docker.com) installed and running on your local machine,
and a Docker Hub account configured (we'll use it for a container registry). and a Docker Hub account configured (we'll use it for a container registry).
## Recreating the sample code ## Recreating the sample code
@ -20,58 +20,58 @@ following instructions recreate the source files from this folder.
1. Create a new directory and cd into it: 1. Create a new directory and cd into it:
````shell ```shell
mkdir app mkdir app
cd app cd app
```` ```
1. Create a file named `index.php` and copy the code block below into it: 1. Create a file named `index.php` and copy the code block below into it:
```php ```php
<?php <?php
$target = getenv('TARGET', true) ?: "World"; $target = getenv('TARGET', true) ?: "World";
echo sprintf("Hello %s!\n", $target); echo sprintf("Hello %s!\n", $target);
``` ```
1. Create a file named `Dockerfile` and copy the code block below into it. 1. Create a file named `Dockerfile` and copy the code block below into it.
See [official PHP docker image](https://hub.docker.com/_/php/) for more details. See [official PHP docker image](https://hub.docker.com/_/php/) for more details.
```docker ```docker
# Use the official PHP 7.2 image. # Use the official PHP 7.2 image.
# https://hub.docker.com/_/php # https://hub.docker.com/_/php
FROM php:7.2.6-apache FROM php:7.2.6-apache
# Copy local code to the container image. # Copy local code to the container image.
COPY index.php /var/www/html/ COPY index.php /var/www/html/
# Use the PORT environment variable in Apache configuration files. # Use the PORT environment variable in Apache configuration files.
RUN sed -i 's/80/${PORT}/g' /etc/apache2/sites-available/000-default.conf /etc/apache2/ports.conf RUN sed -i 's/80/${PORT}/g' /etc/apache2/sites-available/000-default.conf /etc/apache2/ports.conf
# Configure and document the service HTTP port. # Configure and document the service HTTP port.
ENV PORT 8080 ENV PORT 8080
EXPOSE $PORT EXPOSE $PORT
``` ```
1. Create a new file, `service.yaml` and copy the following service definition 1. Create a new file, `service.yaml` and copy the following service definition
into the file. Make sure to replace `{username}` with your Docker Hub username. into the file. Make sure to replace `{username}` with your Docker Hub username.
```yaml ```yaml
apiVersion: serving.knative.dev/v1alpha1 apiVersion: serving.knative.dev/v1alpha1
kind: Service kind: Service
metadata: metadata:
name: helloworld-php name: helloworld-php
namespace: default namespace: default
spec: spec:
runLatest: runLatest:
configuration: configuration:
revisionTemplate: revisionTemplate:
spec: spec:
container: container:
image: docker.io/{username}/helloworld-php image: docker.io/{username}/helloworld-php
env: env:
- name: TARGET - name: TARGET
value: "PHP Sample v1" value: "PHP Sample v1"
``` ```
## Building and deploying the sample ## Building and deploying the sample
@ -82,55 +82,57 @@ you're ready to build and deploy the sample app.
Docker Hub, run these commands replacing `{username}` with your Docker Hub, run these commands replacing `{username}` with your
Docker Hub username: Docker Hub username:
```shell ```shell
# Build the container on your local machine # Build the container on your local machine
docker build -t {username}/helloworld-php . docker build -t {username}/helloworld-php .
# Push the container to docker registry # Push the container to docker registry
docker push {username}/helloworld-php docker push {username}/helloworld-php
``` ```
1. After the build has completed and the container is pushed to docker hub, you 1. After the build has completed and the container is pushed to docker hub, you
can deploy the app into your cluster. Ensure that the container image value can deploy the app into your cluster. Ensure that the container image value
in `service.yaml` matches the container you built in in `service.yaml` matches the container you built in
the previous step. Apply the configuration using `kubectl`: the previous step. Apply the configuration using `kubectl`:
```shell ```shell
kubectl apply --filename service.yaml kubectl apply --filename service.yaml
``` ```
1. Now that your service is created, Knative will perform the following steps: 1. Now that your service is created, Knative will perform the following steps:
* Create a new immutable revision for this version of the app.
* Network programming to create a route, ingress, service, and load balance for your app. - Create a new immutable revision for this version of the app.
* Automatically scale your pods up and down (including to zero active pods). - Network programming to create a route, ingress, service, and load balance for your app.
- Automatically scale your pods up and down (including to zero active pods).
1. To find the IP address for your service, use 1. To find the IP address for your service, use
`kubectl get svc knative-ingressgateway --namespace istio-system` to get the ingress IP for your `kubectl get svc knative-ingressgateway --namespace istio-system` to get the ingress IP for your
cluster. If your cluster is new, it may take sometime for the service to get asssigned cluster. If your cluster is new, it may take sometime for the service to get asssigned
an external IP address. an external IP address.
```shell ```shell
kubectl get svc knative-ingressgateway --namespace istio-system kubectl get svc knative-ingressgateway --namespace istio-system
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
knative-ingressgateway LoadBalancer 10.23.247.74 35.203.155.229 80:32380/TCP,443:32390/TCP,32400:32400/TCP 2d knative-ingressgateway LoadBalancer 10.23.247.74 35.203.155.229 80:32380/TCP,443:32390/TCP,32400:32400/TCP 2d
``` ```
1. To find the URL for your service, use 1. To find the URL for your service, use
```
kubectl get ksvc helloworld-php --output=custom-columns=NAME:.metadata.name,DOMAIN:.status.domain ```
NAME DOMAIN kubectl get ksvc helloworld-php --output=custom-columns=NAME:.metadata.name,DOMAIN:.status.domain
helloworld-php helloworld-php.default.example.com NAME DOMAIN
``` helloworld-php helloworld-php.default.example.com
```
1. Now you can make a request to your app to see the result. Replace 1. Now you can make a request to your app to see the result. Replace
`{IP_ADDRESS}` with the address you see returned in the previous step. `{IP_ADDRESS}` with the address you see returned in the previous step.
```shell ```shell
curl -H "Host: helloworld-php.default.example.com" http://{IP_ADDRESS} curl -H "Host: helloworld-php.default.example.com" http://{IP_ADDRESS}
Hello World: PHP Sample v1! Hello World: PHP Sample v1!
``` ```
## Removing the sample app deployment ## Removing the sample app deployment

View File

@ -1,15 +1,15 @@
# Hello World - Python sample # Hello World - Python sample
A simple web app written in Python that you can use for testing. A simple web app written in Python that you can use for testing.
It reads in an env variable `TARGET` and prints "Hello ${TARGET}!". If It reads in an env variable `TARGET` and prints "Hello \${TARGET}!". If
TARGET is not specified, it will use "World" as the TARGET. TARGET is not specified, it will use "World" as the TARGET.
## Prerequisites ## Prerequisites
* A Kubernetes cluster with Knative installed. Follow the - A Kubernetes cluster with Knative installed. Follow the
[installation instructions](https://github.com/knative/docs/blob/master/install/README.md) if you need [installation instructions](https://github.com/knative/docs/blob/master/install/README.md) if you need
to create one. to create one.
* [Docker](https://www.docker.com) installed and running on your local machine, - [Docker](https://www.docker.com) installed and running on your local machine,
and a Docker Hub account configured (we'll use it for a container registry). and a Docker Hub account configured (we'll use it for a container registry).
## Steps to recreate the sample code ## Steps to recreate the sample code
@ -20,72 +20,73 @@ The following instructions recreate the source files from this folder.
1. Create a new directory and cd into it: 1. Create a new directory and cd into it:
````shell ```shell
mkdir app mkdir app
cd app cd app
```` ```
1. Create a file named `app.py` and copy the code block below into it: 1. Create a file named `app.py` and copy the code block below into it:
```python ```python
import os import os
from flask import Flask from flask import Flask
app = Flask(__name__) app = Flask(__name__)
@app.route('/') @app.route('/')
def hello_world(): def hello_world():
target = os.environ.get('TARGET', 'World') target = os.environ.get('TARGET', 'World')
return 'Hello {}!\n'.format(target) return 'Hello {}!\n'.format(target)
if __name__ == "__main__": if __name__ == "__main__":
app.run(debug=True,host='0.0.0.0',port=int(os.environ.get('PORT', 8080))) app.run(debug=True,host='0.0.0.0',port=int(os.environ.get('PORT', 8080)))
``` ```
1. Create a file named `Dockerfile` and copy the code block below into it. 1. Create a file named `Dockerfile` and copy the code block below into it.
See [official Python docker image](https://hub.docker.com/_/python/) for more details. See [official Python docker image](https://hub.docker.com/_/python/) for more details.
```docker ```docker
# Use the official Python image. # Use the official Python image.
# https://hub.docker.com/_/python # https://hub.docker.com/_/python
FROM python FROM python
# Copy local code to the container image. # Copy local code to the container image.
ENV APP_HOME /app ENV APP_HOME /app
WORKDIR $APP_HOME WORKDIR $APP_HOME
COPY . . COPY . .
# Install production dependencies. # Install production dependencies.
RUN pip install Flask RUN pip install Flask
# Configure and document the service HTTP port. # Configure and document the service HTTP port.
ENV PORT 8080 ENV PORT 8080
EXPOSE $PORT EXPOSE $PORT
# Run the web service on container startup. # Run the web service on container startup.
CMD ["python", "app.py"] CMD ["python", "app.py"]
``` ```
1. Create a new file, `service.yaml` and copy the following service definition 1. Create a new file, `service.yaml` and copy the following service definition
into the file. Make sure to replace `{username}` with your Docker Hub username. into the file. Make sure to replace `{username}` with your Docker Hub username.
```yaml ```yaml
apiVersion: serving.knative.dev/v1alpha1 apiVersion: serving.knative.dev/v1alpha1
kind: Service kind: Service
metadata: metadata:
name: helloworld-python name: helloworld-python
namespace: default namespace: default
spec: spec:
runLatest: runLatest:
configuration: configuration:
revisionTemplate: revisionTemplate:
spec: spec:
container: container:
image: docker.io/{username}/helloworld-python image: docker.io/{username}/helloworld-python
env: env:
- name: TARGET - name: TARGET
value: "Python Sample v1" value: "Python Sample v1"
``` ```
## Build and deploy this sample ## Build and deploy this sample
@ -96,55 +97,57 @@ folder) you're ready to build and deploy the sample app.
Docker Hub, run these commands replacing `{username}` with your Docker Hub, run these commands replacing `{username}` with your
Docker Hub username: Docker Hub username:
```shell ```shell
# Build the container on your local machine # Build the container on your local machine
docker build -t {username}/helloworld-python . docker build -t {username}/helloworld-python .
# Push the container to docker registry # Push the container to docker registry
docker push {username}/helloworld-python docker push {username}/helloworld-python
``` ```
1. After the build has completed and the container is pushed to docker hub, you 1. After the build has completed and the container is pushed to docker hub, you
can deploy the app into your cluster. Ensure that the container image value can deploy the app into your cluster. Ensure that the container image value
in `service.yaml` matches the container you built in in `service.yaml` matches the container you built in
the previous step. Apply the configuration using `kubectl`: the previous step. Apply the configuration using `kubectl`:
```shell ```shell
kubectl apply --filename service.yaml kubectl apply --filename service.yaml
``` ```
1. Now that your service is created, Knative will perform the following steps: 1. Now that your service is created, Knative will perform the following steps:
* Create a new immutable revision for this version of the app.
* Network programming to create a route, ingress, service, and load balance for your app. - Create a new immutable revision for this version of the app.
* Automatically scale your pods up and down (including to zero active pods). - Network programming to create a route, ingress, service, and load balance for your app.
- Automatically scale your pods up and down (including to zero active pods).
1. To find the IP address for your service, use 1. To find the IP address for your service, use
`kubectl get svc knative-ingressgateway --namespace istio-system` to get the ingress IP for your `kubectl get svc knative-ingressgateway --namespace istio-system` to get the ingress IP for your
cluster. If your cluster is new, it may take sometime for the service to get asssigned cluster. If your cluster is new, it may take sometime for the service to get asssigned
an external IP address. an external IP address.
```shell ```shell
kubectl get svc knative-ingressgateway --namespace istio-system kubectl get svc knative-ingressgateway --namespace istio-system
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
knative-ingressgateway LoadBalancer 10.23.247.74 35.203.155.229 80:32380/TCP,443:32390/TCP,32400:32400/TCP 2d knative-ingressgateway LoadBalancer 10.23.247.74 35.203.155.229 80:32380/TCP,443:32390/TCP,32400:32400/TCP 2d
``` ```
1. To find the URL for your service, use 1. To find the URL for your service, use
```
kubectl get ksvc helloworld-python --output=custom-columns=NAME:.metadata.name,DOMAIN:.status.domain ```
NAME DOMAIN kubectl get ksvc helloworld-python --output=custom-columns=NAME:.metadata.name,DOMAIN:.status.domain
helloworld-python helloworld-python.default.example.com NAME DOMAIN
``` helloworld-python helloworld-python.default.example.com
```
1. Now you can make a request to your app to see the result. Replace `{IP_ADDRESS}` 1. Now you can make a request to your app to see the result. Replace `{IP_ADDRESS}`
with the address you see returned in the previous step. with the address you see returned in the previous step.
```shell ```shell
curl -H "Host: helloworld-python.default.example.com" http://{IP_ADDRESS} curl -H "Host: helloworld-python.default.example.com" http://{IP_ADDRESS}
Hello World: Python Sample v1! Hello World: Python Sample v1!
``` ```
## Remove the sample app deployment ## Remove the sample app deployment

View File

@ -1,15 +1,15 @@
# Hello World - Ruby sample # Hello World - Ruby sample
A simple web app written in Ruby that you can use for testing. A simple web app written in Ruby that you can use for testing.
It reads in an env variable `TARGET` and prints "Hello ${TARGET}!". If It reads in an env variable `TARGET` and prints "Hello \${TARGET}!". If
TARGET is not specified, it will use "World" as the TARGET. TARGET is not specified, it will use "World" as the TARGET.
## Prerequisites ## Prerequisites
* A Kubernetes cluster with Knative installed. Follow the - A Kubernetes cluster with Knative installed. Follow the
[installation instructions](https://github.com/knative/docs/blob/master/install/README.md) if you need [installation instructions](https://github.com/knative/docs/blob/master/install/README.md) if you need
to create one. to create one.
* [Docker](https://www.docker.com) installed and running on your local machine, - [Docker](https://www.docker.com) installed and running on your local machine,
and a Docker Hub account configured (we'll use it for a container registry). and a Docker Hub account configured (we'll use it for a container registry).
## Steps to recreate the sample code ## Steps to recreate the sample code
@ -20,84 +20,84 @@ The following instructions recreate the source files from this folder.
1. Create a new directory and cd into it: 1. Create a new directory and cd into it:
````shell ```shell
mkdir app mkdir app
cd app cd app
```` ```
1. Create a file named `app.rb` and copy the code block below into it: 1. Create a file named `app.rb` and copy the code block below into it:
```ruby ```ruby
require 'sinatra' require 'sinatra'
set :bind, '0.0.0.0' set :bind, '0.0.0.0'
get '/' do get '/' do
target = ENV['TARGET'] || 'World' target = ENV['TARGET'] || 'World'
"Hello #{target}!\n" "Hello #{target}!\n"
end end
``` ```
1. Create a file named `Dockerfile` and copy the code block below into it. 1. Create a file named `Dockerfile` and copy the code block below into it.
See [official Ruby docker image](https://hub.docker.com/_/ruby/) for more details. See [official Ruby docker image](https://hub.docker.com/_/ruby/) for more details.
```docker ```docker
# Use the official Ruby image. # Use the official Ruby image.
# https://hub.docker.com/_/ruby # https://hub.docker.com/_/ruby
FROM ruby:2.5 FROM ruby:2.5
# Install production dependencies. # Install production dependencies.
WORKDIR /usr/src/app WORKDIR /usr/src/app
COPY Gemfile Gemfile.lock ./ COPY Gemfile Gemfile.lock ./
ENV BUNDLE_FROZEN=true ENV BUNDLE_FROZEN=true
RUN bundle install RUN bundle install
# Copy local code to the container image. # Copy local code to the container image.
COPY . . COPY . .
# Configure and document the service HTTP port. # Configure and document the service HTTP port.
ENV PORT 8080 ENV PORT 8080
EXPOSE $PORT EXPOSE $PORT
# Run the web service on container startup. # Run the web service on container startup.
CMD ["ruby", "./app.rb"] CMD ["ruby", "./app.rb"]
``` ```
1. Create a file named `Gemfile` and copy the text block below into it. 1. Create a file named `Gemfile` and copy the text block below into it.
```gem ```gem
source 'https://rubygems.org' source 'https://rubygems.org'
gem 'sinatra' gem 'sinatra'
``` ```
1. Run bundle. If you don't have bundler installed, copy the 1. Run bundle. If you don't have bundler installed, copy the
[Gemfile.lock](./Gemfile.lock) to your working directory. [Gemfile.lock](./Gemfile.lock) to your working directory.
```shell ```shell
bundle install bundle install
``` ```
1. Create a new file, `service.yaml` and copy the following service definition 1. Create a new file, `service.yaml` and copy the following service definition
into the file. Make sure to replace `{username}` with your Docker Hub username. into the file. Make sure to replace `{username}` with your Docker Hub username.
```yaml ```yaml
apiVersion: serving.knative.dev/v1alpha1 apiVersion: serving.knative.dev/v1alpha1
kind: Service kind: Service
metadata: metadata:
name: helloworld-ruby name: helloworld-ruby
namespace: default namespace: default
spec: spec:
runLatest: runLatest:
configuration: configuration:
revisionTemplate: revisionTemplate:
spec: spec:
container: container:
image: docker.io/{username}/helloworld-ruby image: docker.io/{username}/helloworld-ruby
env: env:
- name: TARGET - name: TARGET
value: "Ruby Sample v1" value: "Ruby Sample v1"
``` ```
## Build and deploy this sample ## Build and deploy this sample
@ -108,55 +108,57 @@ you're ready to build and deploy the sample app.
Docker Hub, run these commands replacing `{username}` with your Docker Hub, run these commands replacing `{username}` with your
Docker Hub username: Docker Hub username:
```shell ```shell
# Build the container on your local machine # Build the container on your local machine
docker build -t {username}/helloworld-ruby . docker build -t {username}/helloworld-ruby .
# Push the container to docker registry # Push the container to docker registry
docker push {username}/helloworld-ruby docker push {username}/helloworld-ruby
``` ```
1. After the build has completed and the container is pushed to docker hub, you 1. After the build has completed and the container is pushed to docker hub, you
can deploy the app into your cluster. Ensure that the container image value can deploy the app into your cluster. Ensure that the container image value
in `service.yaml` matches the container you built in in `service.yaml` matches the container you built in
the previous step. Apply the configuration using `kubectl`: the previous step. Apply the configuration using `kubectl`:
```shell ```shell
kubectl apply --filename service.yaml kubectl apply --filename service.yaml
``` ```
1. Now that your service is created, Knative will perform the following steps: 1. Now that your service is created, Knative will perform the following steps:
* Create a new immutable revision for this version of the app.
* Network programming to create a route, ingress, service, and load balance for your app. - Create a new immutable revision for this version of the app.
* Automatically scale your pods up and down (including to zero active pods). - Network programming to create a route, ingress, service, and load balance for your app.
- Automatically scale your pods up and down (including to zero active pods).
1. To find the IP address for your service, use 1. To find the IP address for your service, use
`kubectl get svc knative-ingressgateway --namespace istio-system` to get the ingress IP for your `kubectl get svc knative-ingressgateway --namespace istio-system` to get the ingress IP for your
cluster. If your cluster is new, it may take sometime for the service to get asssigned cluster. If your cluster is new, it may take sometime for the service to get asssigned
an external IP address. an external IP address.
```shell ```shell
kubectl get svc knative-ingressgateway --namespace istio-system kubectl get svc knative-ingressgateway --namespace istio-system
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
knative-ingressgateway LoadBalancer 10.23.247.74 35.203.155.229 80:32380/TCP,443:32390/TCP,32400:32400/TCP 2d knative-ingressgateway LoadBalancer 10.23.247.74 35.203.155.229 80:32380/TCP,443:32390/TCP,32400:32400/TCP 2d
``` ```
1. To find the URL for your service, use 1. To find the URL for your service, use
```
kubectl get ksvc helloworld-ruby --output=custom-columns=NAME:.metadata.name,DOMAIN:.status.domain ```
NAME DOMAIN kubectl get ksvc helloworld-ruby --output=custom-columns=NAME:.metadata.name,DOMAIN:.status.domain
helloworld-ruby helloworld-ruby.default.example.com NAME DOMAIN
``` helloworld-ruby helloworld-ruby.default.example.com
```
1. Now you can make a request to your app to see the result. Replace `{IP_ADDRESS}` 1. Now you can make a request to your app to see the result. Replace `{IP_ADDRESS}`
with the address you see returned in the previous step. with the address you see returned in the previous step.
```shell ```shell
curl -H "Host: helloworld-ruby.default.example.com" http://{IP_ADDRESS} curl -H "Host: helloworld-ruby.default.example.com" http://{IP_ADDRESS}
Hello World: Ruby Sample v1! Hello World: Ruby Sample v1!
``` ```
## Remove the sample app deployment ## Remove the sample app deployment

View File

@ -1,16 +1,16 @@
# Hello World - Rust sample # Hello World - Rust sample
A simple web app written in Rust that you can use for testing. A simple web app written in Rust that you can use for testing.
It reads in an env variable `TARGET` and prints "Hello ${TARGET}!". If It reads in an env variable `TARGET` and prints "Hello \${TARGET}!". If
TARGET is not specified, it will use "World" as the TARGET. TARGET is not specified, it will use "World" as the TARGET.
## Prerequisites ## Prerequisites
* A Kubernetes cluster with Knative installed. Follow the - A Kubernetes cluster with Knative installed. Follow the
[installation instructions](https://github.com/knative/docs/blob/master/install/README.md) if you need [installation instructions](https://github.com/knative/docs/blob/master/install/README.md) if you need
to create one. to create one.
* [Docker](https://www.docker.com) installed and running on your local machine, - [Docker](https://www.docker.com) installed and running on your local machine,
and a Docker Hub account configured (we'll use it for a container registry). and a Docker Hub account configured (we'll use it for a container registry).
## Steps to recreate the sample code ## Steps to recreate the sample code
@ -21,112 +21,112 @@ following instructions recreate the source files from this folder.
1. Create a new file named `Cargo.toml` and paste the following code: 1. Create a new file named `Cargo.toml` and paste the following code:
```toml ```toml
[package] [package]
name = "hellorust" name = "hellorust"
version = "0.0.0" version = "0.0.0"
publish = false publish = false
[dependencies] [dependencies]
hyper = "0.12.3" hyper = "0.12.3"
pretty_env_logger = "0.2.3" pretty_env_logger = "0.2.3"
``` ```
1. Create a `src` folder, then create a new file named `main.rs` in that folder 1. Create a `src` folder, then create a new file named `main.rs` in that folder
and paste the following code. This code creates a basic web server which and paste the following code. This code creates a basic web server which
listens on port 8080: listens on port 8080:
```rust ```rust
#![deny(warnings)] #![deny(warnings)]
extern crate hyper; extern crate hyper;
extern crate pretty_env_logger; extern crate pretty_env_logger;
use hyper::{Body, Response, Server}; use hyper::{Body, Response, Server};
use hyper::service::service_fn_ok; use hyper::service::service_fn_ok;
use hyper::rt::{self, Future}; use hyper::rt::{self, Future};
use std::env; use std::env;
fn main() { fn main() {
pretty_env_logger::init(); pretty_env_logger::init();
let mut port: u16 = 8080; let mut port: u16 = 8080;
match env::var("PORT") { match env::var("PORT") {
Ok(p) => { Ok(p) => {
match p.parse::<u16>() { match p.parse::<u16>() {
Ok(n) => {port = n;}, Ok(n) => {port = n;},
Err(_e) => {}, Err(_e) => {},
}; };
} }
Err(_e) => {}, Err(_e) => {},
}; };
let addr = ([0, 0, 0, 0], port).into(); let addr = ([0, 0, 0, 0], port).into();
let new_service = || { let new_service = || {
service_fn_ok(|_| { service_fn_ok(|_| {
let mut hello = "Hello ".to_string(); let mut hello = "Hello ".to_string();
match env::var("TARGET") { match env::var("TARGET") {
Ok(target) => {hello.push_str(&target);}, Ok(target) => {hello.push_str(&target);},
Err(_e) => {hello.push_str("World")}, Err(_e) => {hello.push_str("World")},
}; };
Response::new(Body::from(hello)) Response::new(Body::from(hello))
}) })
}; };
let server = Server::bind(&addr) let server = Server::bind(&addr)
.serve(new_service) .serve(new_service)
.map_err(|e| eprintln!("server error: {}", e)); .map_err(|e| eprintln!("server error: {}", e));
println!("Listening on http://{}", addr); println!("Listening on http://{}", addr);
rt::run(server); rt::run(server);
} }
``` ```
1. In your project directory, create a file named `Dockerfile` and copy the code 1. In your project directory, create a file named `Dockerfile` and copy the code
block below into it. block below into it.
```docker ```docker
# Use the official Rust image. # Use the official Rust image.
# https://hub.docker.com/_/rust # https://hub.docker.com/_/rust
FROM rust:1.27.0 FROM rust:1.27.0
# Copy local code to the container image. # Copy local code to the container image.
WORKDIR /usr/src/app WORKDIR /usr/src/app
COPY . . COPY . .
# Install production dependencies and build a release artifact. # Install production dependencies and build a release artifact.
RUN cargo install RUN cargo install
# Configure and document the service HTTP port. # Configure and document the service HTTP port.
ENV PORT 8080 ENV PORT 8080
EXPOSE $PORT EXPOSE $PORT
# Run the web service on container startup. # Run the web service on container startup.
CMD ["hellorust"] CMD ["hellorust"]
``` ```
1. Create a new file, `service.yaml` and copy the following service definition 1. Create a new file, `service.yaml` and copy the following service definition
into the file. Make sure to replace `{username}` with your Docker Hub username. into the file. Make sure to replace `{username}` with your Docker Hub username.
```yaml ```yaml
apiVersion: serving.knative.dev/v1alpha1 apiVersion: serving.knative.dev/v1alpha1
kind: Service kind: Service
metadata: metadata:
name: helloworld-rust name: helloworld-rust
namespace: default namespace: default
spec: spec:
runLatest: runLatest:
configuration: configuration:
revisionTemplate: revisionTemplate:
spec: spec:
container: container:
image: docker.io/{username}/helloworld-rust image: docker.io/{username}/helloworld-rust
env: env:
- name: TARGET - name: TARGET
value: "Rust Sample v1" value: "Rust Sample v1"
``` ```
## Build and deploy this sample ## Build and deploy this sample
@ -137,55 +137,57 @@ folder) you're ready to build and deploy the sample app.
Docker Hub, enter these commands replacing `{username}` with your Docker Hub, enter these commands replacing `{username}` with your
Docker Hub username: Docker Hub username:
```shell ```shell
# Build the container on your local machine # Build the container on your local machine
docker build -t {username}/helloworld-rust . docker build -t {username}/helloworld-rust .
# Push the container to docker registry # Push the container to docker registry
docker push {username}/helloworld-rust docker push {username}/helloworld-rust
``` ```
1. After the build has completed and the container is pushed to Docker Hub, you 1. After the build has completed and the container is pushed to Docker Hub, you
can deploy the app into your cluster. Ensure that the container image value can deploy the app into your cluster. Ensure that the container image value
in `service.yaml` matches the container you built in in `service.yaml` matches the container you built in
the previous step. Apply the configuration using `kubectl`: the previous step. Apply the configuration using `kubectl`:
```shell ```shell
kubectl apply --filename service.yaml kubectl apply --filename service.yaml
``` ```
1. Now that your service is created, Knative will perform the following steps: 1. Now that your service is created, Knative will perform the following steps:
* Create a new immutable revision for this version of the app.
* Network programming to create a route, ingress, service, and load balance for your app. - Create a new immutable revision for this version of the app.
* Automatically scale your pods up and down (including to zero active pods). - Network programming to create a route, ingress, service, and load balance for your app.
- Automatically scale your pods up and down (including to zero active pods).
1. To find the IP address for your service, enter 1. To find the IP address for your service, enter
`kubectl get svc knative-ingressgateway --namespace istio-system` to get the ingress IP for your `kubectl get svc knative-ingressgateway --namespace istio-system` to get the ingress IP for your
cluster. If your cluster is new, it may take sometime for the service to get asssigned cluster. If your cluster is new, it may take sometime for the service to get asssigned
an external IP address. an external IP address.
```shell ```shell
kubectl get svc knative-ingressgateway --namespace istio-system kubectl get svc knative-ingressgateway --namespace istio-system
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
knative-ingressgateway LoadBalancer 10.23.247.74 35.203.155.229 80:32380/TCP,443:32390/TCP,32400:32400/TCP 2d knative-ingressgateway LoadBalancer 10.23.247.74 35.203.155.229 80:32380/TCP,443:32390/TCP,32400:32400/TCP 2d
``` ```
1. To find the URL for your service, enter: 1. To find the URL for your service, enter:
```
kubectl get ksvc helloworld-rust --output=custom-columns=NAME:.metadata.name,DOMAIN:.status.domain ```
NAME DOMAIN kubectl get ksvc helloworld-rust --output=custom-columns=NAME:.metadata.name,DOMAIN:.status.domain
helloworld-rust helloworld-rust.default.example.com NAME DOMAIN
``` helloworld-rust helloworld-rust.default.example.com
```
1. Now you can make a request to your app and see the result. Replace 1. Now you can make a request to your app and see the result. Replace
`{IP_ADDRESS}` with the address you see returned in the previous step. `{IP_ADDRESS}` with the address you see returned in the previous step.
```shell ```shell
curl -H "Host: helloworld-rust.default.example.com" http://{IP_ADDRESS} curl -H "Host: helloworld-rust.default.example.com" http://{IP_ADDRESS}
Hello World! Hello World!
``` ```
## Removing the sample app deployment ## Removing the sample app deployment

View File

@ -1,8 +1,8 @@
# Hello World - Eclipse Vert.x sample # Hello World - Eclipse Vert.x sample
Learn how to deploy a simple web app that is written in Java and uses Eclipse Vert.x. Learn how to deploy a simple web app that is written in Java and uses Eclipse Vert.x.
This samples uses Docker to build locally. The app reads in a `TARGET` env variable and then This samples uses Docker to build locally. The app reads in a `TARGET` env variable and then
prints "Hello World: ${TARGET}!". If a value for `TARGET` is not specified, prints "Hello World: \${TARGET}!". If a value for `TARGET` is not specified,
the "NOT SPECIFIED" default value is used. the "NOT SPECIFIED" default value is used.
Use this sample to walk you through the steps of creating and modifying the sample app, building and pushing your Use this sample to walk you through the steps of creating and modifying the sample app, building and pushing your
@ -12,15 +12,15 @@ container image to a registry, and then deploying your app to your Knative clust
You must meet the following requirements to complete this sample: You must meet the following requirements to complete this sample:
* A version of the Knative Serving component installed and running on your Kubernetes cluster. Follow the - A version of the Knative Serving component installed and running on your Kubernetes cluster. Follow the
[Knative installation instructions](https://github.com/knative/docs/blob/master/install/README.md) if you need [Knative installation instructions](https://github.com/knative/docs/blob/master/install/README.md) if you need
to create a Knative cluster. to create a Knative cluster.
* The following software downloaded and install on your loacal machine: - The following software downloaded and install on your loacal machine:
* [Java SE 8 or later JDK](http://www.oracle.com/technetwork/java/javase/downloads/index.html). - [Java SE 8 or later JDK](http://www.oracle.com/technetwork/java/javase/downloads/index.html).
* [Eclipse Vert.x v3.5.4](https://vertx.io/). - [Eclipse Vert.x v3.5.4](https://vertx.io/).
* [Docker](https://www.docker.com) for building and pushing your container image. - [Docker](https://www.docker.com) for building and pushing your container image.
* [curl](https://curl.haxx.se/) to test the sample app after deployment. - [curl](https://curl.haxx.se/) to test the sample app after deployment.
* A [Docker Hub](https://hub.docker.com/) account where you can push your container image. - A [Docker Hub](https://hub.docker.com/) account where you can push your container image.
**Tip**: You can clone the [Knatve/docs repo](https://github.com/knative/docs) and then modify the source files. **Tip**: You can clone the [Knatve/docs repo](https://github.com/knative/docs) and then modify the source files.
Alternatively, learn more by manually creating the files youself. Alternatively, learn more by manually creating the files youself.
@ -31,74 +31,74 @@ To create and configure the source files in the root of your working directory:
1. Create the `pom.xml` file: 1. Create the `pom.xml` file:
```xml ```xml
<project xmlns="http://maven.apache.org/POM/4.0.0" <project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd"> http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>com.example.vertx</groupId> <groupId>com.example.vertx</groupId>
<artifactId>helloworld</artifactId> <artifactId>helloworld</artifactId>
<version>1.0.0-SNAPSHOT</version> <version>1.0.0-SNAPSHOT</version>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>io.vertx</groupId> <groupId>io.vertx</groupId>
<artifactId>vertx-core</artifactId> <artifactId>vertx-core</artifactId>
<version>${version.vertx}</version> <version>${version.vertx}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>io.vertx</groupId> <groupId>io.vertx</groupId>
<artifactId>vertx-rx-java2</artifactId> <artifactId>vertx-rx-java2</artifactId>
<version>${version.vertx}</version> <version>${version.vertx}</version>
</dependency> </dependency>
</dependencies> </dependencies>
<build> <build>
<plugins> <plugins>
<plugin> <plugin>
<artifactId>maven-compiler-plugin</artifactId> <artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version> <version>3.8.0</version>
<configuration> <configuration>
<source>1.8</source> <source>1.8</source>
<target>1.8</target> <target>1.8</target>
</configuration> </configuration>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId> <artifactId>maven-shade-plugin</artifactId>
<version>3.2.0</version> <version>3.2.0</version>
<executions> <executions>
<execution> <execution>
<phase>package</phase> <phase>package</phase>
<goals> <goals>
<goal>shade</goal> <goal>shade</goal>
</goals> </goals>
<configuration> <configuration>
<transformers> <transformers>
<transformer <transformer
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"> implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<manifestEntries> <manifestEntries>
<Main-Class>io.vertx.core.Launcher</Main-Class> <Main-Class>io.vertx.core.Launcher</Main-Class>
<Main-Verticle>com.example.helloworld.HelloWorld</Main-Verticle> <Main-Verticle>com.example.helloworld.HelloWorld</Main-Verticle>
</manifestEntries> </manifestEntries>
</transformer> </transformer>
</transformers> </transformers>
<artifactSet/> <artifactSet/>
</configuration> </configuration>
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
</plugins> </plugins>
</build> </build>
<properties> <properties>
<version.vertx>3.5.4</version.vertx> <version.vertx>3.5.4</version.vertx>
</properties> </properties>
</project> </project>
``` ```
1. Create the `HelloWorld.java` file in the `src/main/java/com/example/helloworld` directory. The 1. Create the `HelloWorld.java` file in the `src/main/java/com/example/helloworld` directory. The
`[ROOT]/src/main/java/com/example/helloworld/HelloWorld.java` file creates a basic web server that listens on port `8080`. `[ROOT]/src/main/java/com/example/helloworld/HelloWorld.java` file creates a basic web server that listens on port `8080`.
```java ```java
@ -136,33 +136,33 @@ To create and configure the source files in the root of your working directory:
1. Create the `Dockerfile` file: 1. Create the `Dockerfile` file:
```docker ```docker
FROM fabric8/s2i-java:2.0 FROM fabric8/s2i-java:2.0
ENV JAVA_APP_DIR=/deployments ENV JAVA_APP_DIR=/deployments
EXPOSE 8080 EXPOSE 8080
COPY target/helloworld-1.0.0-SNAPSHOT.jar /deployments/ COPY target/helloworld-1.0.0-SNAPSHOT.jar /deployments/
``` ```
1. Create the `service.yaml` file. You must specify your Docker Hub username in `{username}`. You can also 1. Create the `service.yaml` file. You must specify your Docker Hub username in `{username}`. You can also
configure the `TARGET`, for example you can modify the `Eclipse Vert.x Sample v1` value. configure the `TARGET`, for example you can modify the `Eclipse Vert.x Sample v1` value.
```yaml ```yaml
apiVersion: serving.knative.dev/v1alpha1 apiVersion: serving.knative.dev/v1alpha1
kind: Service kind: Service
metadata: metadata:
name: helloworld-vertx name: helloworld-vertx
namespace: default namespace: default
spec: spec:
runLatest: runLatest:
configuration: configuration:
revisionTemplate: revisionTemplate:
spec: spec:
container: container:
image: docker.io/{username}/helloworld-vertx image: docker.io/{username}/helloworld-vertx
env: env:
- name: TARGET - name: TARGET
value: "Eclipse Vert.x Sample v1" value: "Eclipse Vert.x Sample v1"
``` ```
## Building and deploying the sample ## Building and deploying the sample
@ -171,37 +171,38 @@ To build a container image, push your image to the registry, and then deploy you
1. Use Docker to build your container image and then push that image to your Docker Hub registry. 1. Use Docker to build your container image and then push that image to your Docker Hub registry.
You must replace the `{username}` variables in the following commands with your Docker Hub username. You must replace the `{username}` variables in the following commands with your Docker Hub username.
```shell ```shell
# Build the container on your local machine # Build the container on your local machine
docker build -t {username}/helloworld-vertx . docker build -t {username}/helloworld-vertx .
# Push the container to docker registry # Push the container to docker registry
docker push {username}/helloworld-vertx docker push {username}/helloworld-vertx
``` ```
1. Now that your container image is in the registry, you can deploy it to your Knative cluster by 1. Now that your container image is in the registry, you can deploy it to your Knative cluster by
running the `kubectl apply` command: running the `kubectl apply` command:
```shell ```shell
kubectl apply --filename service.yaml kubectl apply --filename service.yaml
``` ```
Result: A service name `helloworld-vertx` is created in your cluster along with the following resources: Result: A service name `helloworld-vertx` is created in your cluster along with the following resources:
* A new immutable revision for the version of the app that you just deployed.
* The following networking resources are created for your app: - A new immutable revision for the version of the app that you just deployed.
* route - The following networking resources are created for your app:
* ingress - route
* service - ingress
* load balancer - service
* Auto scaling is enable to allow your pods to scale up to meet traffic, and also back down to zero when there is no traffic. - load balancer
- Auto scaling is enable to allow your pods to scale up to meet traffic, and also back down to zero when there is no traffic.
## Testing the sample app ## Testing the sample app
To verify that your sample app has been successfully deployed: To verify that your sample app has been successfully deployed:
1. View your the ingress IP address of your service by running the following 1. View your the ingress IP address of your service by running the following
`kubectl get` command. Note that it may take sometime for the new service to get asssigned `kubectl get` command. Note that it may take sometime for the new service to get asssigned
an external IP address, especially if your cluster was newly created. an external IP address, especially if your cluster was newly created.
```shell ```shell
kubectl get svc knative-ingressgateway --namespace istio-system kubectl get svc knative-ingressgateway --namespace istio-system
@ -215,6 +216,7 @@ an external IP address, especially if your cluster was newly created.
``` ```
1. Retrieve the URL for your service, by running the following `kubectl get` command: 1. Retrieve the URL for your service, by running the following `kubectl get` command:
```shell ```shell
kubectl get services.serving.knative.dev helloworld-vertx --output=custom-columns=NAME:.metadata.name,DOMAIN:.status.domain kubectl get services.serving.knative.dev helloworld-vertx --output=custom-columns=NAME:.metadata.name,DOMAIN:.status.domain
``` ```
@ -229,17 +231,17 @@ an external IP address, especially if your cluster was newly created.
1. Run the following `curl` command to test your deployed sample app. You must replace the 1. Run the following `curl` command to test your deployed sample app. You must replace the
`{IP_ADDRESS}` variable the URL that your retrieve in the previous step. `{IP_ADDRESS}` variable the URL that your retrieve in the previous step.
```shell ```shell
curl -H "Host: helloworld-vertx.default.example.com" http://{IP_ADDRESS} curl -H "Host: helloworld-vertx.default.example.com" http://{IP_ADDRESS}
``` ```
Example result: Example result:
```shell ```shell
Hello World: Eclipse Vert.x Sample v1 Hello World: Eclipse Vert.x Sample v1
``` ```
Congtratualations on deploying your sample Java app to Knative! Congtratualations on deploying your sample Java app to Knative!
## Removing the sample app deployment ## Removing the sample app deployment

View File

@ -19,9 +19,10 @@ to the Login service.
2. Install [Docker](https://docs.docker.com/get-started/#prepare-your-docker-environment). 2. Install [Docker](https://docs.docker.com/get-started/#prepare-your-docker-environment).
3. Acquire a domain name. 3. Acquire a domain name.
- In this example, we use `example.com`. If you don't have a domain name, - In this example, we use `example.com`. If you don't have a domain name,
you can modify your hosts file (on Mac or Linux) to map `example.com` to your you can modify your hosts file (on Mac or Linux) to map `example.com` to your
cluster's ingress IP. cluster's ingress IP.
4. Check out the code: 4. Check out the code:
``` ```
go get -d github.com/knative/docs/serving/samples/knative-routing-go go get -d github.com/knative/docs/serving/samples/knative-routing-go
``` ```
@ -30,44 +31,52 @@ go get -d github.com/knative/docs/serving/samples/knative-routing-go
Build the application container and publish it to a container registry: Build the application container and publish it to a container registry:
1. Move into the sample directory: 1. Move into the sample directory:
```shell ```shell
cd $GOPATH/src/github.com/knative/docs cd $GOPATH/src/github.com/knative/docs
``` ```
2. Set your preferred container registry: 2. Set your preferred container registry:
```shell ```shell
export REPO="gcr.io/<YOUR_PROJECT_ID>" export REPO="gcr.io/<YOUR_PROJECT_ID>"
``` ```
This example shows how to use Google Container Registry (GCR). You will need a Google Cloud Project and to enable the [Google Container Registry
API](https://console.cloud.google.com/apis/library/containerregistry.googleapis.com).
3. Use Docker to build your application container: This example shows how to use Google Container Registry (GCR). You will need a Google Cloud Project and to enable the [Google Container Registry
API](https://console.cloud.google.com/apis/library/containerregistry.googleapis.com).
3. Use Docker to build your application container:
``` ```
docker build \ docker build \
--tag "${REPO}/serving/samples/knative-routing-go" \ --tag "${REPO}/serving/samples/knative-routing-go" \
--file=serving/samples/knative-routing-go/Dockerfile . --file=serving/samples/knative-routing-go/Dockerfile .
``` ```
4. Push your container to a container registry: 4. Push your container to a container registry:
```
```
docker push "${REPO}/serving/samples/knative-routing-go" docker push "${REPO}/serving/samples/knative-routing-go"
``` ```
5. Replace the image reference path with our published image path in the configuration file `serving/samples/knative-routing-go/sample.yaml`: 5. Replace the image reference path with our published image path in the configuration file `serving/samples/knative-routing-go/sample.yaml`:
* Manually replace:
`image: github.com/knative/docs/serving/samples/knative-routing-go` with `image: <YOUR_CONTAINER_REGISTRY>/serving/samples/knative-routing-go`
Or - Manually replace:
`image: github.com/knative/docs/serving/samples/knative-routing-go` with `image: <YOUR_CONTAINER_REGISTRY>/serving/samples/knative-routing-go`
* Run this command: Or
```
perl -pi -e "s@github.com/knative/docs@${REPO}@g" serving/samples/knative-routing-go/sample.yaml - Run this command:
```
```
perl -pi -e "s@github.com/knative/docs@${REPO}@g" serving/samples/knative-routing-go/sample.yaml
```
## Deploy the Service ## Deploy the Service
Deploy the Knative Serving sample: Deploy the Knative Serving sample:
``` ```
kubectl apply --filename serving/samples/knative-routing-go/sample.yaml kubectl apply --filename serving/samples/knative-routing-go/sample.yaml
``` ```
@ -78,43 +87,51 @@ A shared Gateway "knative-shared-gateway" is used within Knative service mesh
for serving all incoming traffic. You can inspect it and its corresponding Kubernetes for serving all incoming traffic. You can inspect it and its corresponding Kubernetes
service with: service with:
* Check the shared Gateway: - Check the shared Gateway:
``` ```
kubectl get Gateway --namespace knative-serving --output yaml kubectl get Gateway --namespace knative-serving --output yaml
``` ```
* Check the corresponding Kubernetes service for the shared Gateway: - Check the corresponding Kubernetes service for the shared Gateway:
``` ```
kubectl get svc knative-ingressgateway --namespace istio-system --output yaml kubectl get svc knative-ingressgateway --namespace istio-system --output yaml
``` ```
* Inspect the deployed Knative services with: - Inspect the deployed Knative services with:
``` ```
kubectl get ksvc kubectl get ksvc
``` ```
You should see 2 Knative services: `search-service` and `login-service`. You should see 2 Knative services: `search-service` and `login-service`.
### Access the Services ### Access the Services
1. Find the shared Gateway IP and export as an environment variable:
1. Find the shared Gateway IP and export as an environment variable:
```shell ```shell
export GATEWAY_IP=`kubectl get svc knative-ingressgateway --namespace istio-system \ export GATEWAY_IP=`kubectl get svc knative-ingressgateway --namespace istio-system \
--output jsonpath="{.status.loadBalancer.ingress[*]['ip']}"` --output jsonpath="{.status.loadBalancer.ingress[*]['ip']}"`
``` ```
2. Find the `Search` service route and export as an environment variable: 2. Find the `Search` service route and export as an environment variable:
```shell ```shell
export SERVICE_HOST=`kubectl get route search-service --output jsonpath="{.status.domain}"` export SERVICE_HOST=`kubectl get route search-service --output jsonpath="{.status.domain}"`
``` ```
3. Make a curl request to the service: 3. Make a curl request to the service:
```shell ```shell
curl http://${GATEWAY_IP} --header "Host:${SERVICE_HOST}" curl http://${GATEWAY_IP} --header "Host:${SERVICE_HOST}"
``` ```
You should see: `Search Service is called !` You should see: `Search Service is called !`
4. Similarly, you can also directly access "Login" service with: 4. Similarly, you can also directly access "Login" service with:
```shell ```shell
export SERVICE_HOST=`kubectl get route login-service --output jsonpath="{.status.domain}"` export SERVICE_HOST=`kubectl get route login-service --output jsonpath="{.status.domain}"`
``` ```
@ -127,34 +144,36 @@ You should see: `Login Service is called !`
## Apply Custom Routing Rule ## Apply Custom Routing Rule
1. Apply the custom routing rules defined in `routing.yaml` file with: 1. Apply the custom routing rules defined in `routing.yaml` file with:
``` ```
kubectl apply --filename serving/samples/knative-routing-go/routing.yaml kubectl apply --filename serving/samples/knative-routing-go/routing.yaml
``` ```
2. The `routing.yaml` file will generate a new VirtualService `entry-route` for 2. The `routing.yaml` file will generate a new VirtualService `entry-route` for
domain `example.com`. View the VirtualService: domain `example.com`. View the VirtualService:
``` ```
kubectl get VirtualService entry-route --output yaml kubectl get VirtualService entry-route --output yaml
``` ```
3. Send a request to the `Search` service and the `Login` service by using 3. Send a request to the `Search` service and the `Login` service by using
corresponding URIs. You should get the same results as directly accessing these services. corresponding URIs. You should get the same results as directly accessing these services.
* Get the ingress IP: _ Get the ingress IP:
```shell ```shell
export GATEWAY_IP=`kubectl get svc knative-ingressgateway --namespace istio-system \ export GATEWAY_IP=`kubectl get svc knative-ingressgateway --namespace istio-system \
--output jsonpath="{.status.loadBalancer.ingress[*]['ip']}"` --output jsonpath="{.status.loadBalancer.ingress[_]['ip']}"`
``` ```
* Send a request to the Search service: * Send a request to the Search service:
```shell ```shell
curl http://${GATEWAY_IP}/search --header "Host:example.com" curl http://${GATEWAY_IP}/search --header "Host:example.com"
``` ```
* Send a request to the Login service: * Send a request to the Login service:
```shell ```shell
curl http://${GATEWAY_IP}/login --header "Host:example.com" curl http://${GATEWAY_IP}/login --header "Host:example.com"
``` ```
## How It Works ## How It Works
@ -169,10 +188,10 @@ Gateway again. The Gateway proxy checks the updated host, and forwards it to
![Object model](images/knative-routing-sample-flow.png) ![Object model](images/knative-routing-sample-flow.png)
## Clean Up ## Clean Up
To clean up the sample resources: To clean up the sample resources:
``` ```
kubectl delete --filename serving/samples/knative-routing-go/sample.yaml kubectl delete --filename serving/samples/knative-routing-go/sample.yaml
kubectl delete --filename serving/samples/knative-routing-go/routing.yaml kubectl delete --filename serving/samples/knative-routing-go/routing.yaml

View File

@ -8,6 +8,7 @@ This sample demonstrates creating a simple RESTful service. The exposed endpoint
2. Install [Docker](https://docs.docker.com/get-started/#prepare-your-docker-environment). 2. Install [Docker](https://docs.docker.com/get-started/#prepare-your-docker-environment).
3. You need to [configure outbound network access](https://github.com/knative/docs/blob/master/serving/outbound-network-access.md) because this application makes an external API request. 3. You need to [configure outbound network access](https://github.com/knative/docs/blob/master/serving/outbound-network-access.md) because this application makes an external API request.
4. Check out the code: 4. Check out the code:
``` ```
go get -d github.com/knative/docs/serving/samples/rest-api-go go get -d github.com/knative/docs/serving/samples/rest-api-go
``` ```
@ -16,44 +17,52 @@ go get -d github.com/knative/docs/serving/samples/rest-api-go
Build the application container and publish it to a container registry: Build the application container and publish it to a container registry:
1. Move into the sample directory: 1. Move into the sample directory:
``` ```
cd $GOPATH/src/github.com/knative/docs cd $GOPATH/src/github.com/knative/docs
``` ```
2. Set your preferred container registry: 2. Set your preferred container registry:
``` ```
export REPO="gcr.io/<YOUR_PROJECT_ID>" export REPO="gcr.io/<YOUR_PROJECT_ID>"
``` ```
To run the sample, you need to have a Google Cloud Platform project, and you also need to enable the [Google Container Registry
API](https://console.cloud.google.com/apis/library/containerregistry.googleapis.com).
3. Use Docker to build your application container: To run the sample, you need to have a Google Cloud Platform project, and you also need to enable the [Google Container Registry
API](https://console.cloud.google.com/apis/library/containerregistry.googleapis.com).
3. Use Docker to build your application container:
``` ```
docker build \ docker build \
--tag "${REPO}/serving/samples/rest-api-go" \ --tag "${REPO}/serving/samples/rest-api-go" \
--file serving/samples/rest-api-go/Dockerfile . --file serving/samples/rest-api-go/Dockerfile .
``` ```
4. Push your container to a container registry: 4. Push your container to a container registry:
```
```
docker push "${REPO}/serving/samples/rest-api-go" docker push "${REPO}/serving/samples/rest-api-go"
``` ```
5. Replace the image reference path with our published image path in the configuration files (`serving/samples/rest-api-go/sample.yaml`: 5. Replace the image reference path with our published image path in the configuration files (`serving/samples/rest-api-go/sample.yaml`:
* Manually replace:
`image: github.com/knative/docs/serving/samples/rest-api-go` with `image: <YOUR_CONTAINER_REGISTRY>/serving/samples/rest-api-go`
Or - Manually replace:
`image: github.com/knative/docs/serving/samples/rest-api-go` with `image: <YOUR_CONTAINER_REGISTRY>/serving/samples/rest-api-go`
* Use run this command: Or
```
perl -pi -e "s@github.com/knative/docs@${REPO}@g" serving/samples/rest-api-go/sample.yaml - Use run this command:
```
```
perl -pi -e "s@github.com/knative/docs@${REPO}@g" serving/samples/rest-api-go/sample.yaml
```
## Deploy the Configuration ## Deploy the Configuration
Deploy the Knative Serving sample: Deploy the Knative Serving sample:
``` ```
kubectl apply --filename serving/samples/rest-api-go/sample.yaml kubectl apply --filename serving/samples/rest-api-go/sample.yaml
``` ```
@ -62,17 +71,20 @@ kubectl apply --filename serving/samples/rest-api-go/sample.yaml
Inspect the created resources with the `kubectl` commands: Inspect the created resources with the `kubectl` commands:
* View the created Route resource: - View the created Route resource:
``` ```
kubectl get route --output yaml kubectl get route --output yaml
``` ```
* View the created Configuration resource: - View the created Configuration resource:
``` ```
kubectl get configurations --output yaml kubectl get configurations --output yaml
``` ```
* View the Revision that was created by our Configuration: - View the Revision that was created by our Configuration:
``` ```
kubectl get revisions --output yaml kubectl get revisions --output yaml
``` ```
@ -82,55 +94,65 @@ kubectl get revisions --output yaml
To access this service via `curl`, you need to determine its ingress address. To access this service via `curl`, you need to determine its ingress address.
1. To determine if your service is ready: 1. To determine if your service is ready:
```
kubectl get svc knative-ingressgateway --namespace istio-system --watch
```
When the service is ready, you'll see an IP address in the `EXTERNAL-IP` field: ```
kubectl get svc knative-ingressgateway --namespace istio-system --watch
```
``` When the service is ready, you'll see an IP address in the `EXTERNAL-IP` field:
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
knative-ingressgateway LoadBalancer 10.23.247.74 35.203.155.229 80:32380/TCP,443:32390/TCP,32400:32400/TCP 2d ```
``` NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
knative-ingressgateway LoadBalancer 10.23.247.74 35.203.155.229 80:32380/TCP,443:32390/TCP,32400:32400/TCP 2d
```
2. When the service is ready, export the ingress hostname and IP as environment variables: 2. When the service is ready, export the ingress hostname and IP as environment variables:
```
export SERVICE_HOST=`kubectl get route stock-route-example --output jsonpath="{.status.domain}"`
export SERVICE_IP=`kubectl get svc knative-ingressgateway --namespace istio-system \
--output jsonpath="{.status.loadBalancer.ingress[*].ip}"`
```
* If your cluster is running outside a cloud provider (for example on Minikube), ```
export SERVICE_HOST=`kubectl get route stock-route-example --output jsonpath="{.status.domain}"`
export SERVICE_IP=`kubectl get svc knative-ingressgateway --namespace istio-system \
--output jsonpath="{.status.loadBalancer.ingress[*].ip}"`
```
- If your cluster is running outside a cloud provider (for example on Minikube),
your services will never get an external IP address. In that case, use the istio `hostIP` and `nodePort` as the service IP: your services will never get an external IP address. In that case, use the istio `hostIP` and `nodePort` as the service IP:
```
export SERVICE_IP=$(kubectl get po --selector knative=ingressgateway --namespace istio-system \ ```
--output 'jsonpath={.items[0].status.hostIP}'):$(kubectl get svc knative-ingressgateway --namespace istio-system \ export SERVICE_IP=$(kubectl get po --selector knative=ingressgateway --namespace istio-system \
--output 'jsonpath={.spec.ports[?(@.port==80)].nodePort}') --output 'jsonpath={.items[0].status.hostIP}'):$(kubectl get svc knative-ingressgateway --namespace istio-system \
``` --output 'jsonpath={.spec.ports[?(@.port==80)].nodePort}')
```
3. Now use `curl` to make a request to the service: 3. Now use `curl` to make a request to the service:
* Make a request to the index endpoint:
```
curl --header "Host:$SERVICE_HOST" http://${SERVICE_IP}
```
Response body: `Welcome to the stock app!`
* Make a request to the `/stock` endpoint: - Make a request to the index endpoint:
```
curl --header "Host:$SERVICE_HOST" http://${SERVICE_IP}/stock
```
Response body: `stock ticker not found!, require /stock/{ticker}`
* Make a request to the `/stock` endpoint with a `ticker` parameter: ```
``` curl --header "Host:$SERVICE_HOST" http://${SERVICE_IP}
curl --header "Host:$SERVICE_HOST" http://${SERVICE_IP}/stock/<ticker> ```
```
Response body: `stock price for ticker <ticker> is <price>`
Response body: `Welcome to the stock app!`
- Make a request to the `/stock` endpoint:
```
curl --header "Host:$SERVICE_HOST" http://${SERVICE_IP}/stock
```
Response body: `stock ticker not found!, require /stock/{ticker}`
- Make a request to the `/stock` endpoint with a `ticker` parameter:
```
curl --header "Host:$SERVICE_HOST" http://${SERVICE_IP}/stock/<ticker>
```
Response body: `stock price for ticker <ticker> is <price>`
## Clean Up ## Clean Up
To clean up the sample service: To clean up the sample service:
``` ```
kubectl delete --filename serving/samples/rest-api-go/sample.yaml kubectl delete --filename serving/samples/rest-api-go/sample.yaml
``` ```

View File

@ -1,4 +1,4 @@
# Orchestrating a source-to-URL deployment on Kubernetes # Orchestrating a source-to-URL deployment on Kubernetes
A Go sample that shows how to use Knative to go from source code in a git A Go sample that shows how to use Knative to go from source code in a git
repository to a running application with a URL. repository to a running application with a URL.
@ -10,10 +10,10 @@ components of Knative to orchestrate an end-to-end deployment.
You need: You need:
* A Kubernetes cluster with Knative installed. Follow the - A Kubernetes cluster with Knative installed. Follow the
[installation instructions](https://github.com/knative/docs/blob/master/install/README.md) if you need [installation instructions](https://github.com/knative/docs/blob/master/install/README.md) if you need
to create one. to create one.
* Go installed and configured. This is optional, and only required if you want to run the sample app - Go installed and configured. This is optional, and only required if you want to run the sample app
locally. locally.
## Configuring Knative ## Configuring Knative
@ -33,7 +33,7 @@ kubectl apply --filename https://raw.githubusercontent.com/knative/build-templat
### Register secrets for Docker Hub ### Register secrets for Docker Hub
In order to push the container that is built from source to Docker Hub, register a secret in In order to push the container that is built from source to Docker Hub, register a secret in
Kubernetes for authentication with Docker Hub. Kubernetes for authentication with Docker Hub.
There are [detailed instructions](https://github.com/knative/docs/blob/master/build/auth.md#basic-authentication-docker) There are [detailed instructions](https://github.com/knative/docs/blob/master/build/auth.md#basic-authentication-docker)
@ -74,15 +74,14 @@ available, but these are the key steps:
1. Create a new `Service Account` manifest which is used to link the build process to the secret. 1. Create a new `Service Account` manifest which is used to link the build process to the secret.
Save this file as `service-account.yaml`: Save this file as `service-account.yaml`:
```yaml
```yaml apiVersion: v1
apiVersion: v1 kind: ServiceAccount
kind: ServiceAccount metadata:
metadata: name: build-bot
name: build-bot secrets:
secrets: - name: basic-user-pass
- name: basic-user-pass ```
```
1. After you have created the manifest files, apply them to your cluster with `kubectl`: 1. After you have created the manifest files, apply them to your cluster with `kubectl`:
@ -93,7 +92,6 @@ available, but these are the key steps:
serviceaccount "build-bot" created serviceaccount "build-bot" created
``` ```
## Deploying the sample ## Deploying the sample
Now that you've configured your cluster accordingly, you are ready to deploy the Now that you've configured your cluster accordingly, you are ready to deploy the
@ -130,16 +128,16 @@ container for the application.
template: template:
name: kaniko name: kaniko
arguments: arguments:
- name: IMAGE - name: IMAGE
value: docker.io/{DOCKER_USERNAME}/app-from-source:latest value: docker.io/{DOCKER_USERNAME}/app-from-source:latest
revisionTemplate: revisionTemplate:
spec: spec:
container: container:
image: docker.io/{DOCKER_USERNAME}/app-from-source:latest image: docker.io/{DOCKER_USERNAME}/app-from-source:latest
imagePullPolicy: Always imagePullPolicy: Always
env: env:
- name: SIMPLE_MSG - name: SIMPLE_MSG
value: "Hello from the sample app!" value: "Hello from the sample app!"
``` ```
1. Apply this manifest using `kubectl`, and watch the results: 1. Apply this manifest using `kubectl`, and watch the results:
@ -167,7 +165,7 @@ container for the application.
1. Once you see the deployment pod switch to the running state, press Ctrl+C to 1. Once you see the deployment pod switch to the running state, press Ctrl+C to
escape the watch. Your container is now built and deployed! escape the watch. Your container is now built and deployed!
1. To check on the state of the service, get the service object and examine the 1. To check on the state of the service, get the service object and examine the
status block: status block:
```shell ```shell
@ -196,38 +194,39 @@ container for the application.
``` ```
1. Now that your service is created, Knative will perform the following steps: 1. Now that your service is created, Knative will perform the following steps:
* Fetch the revision specified from GitHub and build it into a container
* Push the container to Docker Hub
* Create a new immutable revision for this version of the app.
* Network programming to create a route, ingress, service, and load balance for your app.
* Automatically scale your pods up and down (including to zero active pods).
1. To get the ingress IP for your cluster, use the following command. If your cluster is new, - Fetch the revision specified from GitHub and build it into a container
- Push the container to Docker Hub
- Create a new immutable revision for this version of the app.
- Network programming to create a route, ingress, service, and load balance for your app.
- Automatically scale your pods up and down (including to zero active pods).
1. To get the ingress IP for your cluster, use the following command. If your cluster is new,
it can take some time for the service to get an external IP address: it can take some time for the service to get an external IP address:
```shell ```shell
$ kubectl get svc knative-ingressgateway --namespace istio-system $ kubectl get svc knative-ingressgateway --namespace istio-system
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
knative-ingressgateway LoadBalancer 10.23.247.74 35.203.155.229 80:32380/TCP,443:32390/TCP,32400:32400/TCP 2d knative-ingressgateway LoadBalancer 10.23.247.74 35.203.155.229 80:32380/TCP,443:32390/TCP,32400:32400/TCP 2d
``` ```
1. To find the URL for your service, type: 1. To find the URL for your service, type:
```shell ```shell
$ kubectl get ksvc app-from-source --output=custom-columns=NAME:.metadata.name,DOMAIN:.status.domain $ kubectl get ksvc app-from-source --output=custom-columns=NAME:.metadata.name,DOMAIN:.status.domain
NAME DOMAIN NAME DOMAIN
app-from-source app-from-source.default.example.com app-from-source app-from-source.default.example.com
``` ```
1. Now you can make a request to your app to see the result. Replace 1. Now you can make a request to your app to see the result. Replace
`{IP_ADDRESS}` with the address that you got in the previous step: `{IP_ADDRESS}` with the address that you got in the previous step:
```shell ```shell
curl -H "Host: app-from-source.default.example.com" http://{IP_ADDRESS} curl -H "Host: app-from-source.default.example.com" http://{IP_ADDRESS}
Hello from the sample app!" Hello from the sample app!"
``` ```
## Removing the sample app deployment ## Removing the sample app deployment

View File

@ -10,14 +10,18 @@ using the default installation.
## Prerequisites ## Prerequisites
1. A Kubernetes cluster with [Knative Serving](https://github.com/knative/docs/blob/master/install/README.md) 1. A Kubernetes cluster with [Knative Serving](https://github.com/knative/docs/blob/master/install/README.md)
installed. installed.
2. Check if Knative monitoring components are installed: 2. Check if Knative monitoring components are installed:
``` ```
kubectl get pods --namespace knative-monitoring kubectl get pods --namespace knative-monitoring
``` ```
* If pods aren't found, install [Knative monitoring component](../../installing-logging-metrics-traces.md).
- If pods aren't found, install [Knative monitoring component](../../installing-logging-metrics-traces.md).
3. Install [Docker](https://docs.docker.com/get-started/#prepare-your-docker-environment). 3. Install [Docker](https://docs.docker.com/get-started/#prepare-your-docker-environment).
4. Check out the code: 4. Check out the code:
``` ```
go get -d github.com/knative/docs/serving/samples/telemetry-go go get -d github.com/knative/docs/serving/samples/telemetry-go
``` ```
@ -26,47 +30,57 @@ go get -d github.com/knative/docs/serving/samples/telemetry-go
Build the application container and publish it to a container registry: Build the application container and publish it to a container registry:
1. Move into the sample directory: 1. Move into the sample directory:
``` ```
cd $GOPATH/src/github.com/knative/docs cd $GOPATH/src/github.com/knative/docs
``` ```
2. Set your preferred container registry: 2. Set your preferred container registry:
``` ```
export REPO="gcr.io/<YOUR_PROJECT_ID>" export REPO="gcr.io/<YOUR_PROJECT_ID>"
``` ```
This example shows how to use Google Container Registry (GCR). You will need
a Google Cloud Project and to enable the [Google Container Registry
API](https://console.cloud.google.com/apis/library/containerregistry.googleapis.com).
3. Use Docker to build your application container: This example shows how to use Google Container Registry (GCR). You will need
a Google Cloud Project and to enable the [Google Container Registry
API](https://console.cloud.google.com/apis/library/containerregistry.googleapis.com).
3. Use Docker to build your application container:
``` ```
docker build \ docker build \
--tag "${REPO}/serving/samples/telemetry-go" \ --tag "${REPO}/serving/samples/telemetry-go" \
--file=serving/samples/telemetry-go/Dockerfile . --file=serving/samples/telemetry-go/Dockerfile .
``` ```
4. Push your container to a container registry: 4. Push your container to a container registry:
```
```
docker push "${REPO}/serving/samples/telemetry-go" docker push "${REPO}/serving/samples/telemetry-go"
``` ```
5. Replace the image reference path with our published image path in the 5. Replace the image reference path with our published image path in the
configuration file (`serving/samples/telemetry-go/sample.yaml`): configuration file (`serving/samples/telemetry-go/sample.yaml`):
* Manually replace:
`image: github.com/knative/docs/serving/samples/telemetry-go` with
`image: <YOUR_CONTAINER_REGISTRY>/serving/samples/telemetry-go`
Or - Manually replace:
`image: github.com/knative/docs/serving/samples/telemetry-go` with
`image: <YOUR_CONTAINER_REGISTRY>/serving/samples/telemetry-go`
* Use run this command:
``` Or
perl -pi -e "s@github.com/knative/docs@${REPO}@g" serving/samples/telemetry-go/sample.yaml
``` - Use run this command:
```
perl -pi -e "s@github.com/knative/docs@${REPO}@g" serving/samples/telemetry-go/sample.yaml
```
## Deploy the Service ## Deploy the Service
Deploy this application to Knative Serving: Deploy this application to Knative Serving:
``` ```
kubectl apply --filename serving/samples/telemetry-go/ kubectl apply --filename serving/samples/telemetry-go/
``` ```
@ -75,81 +89,97 @@ kubectl apply --filename serving/samples/telemetry-go/
Inspect the created resources with the `kubectl` commands: Inspect the created resources with the `kubectl` commands:
* View the created Route resource: - View the created Route resource:
```
kubectl get route --output yaml
```
* View the created Configuration resource: ```
``` kubectl get route --output yaml
kubectl get configurations --output yaml ```
```
* View the Revision that was created by the Configuration: - View the created Configuration resource:
```
kubectl get revisions --output yaml ```
``` kubectl get configurations --output yaml
```
- View the Revision that was created by the Configuration:
```
kubectl get revisions --output yaml
```
## Access the Service ## Access the Service
To access this service via `curl`, you need to determine its ingress address. To access this service via `curl`, you need to determine its ingress address.
1. To determine if your service is ready: 1. To determine if your service is ready:
Check the status of your Knative gateway: Check the status of your Knative gateway:
```
kubectl get svc knative-ingressgateway --namespace istio-system --watch
```
When the service is ready, you'll see an IP address in the `EXTERNAL-IP` field: ```
``` kubectl get svc knative-ingressgateway --namespace istio-system --watch
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE ```
knative-ingressgateway LoadBalancer 10.23.247.74 35.203.155.229 80:32380/TCP,443:32390/TCP,32400:32400/TCP 2d
```
CTRL+C to end watch.
Check the status of your route: When the service is ready, you'll see an IP address in the `EXTERNAL-IP` field:
```
kubectl get route --output yaml ```
``` NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
When the route is ready, you'll see the following fields reported as: knative-ingressgateway LoadBalancer 10.23.247.74 35.203.155.229 80:32380/TCP,443:32390/TCP,32400:32400/TCP 2d
```YAML ```
status:
conditions: CTRL+C to end watch.
...
status: "True" Check the status of your route:
type: Ready
domain: telemetrysample-route.default.example.com ```
``` kubectl get route --output yaml
```
When the route is ready, you'll see the following fields reported as:
```YAML
status:
conditions:
...
status: "True"
type: Ready
domain: telemetrysample-route.default.example.com
```
2. Export the ingress hostname and IP as environment 2. Export the ingress hostname and IP as environment
variables: variables:
``` ```
export SERVICE_HOST=`kubectl get route telemetrysample-route --output jsonpath="{.status.domain}"` export SERVICE_HOST=`kubectl get route telemetrysample-route --output jsonpath="{.status.domain}"`
export SERVICE_IP=`kubectl get svc knative-ingressgateway --namespace istio-system --output jsonpath="{.status.loadBalancer.ingress[*].ip}"` export SERVICE_IP=`kubectl get svc knative-ingressgateway --namespace istio-system --output jsonpath="{.status.loadBalancer.ingress[*].ip}"`
``` ```
3. Make a request to the service to see the `Hello World!` message: 3. Make a request to the service to see the `Hello World!` message:
``` ```
curl --header "Host:$SERVICE_HOST" http://${SERVICE_IP} curl --header "Host:$SERVICE_HOST" http://${SERVICE_IP}
``` ```
4. Make a request to the `/log` endpoint to generate logs to the `stdout` file 4. Make a request to the `/log` endpoint to generate logs to the `stdout` file
and generate files under `/var/log` in both `JSON` and plain text formats: and generate files under `/var/log` in both `JSON` and plain text formats:
``` ```
curl --header "Host:$SERVICE_HOST" http://${SERVICE_IP}/log curl --header "Host:$SERVICE_HOST" http://${SERVICE_IP}/log
``` ```
## Access Logs ## Access Logs
You can access to the logs from Kibana UI - see [Logs](../../accessing-logs.md) You can access to the logs from Kibana UI - see [Logs](../../accessing-logs.md)
for more information. for more information.
## Access per Request Traces ## Access per Request Traces
You can access to per request traces from Zipkin UI - see [Traces](../../accessing-traces.md) You can access to per request traces from Zipkin UI - see [Traces](../../accessing-traces.md)
for more information. for more information.
## Accessing Custom Metrics ## Accessing Custom Metrics
You can see published metrics using Prometheus UI. To access to the UI, forward You can see published metrics using Prometheus UI. To access to the UI, forward
the Prometheus server to your machine: the Prometheus server to your machine:
``` ```
kubectl port-forward $(kubectl get pods --selector=app=prometheus,prometheus=test --output=jsonpath="{.items[0].metadata.name}") 9090 kubectl port-forward $(kubectl get pods --selector=app=prometheus,prometheus=test --output=jsonpath="{.items[0].metadata.name}") 9090
``` ```
@ -159,6 +189,7 @@ Then browse to http://localhost:9090.
## Clean up ## Clean up
To clean up the sample service: To clean up the sample service:
``` ```
kubectl delete --filename serving/samples/telemetry-go/ kubectl delete --filename serving/samples/telemetry-go/
``` ```

View File

@ -7,11 +7,12 @@ generates its thumbnail image using the `ffmpeg` framework.
## Before you begin ## Before you begin
* [Install Knative Serving](../../../install/README.md) - [Install Knative Serving](../../../install/README.md)
If you want to test and run the app locally: If you want to test and run the app locally:
* [Install Go](https://golang.org/doc/install)
* [Download `ffmpeg`](https://www.ffmpeg.org/download.html) - [Install Go](https://golang.org/doc/install)
- [Download `ffmpeg`](https://www.ffmpeg.org/download.html)
## Sample code ## Sample code
@ -114,7 +115,6 @@ kubectl apply --filename https://raw.githubusercontent.com/knative/build-templat
kubectl apply --filename sample.yaml kubectl apply --filename sample.yaml
``` ```
Now, if you look at the `status` of the revision, you will see that a build is in progress: Now, if you look at the `status` of the revision, you will see that a build is in progress:
```shell ```shell
@ -134,7 +134,6 @@ items:
Once `BuildComplete` has a `status: "True"`, the revision will be deployed. Once `BuildComplete` has a `status: "True"`, the revision will be deployed.
## Using the app ## Using the app
To confirm that the app deployed, you can check for the Knative Serving service using `kubectl`. To confirm that the app deployed, you can check for the Knative Serving service using `kubectl`.

View File

@ -11,62 +11,75 @@ to illustrate applying a revision, then using that revision for manual traffic s
This section describes how to create an revision by deploying a new configuration. This section describes how to create an revision by deploying a new configuration.
1. Replace the image reference path with our published image path in the configuration files (`serving/samples/traffic-splitting/updated_configuration.yaml`: 1. Replace the image reference path with our published image path in the configuration files (`serving/samples/traffic-splitting/updated_configuration.yaml`:
* Manually replace:
`image: github.com/knative/docs/serving/samples/rest-api-go` with `image: <YOUR_CONTAINER_REGISTRY>/serving/samples/rest-api-go`
Or - Manually replace:
`image: github.com/knative/docs/serving/samples/rest-api-go` with `image: <YOUR_CONTAINER_REGISTRY>/serving/samples/rest-api-go`
* Use run this command: Or
```
perl -pi -e "s@github.com/knative/docs@${REPO}@g" serving/samples/rest-api-go/updated_configuration.yaml - Use run this command:
```
```
perl -pi -e "s@github.com/knative/docs@${REPO}@g" serving/samples/rest-api-go/updated_configuration.yaml
```
2. Deploy the new configuration to update the `RESOURCE` environment variable 2. Deploy the new configuration to update the `RESOURCE` environment variable
from `stock` to `share`: from `stock` to `share`:
``` ```
kubectl apply --filename serving/samples/traffic-splitting/updated_configuration.yaml kubectl apply --filename serving/samples/traffic-splitting/updated_configuration.yaml
``` ```
3. Once deployed, traffic will shift to the new revision automatically. Verify the deployment by checking the route status: 3. Once deployed, traffic will shift to the new revision automatically. Verify the deployment by checking the route status:
``` ```
kubectl get route --output yaml kubectl get route --output yaml
``` ```
4. When the new route is ready, you can access the new endpoints: 4. When the new route is ready, you can access the new endpoints:
The hostname and IP address can be found in the same manner as the [Creating a RESTful Service](../rest-api-go) sample: The hostname and IP address can be found in the same manner as the [Creating a RESTful Service](../rest-api-go) sample:
```
export SERVICE_HOST=`kubectl get route stock-route-example --output jsonpath="{.status.domain}"`
export SERVICE_IP=`kubectl get svc knative-ingressgateway --namespace istio-system \
--output jsonpath="{.status.loadBalancer.ingress[*].ip}"`
```
* Make a request to the index endpoint: ```
``` export SERVICE_HOST=`kubectl get route stock-route-example --output jsonpath="{.status.domain}"`
curl --header "Host:$SERVICE_HOST" http://${SERVICE_IP} export SERVICE_IP=`kubectl get svc knative-ingressgateway --namespace istio-system \
``` --output jsonpath="{.status.loadBalancer.ingress[*].ip}"`
Response body: `Welcome to the share app!` ```
* Make a request to the `/share` endpoint: - Make a request to the index endpoint:
```
curl --header "Host:$SERVICE_HOST" http://${SERVICE_IP}/share
```
Response body: `share ticker not found!, require /share/{ticker}`
* Make a request to the `/share` endpoint with a `ticker` parameter: ```
``` curl --header "Host:$SERVICE_HOST" http://${SERVICE_IP}
curl --header "Host:$SERVICE_HOST" http://${SERVICE_IP}/share/<ticker> ```
```
Response body: `share price for ticker <ticker> is <price>` Response body: `Welcome to the share app!`
- Make a request to the `/share` endpoint:
```
curl --header "Host:$SERVICE_HOST" http://${SERVICE_IP}/share
```
Response body: `share ticker not found!, require /share/{ticker}`
- Make a request to the `/share` endpoint with a `ticker` parameter:
```
curl --header "Host:$SERVICE_HOST" http://${SERVICE_IP}/share/<ticker>
```
Response body: `share price for ticker <ticker> is <price>`
## Manual Traffic Splitting ## Manual Traffic Splitting
This section describes how to manually split traffic to specific revisions. This section describes how to manually split traffic to specific revisions.
1. Get your revisions names via: 1. Get your revisions names via:
``` ```
kubectl get revisions kubectl get revisions
``` ```
``` ```
NAME AGE NAME AGE
stock-configuration-example-00001 11m stock-configuration-example-00001 11m
@ -74,6 +87,7 @@ stock-configuration-example-00002 4m
``` ```
2. Update the `traffic` list in `serving/samples/rest-api-go/sample.yaml` as: 2. Update the `traffic` list in `serving/samples/rest-api-go/sample.yaml` as:
```yaml ```yaml
traffic: traffic:
- revisionName: <YOUR_FIRST_REVISION_NAME> - revisionName: <YOUR_FIRST_REVISION_NAME>
@ -83,14 +97,17 @@ traffic:
``` ```
3. Deploy your traffic revision: 3. Deploy your traffic revision:
``` ```
kubectl apply --filename serving/samples/rest-api-go/sample.yaml kubectl apply --filename serving/samples/rest-api-go/sample.yaml
``` ```
4. Verify the deployment by checking the route status: 4. Verify the deployment by checking the route status:
``` ```
kubectl get route --output yaml kubectl get route --output yaml
``` ```
Once updated, you can make `curl` requests to the API using either `stock` or `share` Once updated, you can make `curl` requests to the API using either `stock` or `share`
endpoints. endpoints.

View File

@ -41,7 +41,7 @@ collecting log files under `/var/log`. An
is in process to get rid of the sidecar. The steps to configure are: is in process to get rid of the sidecar. The steps to configure are:
1. Replace `logging.fluentd-sidecar-output-config` flag in 1. Replace `logging.fluentd-sidecar-output-config` flag in
[config-observability](https://github.com/knative/serving/blob/master/config/config-observability.yaml) with the [config-observability](https://github.com/knative/serving/blob/master/config/config-observability.yaml) with the
desired output configuration. **NOTE**: The Fluentd DaemonSet is in desired output configuration. **NOTE**: The Fluentd DaemonSet is in
`monitoring` namespace while the Fluentd sidecar is in the namespace same with `monitoring` namespace while the Fluentd sidecar is in the namespace same with
the app. There may be small differences between the configuration for DaemonSet the app. There may be small differences between the configuration for DaemonSet

View File

@ -14,7 +14,7 @@ To change the {default-domain} value there are a few steps involved:
kubectl edit cm config-domain --namespace knative-serving kubectl edit cm config-domain --namespace knative-serving
``` ```
This command opens your default text editor and allows you to edit the config map. This command opens your default text editor and allows you to edit the config map.
```yaml ```yaml
apiVersion: v1 apiVersion: v1
@ -25,7 +25,7 @@ To change the {default-domain} value there are a few steps involved:
``` ```
1. Edit the file to replace `example.com` with the domain you'd like to use and save your changes. 1. Edit the file to replace `example.com` with the domain you'd like to use and save your changes.
In this example, we configure `mydomain.com` for all routes: In this example, we configure `mydomain.com` for all routes:
```yaml ```yaml
apiVersion: v1 apiVersion: v1
@ -43,29 +43,29 @@ You can also apply an updated domain configuration:
replacing the `example.org` and `example.com` values with the new replacing the `example.org` and `example.com` values with the new
domain you want to use: domain you want to use:
```yaml ```yaml
apiVersion: v1 apiVersion: v1
kind: ConfigMap kind: ConfigMap
metadata: metadata:
name: config-domain name: config-domain
namespace: knative-serving namespace: knative-serving
data: data:
# These are example settings of domain. # These are example settings of domain.
# example.org will be used for routes having app=prod. # example.org will be used for routes having app=prod.
example.org: | example.org: |
selector: selector:
app: prod app: prod
# Default value for domain, for routes that does not have app=prod labels. # Default value for domain, for routes that does not have app=prod labels.
# Although it will match all routes, it is the least-specific rule so it # Although it will match all routes, it is the least-specific rule so it
# will only be used if no other domain matches. # will only be used if no other domain matches.
example.com: "" example.com: ""
``` ```
1. Apply updated domain configuration to your cluster: 1. Apply updated domain configuration to your cluster:
```shell ```shell
kubectl apply --filename config-domain.yaml kubectl apply --filename config-domain.yaml
``` ```
## Deploy an application ## Deploy an application
@ -73,23 +73,25 @@ You can also apply an updated domain configuration:
> the configuration map and automatically update the host name for all of the deployed > the configuration map and automatically update the host name for all of the deployed
> services and routes. > services and routes.
Deploy an app (for example, [`helloworld-go`](./samples/helloworld-go/README.md)), to
Deploy an app (for example, [`helloworld-go`](./samples/helloworld-go/README.md)), to your cluster as normal. You can check the customized domain in Knative Route "helloworld-go" with
your cluster as normal. You can check the customized domain in Knative Route "helloworld-go" with
the following command: the following command:
```shell ```shell
kubectl get route helloworld-go --output jsonpath="{.status.domain}" kubectl get route helloworld-go --output jsonpath="{.status.domain}"
``` ```
You should see the full customized domain: `helloworld-go.default.mydomain.com`. You should see the full customized domain: `helloworld-go.default.mydomain.com`.
And you can check the IP address of your Knative gateway by running: And you can check the IP address of your Knative gateway by running:
```shell ```shell
kubectl get svc knative-ingressgateway --namespace istio-system --output jsonpath="{.status.loadBalancer.ingress[*]['ip']}" kubectl get svc knative-ingressgateway --namespace istio-system --output jsonpath="{.status.loadBalancer.ingress[*]['ip']}"
``` ```
## Local DNS setup ## Local DNS setup
You can map the domain to the IP address of your Knative gateway in your local You can map the domain to the IP address of your Knative gateway in your local
machine with: machine with:
```shell ```shell
@ -103,6 +105,7 @@ export DOMAIN_NAME=`kubectl get route helloworld-go --output jsonpath="{.status.
echo -e "$GATEWAY_IP\t$DOMAIN_NAME" | sudo tee -a /etc/hosts echo -e "$GATEWAY_IP\t$DOMAIN_NAME" | sudo tee -a /etc/hosts
``` ```
You can now access your domain from the browser in your machine and do some quick checks. You can now access your domain from the browser in your machine and do some quick checks.
## Publish your Domain ## Publish your Domain
@ -111,36 +114,35 @@ Follow these steps to make your domain publicly accessible:
### Set static IP for Knative Gateway ### Set static IP for Knative Gateway
You might want to [set a static IP for your Knative gateway](gke-assigning-static-ip-address.md), You might want to [set a static IP for your Knative gateway](gke-assigning-static-ip-address.md),
so that the gateway IP does not change each time your cluster is restarted. so that the gateway IP does not change each time your cluster is restarted.
### Update your DNS records ### Update your DNS records
To publish your domain, you need to update your DNS provider to point to the To publish your domain, you need to update your DNS provider to point to the
IP address for your service ingress. IP address for your service ingress.
* Create a [wildcard record](https://support.google.com/domains/answer/4633759) - Create a [wildcard record](https://support.google.com/domains/answer/4633759)
for the namespace and custom domain to the ingress IP Address, which would enable for the namespace and custom domain to the ingress IP Address, which would enable
hostnames for multiple services in the same namespace to work without creating hostnames for multiple services in the same namespace to work without creating
additional DNS entries. additional DNS entries.
```dns ```dns
*.default.mydomain.com 59 IN A 35.237.28.44 *.default.mydomain.com 59 IN A 35.237.28.44
``` ```
* Create an A record to point from the fully qualified domain name to the IP - Create an A record to point from the fully qualified domain name to the IP
address of your Knative gateway. This step needs to be done for each Knative Service or address of your Knative gateway. This step needs to be done for each Knative Service or
Route created. Route created.
```dns ```dns
helloworld-go.default.mydomain.com 59 IN A 35.237.28.44 helloworld-go.default.mydomain.com 59 IN A 35.237.28.44
``` ```
If you are using Google Cloud DNS, you can find step-by-step instructions If you are using Google Cloud DNS, you can find step-by-step instructions
in the [Cloud DNS quickstart](https://cloud.google.com/dns/quickstart). in the [Cloud DNS quickstart](https://cloud.google.com/dns/quickstart).
Once the domain update has propagated, you can access your app using
Once the domain update has propagated, you can access your app using
the fully qualified domain name of the deployed route, for example the fully qualified domain name of the deployed route, for example
`http://helloworld-go.default.mydomain.com` `http://helloworld-go.default.mydomain.com`

View File

@ -52,22 +52,22 @@ spec:
selector: selector:
knative: ingressgateway knative: ingressgateway
servers: servers:
- hosts: - hosts:
- '*' - "*"
port: port:
name: http name: http
number: 80 number: 80
protocol: HTTP protocol: HTTP
- hosts: - hosts:
- '*' - "*"
port: port:
name: https name: https
number: 443 number: 443
protocol: HTTPS protocol: HTTPS
tls: tls:
mode: SIMPLE mode: SIMPLE
privateKey: /etc/istio/ingressgateway-certs/tls.key privateKey: /etc/istio/ingressgateway-certs/tls.key
serverCertificate: /etc/istio/ingressgateway-certs/tls.crt serverCertificate: /etc/istio/ingressgateway-certs/tls.crt
``` ```
Once the change has been made, you can now use the HTTPS protocol to access Once the change has been made, you can now use the HTTPS protocol to access
@ -88,9 +88,9 @@ Encrypt][le] to obtain a certificate manually.
1. Use the certbot to request a certificate, using DNS validation. The certbot tool will walk 1. Use the certbot to request a certificate, using DNS validation. The certbot tool will walk
you through validating your domain ownership by creating TXT records in your domain. you through validating your domain ownership by creating TXT records in your domain.
```shell ```shell
./certbot-auto certonly --manual --preferred-challenges dns -d '*.default.yourdomain.com' ./certbot-auto certonly --manual --preferred-challenges dns -d '*.default.yourdomain.com'
``` ```
1. When certbot is complete, you will have two output files, `privkey.pem` and `fullchain.pem`. These files 1. When certbot is complete, you will have two output files, `privkey.pem` and `fullchain.pem`. These files
map to the `cert.pk` and `cert.pem` files used above. map to the `cert.pk` and `cert.pem` files used above.
@ -107,20 +107,20 @@ To install cert-manager into your cluster, use kubectl to apply the cert-manager
``` ```
kubectl apply --filename https://raw.githubusercontent.com/jetstack/cert-manager/release-0.5/contrib/manifests/cert-manager/with-rbac.yaml kubectl apply --filename https://raw.githubusercontent.com/jetstack/cert-manager/release-0.5/contrib/manifests/cert-manager/with-rbac.yaml
``` ```
or see the [cert-manager docs](https://cert-manager.readthedocs.io/en/latest/getting-started/) for more ways to install and customize. or see the [cert-manager docs](https://cert-manager.readthedocs.io/en/latest/getting-started/) for more ways to install and customize.
### Configure cert-manager for your DNS provider ### Configure cert-manager for your DNS provider
Once you have installed cert-manager, you'll need to configure it for your DNS Once you have installed cert-manager, you'll need to configure it for your DNS
hosting provider. hosting provider.
Knative currently only works with the `DNS01` challenge type for LetsEncrypt, which Knative currently only works with the `DNS01` challenge type for LetsEncrypt, which
is only supported by a [small number of DNS providers through cert-manager](http://docs.cert-manager.io/en/latest/reference/issuers/acme/dns01.html?highlight=DNS#supported-dns01-providers). is only supported by a [small number of DNS providers through cert-manager](http://docs.cert-manager.io/en/latest/reference/issuers/acme/dns01.html?highlight=DNS#supported-dns01-providers).
Instructions for configuring cert-manager are provided for the following DNS hosts: Instructions for configuring cert-manager are provided for the following DNS hosts:
* [Google Cloud DNS](using-cert-manager-on-gcp.md) - [Google Cloud DNS](using-cert-manager-on-gcp.md)
--- ---

View File

@ -12,6 +12,7 @@ to their zone to prove ownership. Other challenge types are not currently suppor
Knative. Knative.
## Creating a Cloud DNS service account ## Creating a Cloud DNS service account
To add the TXT record, configure Knative with a service account To add the TXT record, configure Knative with a service account
that can be used by cert-manager to create and update the DNS record. that can be used by cert-manager to create and update the DNS record.
@ -57,7 +58,7 @@ rm ~/key.json
## Configuring CertManager to use your DNS admin service account ## Configuring CertManager to use your DNS admin service account
Next, configure cert-manager to request new certificates and Next, configure cert-manager to request new certificates and
verify the challenges using DNS. verify the challenges using DNS.
### Specifying a certificate issuer ### Specifying a certificate issuer
@ -105,24 +106,24 @@ To check if your ClusterIssuer is valid, enter:
kubectl get clusterissuer --namespace cert-manager letsencrypt-issuer --output yaml kubectl get clusterissuer --namespace cert-manager letsencrypt-issuer --output yaml
``` ```
Then confirm that its conditions have `Ready=True`. For example: Then confirm that its conditions have `Ready=True`. For example:
```yaml ```yaml
status: status:
acme: acme:
uri: https://acme-v02.api.letsencrypt.org/acme/acct/40759665 uri: https://acme-v02.api.letsencrypt.org/acme/acct/40759665
conditions: conditions:
- lastTransitionTime: 2018-08-23T01:44:54Z - lastTransitionTime: 2018-08-23T01:44:54Z
message: The ACME account was registered with the ACME server message: The ACME account was registered with the ACME server
reason: ACMEAccountRegistered reason: ACMEAccountRegistered
status: "True" status: "True"
type: Ready type: Ready
``` ```
### Specifying the certificate ### Specifying the certificate
Next, configure which certificate issuer to use Next, configure which certificate issuer to use
and which secret you will publish the certificate into. Use the Secret `istio-ingressgateway-certs`. and which secret you will publish the certificate into. Use the Secret `istio-ingressgateway-certs`.
The following steps will overwrite this Secret if it already exists. The following steps will overwrite this Secret if it already exists.
```shell ```shell
@ -173,23 +174,25 @@ To check that your certificate setting is valid, enter:
kubectl get certificate --namespace istio-system my-certificate --output yaml kubectl get certificate --namespace istio-system my-certificate --output yaml
``` ```
Verify that its `Status.Conditions` have `Ready=True`. For example: Verify that its `Status.Conditions` have `Ready=True`. For example:
```yaml ```yaml
status: status:
acme: acme:
order: order:
url: https://acme-v02.api.letsencrypt.org/acme/order/40759665/45358362 url: https://acme-v02.api.letsencrypt.org/acme/order/40759665/45358362
conditions: conditions:
- lastTransitionTime: 2018-08-23T02:28:44Z - lastTransitionTime: 2018-08-23T02:28:44Z
message: Certificate issued successfully message: Certificate issued successfully
reason: CertIssued reason: CertIssued
status: "True" status: "True"
type: Ready type: Ready
``` ```
A condition with `Ready=False` is a failure to obtain certificate, and such A condition with `Ready=False` is a failure to obtain certificate, and such
condition usually has an error message to indicate the reason of failure. condition usually has an error message to indicate the reason of failure.
### Configuring the gateway ### Configuring the gateway
In the last step, configure the knative-shared-gateway to use the certificate In the last step, configure the knative-shared-gateway to use the certificate
that is generated and stored automatically by cert-manager. that is generated and stored automatically by cert-manager.
@ -230,4 +233,3 @@ EOF
Now you can access your services via HTTPS; cert-manager will keep your certificates Now you can access your services via HTTPS; cert-manager will keep your certificates
up-to-date, replacing them before the certificate expires. up-to-date, replacing them before the certificate expires.

View File

@ -1,6 +1,6 @@
# Using ExternalDNS to automate DNS setup # Using ExternalDNS to automate DNS setup
[ExternalDNS](https://github.com/kubernetes-incubator/external-dns) is a tool [ExternalDNS](https://github.com/kubernetes-incubator/external-dns) is a tool
that synchronizes exposed Kubernetes Services and Ingresses with DNS providers. that synchronizes exposed Kubernetes Services and Ingresses with DNS providers.
This doc explains how to set up ExternalDNS within a Knative cluster using This doc explains how to set up ExternalDNS within a Knative cluster using
@ -18,11 +18,14 @@ of publishing the Knative domain.
1. [Knative Serving](https://github.com/knative/docs/blob/master/install/README.md) installed on your cluster. 1. [Knative Serving](https://github.com/knative/docs/blob/master/install/README.md) installed on your cluster.
1. A public domain that will be used in Knative. 1. A public domain that will be used in Knative.
1. Knative configured to use your custom domain. 1. Knative configured to use your custom domain.
```shell ```shell
kubectl edit cm config-domain --namespace knative-serving kubectl edit cm config-domain --namespace knative-serving
``` ```
This command opens your default text editor and allows you to edit the config
This command opens your default text editor and allows you to edit the config
map. map.
``` ```
apiVersion: v1 apiVersion: v1
data: data:
@ -30,9 +33,11 @@ data:
kind: ConfigMap kind: ConfigMap
[...] [...]
``` ```
Edit the file to replace `example.com` with the domain you'd like to use and
Edit the file to replace `example.com` with the domain you'd like to use and
save your changes. In this example, we use domain `external-dns-test.my-org.do` save your changes. In this example, we use domain `external-dns-test.my-org.do`
for all routes: for all routes:
``` ```
apiVersion: v1 apiVersion: v1
data: data:
@ -43,7 +48,7 @@ kind: ConfigMap
## Setup steps ## Setup steps
This guide uses Google Cloud Platform as an example to show how to set up This guide uses Google Cloud Platform as an example to show how to set up
ExternalDNS. You can find detailed instructions for other cloud providers in the ExternalDNS. You can find detailed instructions for other cloud providers in the
[ExternalDNS documentation](https://github.com/kubernetes-incubator/external-dns#deploying-to-a-cluster). [ExternalDNS documentation](https://github.com/kubernetes-incubator/external-dns#deploying-to-a-cluster).
@ -56,38 +61,45 @@ of DNS providers supported by ExternalDNS. Choose a DNS provider from the list.
### Create a DNS zone for managing DNS records ### Create a DNS zone for managing DNS records
Skip this step if you already have a zone for managing the DNS records of your Skip this step if you already have a zone for managing the DNS records of your
custom domain. custom domain.
A DNS zone which will contain the managed DNS records needs to be created. A DNS zone which will contain the managed DNS records needs to be created.
Assume your custom domain is `external-dns-test.my-org.do`. Assume your custom domain is `external-dns-test.my-org.do`.
Use the following command to create a DNS zone with [Google Cloud DNS](https://cloud.google.com/dns/): Use the following command to create a DNS zone with [Google Cloud DNS](https://cloud.google.com/dns/):
```shell ```shell
gcloud dns managed-zones create "external-dns-zone" \ gcloud dns managed-zones create "external-dns-zone" \
--dns-name "external-dns-test.my-org.do." \ --dns-name "external-dns-test.my-org.do." \
--description "Automatically managed zone by kubernetes.io/external-dns" --description "Automatically managed zone by kubernetes.io/external-dns"
``` ```
Make a note of the nameservers that were assigned to your new zone. Make a note of the nameservers that were assigned to your new zone.
```shell ```shell
gcloud dns record-sets list \ gcloud dns record-sets list \
--zone "external-dns-zone" \ --zone "external-dns-zone" \
--name "external-dns-test.my-org.do." \ --name "external-dns-test.my-org.do." \
--type NS --type NS
``` ```
You should see output similar to the following: You should see output similar to the following:
``` ```
NAME TYPE TTL DATA NAME TYPE TTL DATA
external-dns-test.my-org.do. NS 21600 ns-cloud-e1.googledomains.com.,ns-cloud-e2.googledomains.com.,ns-cloud-e3.googledomains.com.,ns-cloud-e4.googledomains.com. external-dns-test.my-org.do. NS 21600 ns-cloud-e1.googledomains.com.,ns-cloud-e2.googledomains.com.,ns-cloud-e3.googledomains.com.,ns-cloud-e4.googledomains.com.
``` ```
In this case, the DNS nameservers are `ns-cloud-{e1-e4}.googledomains.com`.
In this case, the DNS nameservers are `ns-cloud-{e1-e4}.googledomains.com`.
Yours could differ slightly, e.g. {a1-a4}, {b1-b4} etc. Yours could differ slightly, e.g. {a1-a4}, {b1-b4} etc.
If this zone has the parent zone, you need to add NS records of this zone into If this zone has the parent zone, you need to add NS records of this zone into
the parent zone so that this zone can be found from the parent. the parent zone so that this zone can be found from the parent.
Assuming the parent zone is `my-org-do` and the parent domain is `my-org.do`, Assuming the parent zone is `my-org-do` and the parent domain is `my-org.do`,
and the parent zone is also hosted at Google Cloud DNS, you can follow these and the parent zone is also hosted at Google Cloud DNS, you can follow these
steps to add the NS records of this zone into the parent zone: steps to add the NS records of this zone into the parent zone:
```shell ```shell
gcloud dns record-sets transaction start --zone "my-org-do" gcloud dns record-sets transaction start --zone "my-org-do"
gcloud dns record-sets transaction add ns-cloud-e{1..4}.googledomains.com. \ gcloud dns record-sets transaction add ns-cloud-e{1..4}.googledomains.com. \
@ -97,15 +109,18 @@ gcloud dns record-sets transaction execute --zone "my-org-do"
### Deploy ExternalDNS ### Deploy ExternalDNS
Use the following command to apply the [manifest](https://github.com/kubernetes-incubator/external-dns/blob/master/docs/tutorials/gke.md#manifest-for-clusters-without-rbac-enabled) to install ExternalDNS Use the following command to apply the [manifest](https://github.com/kubernetes-incubator/external-dns/blob/master/docs/tutorials/gke.md#manifest-for-clusters-without-rbac-enabled) to install ExternalDNS
```shell ```shell
cat <<EOF | kubectl apply --filename - cat <<EOF | kubectl apply --filename -
<the-content-of-manifest-with-custom-domain-filter> <the-content-of-manifest-with-custom-domain-filter>
EOF EOF
``` ```
Note that you need to set the argument `domain-filter` to your custom domain. Note that you need to set the argument `domain-filter` to your custom domain.
You should see ExternalDNS is installed by running: You should see ExternalDNS is installed by running:
```shell ```shell
kubectl get deployment external-dns kubectl get deployment external-dns
``` ```
@ -115,12 +130,15 @@ kubectl get deployment external-dns
In order to publish the Knative Gateway service, the annotation In order to publish the Knative Gateway service, the annotation
`external-dns.alpha.kubernetes.io/hostname: '*.external-dns-test.my-org.do'` `external-dns.alpha.kubernetes.io/hostname: '*.external-dns-test.my-org.do'`
needs to be added into Knative gateway service: needs to be added into Knative gateway service:
```shell ```shell
kubectl edit svc knative-ingressgateway --namespace istio-system kubectl edit svc knative-ingressgateway --namespace istio-system
``` ```
This command opens your default text editor and allows you to add the
This command opens your default text editor and allows you to add the
annotation to `knative-ingressgateway` service. After you've added your annotation to `knative-ingressgateway` service. After you've added your
annotation, your file may look similar to this: annotation, your file may look similar to this:
``` ```
apiVersion: v1 apiVersion: v1
kind: Service kind: Service
@ -132,12 +150,13 @@ metadata:
### Verify ExternalDNS works ### Verify ExternalDNS works
After roughly two minutes, check that a corresponding DNS record for your After roughly two minutes, check that a corresponding DNS record for your
service was created. service was created.
```shell ```shell
gcloud dns record-sets list --zone "external-dns-zone" --name "*.external-dns-test.my-org.do." gcloud dns record-sets list --zone "external-dns-zone" --name "*.external-dns-test.my-org.do."
``` ```
You should see output similar to: You should see output similar to:
``` ```
@ -150,12 +169,16 @@ NAME TYPE TTL DATA
You can check if the domain has been published to the Internet be entering You can check if the domain has been published to the Internet be entering
the following command: the following command:
```shell ```shell
host test.external-dns-test.my-org.do host test.external-dns-test.my-org.do
``` ```
You should see the below result after the domain is published: You should see the below result after the domain is published:
``` ```
test.external-dns-test.my-org.do has address 35.231.248.30 test.external-dns-test.my-org.do has address 35.231.248.30
``` ```
> Note: The process of publishing the domain to the Internet can take several
minutes. > Note: The process of publishing the domain to the Internet can take several
> minutes.

View File

@ -2,9 +2,8 @@
This directory contains tests and testing docs. This directory contains tests and testing docs.
* [Unit tests](#running-unit-tests) currently reside in the codebase alongside the code they test - [Unit tests](#running-unit-tests) currently reside in the codebase alongside the code they test
* [End-to-end tests](#running-end-to-end-tests) - [End-to-end tests](#running-end-to-end-tests)
## Running unit tests ## Running unit tests